| OLD | NEW |
| 1 // Copyright 2011, Google Inc. | 1 // Copyright 2011, Google Inc. |
| 2 // All rights reserved. | 2 // All rights reserved. |
| 3 // | 3 // |
| 4 // Redistribution and use in source and binary forms, with or without | 4 // Redistribution and use in source and binary forms, with or without |
| 5 // modification, are permitted provided that the following conditions are | 5 // modification, are permitted provided that the following conditions are |
| 6 // met: | 6 // met: |
| 7 // | 7 // |
| 8 // * Redistributions of source code must retain the above copyright | 8 // * Redistributions of source code must retain the above copyright |
| 9 // notice, this list of conditions and the following disclaimer. | 9 // notice, this list of conditions and the following disclaimer. |
| 10 // * Redistributions in binary form must reproduce the above | 10 // * Redistributions in binary form must reproduce the above |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 #include "DartXMLHttpRequestException.h" | 69 #include "DartXMLHttpRequestException.h" |
| 70 #include "XPathException.h" | 70 #include "XPathException.h" |
| 71 #include "DartXPathException.h" | 71 #include "DartXPathException.h" |
| 72 // end of FIXME | 72 // end of FIXME |
| 73 | 73 |
| 74 #include <stdio.h> | 74 #include <stdio.h> |
| 75 #include <wtf/text/WTFString.h> | 75 #include <wtf/text/WTFString.h> |
| 76 | 76 |
| 77 namespace WebCore { | 77 namespace WebCore { |
| 78 | 78 |
| 79 void DartDOMWrapper::derefDOMObject(Dart_Handle wrapper, void* domObject) | |
| 80 { | |
| 81 ASSERT(domObject == readNativePointer(wrapper, kNativeImplementationIndex)); | |
| 82 DerefObjectFunction derefObjectFunction = reinterpret_cast<DerefObjectFuncti
on>(readNativePointer(wrapper, kDerefObjectFunctionIndex)); | |
| 83 (*derefObjectFunction)(domObject); | |
| 84 } | |
| 85 | |
| 86 Dart_Handle DartDOMWrapper::instantiateWrapper(const char* className) | 79 Dart_Handle DartDOMWrapper::instantiateWrapper(const char* className) |
| 87 { | 80 { |
| 88 // FIXME: this all is very ugly, but we're blocked by API here. | 81 // FIXME: this all is very ugly, but we're blocked by API here. |
| 89 // In this case we need an API to invoke ctor, or even better, | 82 // In this case we need an API to invoke ctor, or even better, |
| 90 // create an instance without exposing constructor at all. | 83 // create an instance without exposing constructor at all. |
| 91 String factoryMethodName = String("_create") + className; | 84 String factoryMethodName = String("_create") + className; |
| 92 Dart_Handle dom = Dart_LookupLibrary(Dart_NewString(DartUtilities::domLibrar
yName)); | 85 Dart_Handle dom = Dart_LookupLibrary(Dart_NewString(DartUtilities::domLibrar
yName)); |
| 93 ASSERT(!Dart_IsError(dom)); | 86 ASSERT(!Dart_IsError(dom)); |
| 94 | 87 |
| 95 Dart_Handle instance = Dart_InvokeStatic(dom, Dart_NewString(className), Dar
tUtilities::stringToDartString(factoryMethodName), 0, 0); | 88 Dart_Handle instance = Dart_InvokeStatic(dom, Dart_NewString(className), Dar
tUtilities::stringToDartString(factoryMethodName), 0, 0); |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 return toDartValue(static_cast<HTMLElement*>(value)); | 143 return toDartValue(static_cast<HTMLElement*>(value)); |
| 151 } | 144 } |
| 152 | 145 |
| 153 Dart_Handle toDartValue(NPObject* object) | 146 Dart_Handle toDartValue(NPObject* object) |
| 154 { | 147 { |
| 155 // FIXME: put NPObjects into a map as well. | 148 // FIXME: put NPObjects into a map as well. |
| 156 return DartDOMWrapper::newWrapper("NPObject", object); | 149 return DartDOMWrapper::newWrapper("NPObject", object); |
| 157 } | 150 } |
| 158 | 151 |
| 159 } | 152 } |
| OLD | NEW |