OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. 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 16 matching lines...) Expand all Loading... |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 #include "config.h" | 30 #include "config.h" |
31 | 31 |
32 #include "DartJsInterop.h" | 32 #include "DartJsInterop.h" |
33 | 33 |
34 #include "DartJsInteropData.h" | 34 #include "DartJsInteropData.h" |
35 #include "bindings/dart/DartDOMWrapper.h" | 35 #include "bindings/dart/DartDOMWrapper.h" |
36 #include "bindings/dart/DartHandleProxy.h" | 36 #include "bindings/dart/DartHandleProxy.h" |
37 #include "bindings/dart/DartScriptValue.h" | 37 #include "bindings/dart/DartPersistentValue.h" |
38 #include "bindings/dart/DartUtilities.h" | 38 #include "bindings/dart/DartUtilities.h" |
39 #include "bindings/dart/V8Converter.h" | 39 #include "bindings/dart/V8Converter.h" |
40 #include "bindings/v8/V8Binding.h" | 40 #include "bindings/v8/V8Binding.h" |
41 #include "bindings/v8/V8ScriptRunner.h" | 41 #include "bindings/v8/V8ScriptRunner.h" |
42 | 42 |
43 #include "wtf/StdLibExtras.h" | 43 #include "wtf/StdLibExtras.h" |
44 | 44 |
45 #include <dart_api.h> | 45 #include <dart_api.h> |
46 #include <limits> | 46 #include <limits> |
47 | 47 |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 ASSERT(!exception); | 259 ASSERT(!exception); |
260 if (handle) | 260 if (handle) |
261 return handle; | 261 return handle; |
262 | 262 |
263 // Unwrap objects passed from Dart to JS that are being passed back to | 263 // Unwrap objects passed from Dart to JS that are being passed back to |
264 // Dart. FIXME: we do not yet handle unwrapping JS functions passed | 264 // Dart. FIXME: we do not yet handle unwrapping JS functions passed |
265 // from Dart to JS as we have to wrap them with true JS Function objects. | 265 // from Dart to JS as we have to wrap them with true JS Function objects. |
266 // If this use case is important we can support it at the cost of hanging | 266 // If this use case is important we can support it at the cost of hanging |
267 // an extra expando off the JS function wrapping the Dart function. | 267 // an extra expando off the JS function wrapping the Dart function. |
268 if (DartHandleProxy::isDartProxy(v8Handle)) { | 268 if (DartHandleProxy::isDartProxy(v8Handle)) { |
269 DartScriptValue* scriptValue = DartHandleProxy::readPointerFromProxy(v8H
andle); | 269 DartPersistentValue* scriptValue = DartHandleProxy::readPointerFromProxy
(v8Handle); |
270 ASSERT(scriptValue->isIsolateAlive()); | 270 ASSERT(scriptValue->isIsolateAlive()); |
271 return scriptValue->value(); | 271 return scriptValue->value(); |
272 } | 272 } |
273 | 273 |
274 return JsObject::toDart(object); | 274 return JsObject::toDart(object); |
275 } | 275 } |
276 | 276 |
277 Dart_Handle JsObject::toDart(v8::Local<v8::Object> object) | 277 Dart_Handle JsObject::toDart(v8::Local<v8::Object> object) |
278 { | 278 { |
279 // FIXME: perform caching so that === can be used. | 279 // FIXME: perform caching so that === can be used. |
(...skipping 768 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1048 if (argumentCount == 1 && name == "JsArray_length") | 1048 if (argumentCount == 1 && name == "JsArray_length") |
1049 return JsInteropInternal::jsArrayLengthCallback; | 1049 return JsInteropInternal::jsArrayLengthCallback; |
1050 | 1050 |
1051 if (argumentCount == 1 && name == "JsObject_fromBrowserObject") | 1051 if (argumentCount == 1 && name == "JsObject_fromBrowserObject") |
1052 return JsInteropInternal::fromBrowserObjectCallback; | 1052 return JsInteropInternal::fromBrowserObjectCallback; |
1053 | 1053 |
1054 return 0; | 1054 return 0; |
1055 } | 1055 } |
1056 | 1056 |
1057 } | 1057 } |
OLD | NEW |