| OLD | NEW |
| (Empty) | |
| 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * |
| 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are |
| 6 * met: |
| 7 * |
| 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above |
| 11 * copyright notice, this list of conditions and the following disclaimer |
| 12 * in the documentation and/or other materials provided with the |
| 13 * distribution. |
| 14 * * Neither the name of Google Inc. nor the names of its |
| 15 * contributors may be used to endorse or promote products derived from |
| 16 * this software without specific prior written permission. |
| 17 * |
| 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 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. |
| 29 */ |
| 30 |
| 31 #ifndef DartJsInterop_h |
| 32 #define DartJsInterop_h |
| 33 |
| 34 #include "bindings/core/dart/DartDOMData.h" |
| 35 #include "bindings/core/dart/DartScriptValue.h" |
| 36 #include "wtf/RefCounted.h" |
| 37 |
| 38 #include <dart_api.h> |
| 39 #include <dart_mirrors_api.h> |
| 40 #include <v8.h> |
| 41 |
| 42 namespace blink { |
| 43 |
| 44 class LocalDOMWindow; |
| 45 class Node; |
| 46 |
| 47 class JsInterop { |
| 48 public: |
| 49 static Dart_NativeFunction resolver(Dart_Handle nameHandle, int argumentCoun
t, bool* autoSetupScope); |
| 50 static const uint8_t* symbolizer(Dart_NativeFunction); |
| 51 |
| 52 static v8::Local<v8::Value> fromDart(DartDOMData*, Dart_Handle, Dart_Handle&
exception); |
| 53 static Dart_Handle toDart(v8::Local<v8::Value>); |
| 54 }; |
| 55 |
| 56 class JsObject : public RefCounted<JsObject> { |
| 57 WTF_MAKE_NONCOPYABLE(JsObject); |
| 58 private: |
| 59 JsObject(v8::Local<v8::Object> v8Handle); |
| 60 public: |
| 61 static Dart_Handle toDart(v8::Local<v8::Object>); |
| 62 static Dart_Handle toDart(PassRefPtr<JsObject>); |
| 63 |
| 64 ~JsObject(); |
| 65 |
| 66 static PassRefPtr<JsObject> create(v8::Local<v8::Object> v8Handle); |
| 67 |
| 68 v8::Local<v8::Object> localV8Object(); |
| 69 |
| 70 static const int dartClassId; |
| 71 static const bool isNode = false; |
| 72 static const bool isEventTarget = false; |
| 73 static const bool isActive = false; |
| 74 static const bool isGarbageCollected = false; |
| 75 |
| 76 typedef JsObject NativeType; |
| 77 friend class JsFunction; |
| 78 friend class JsArray; |
| 79 private: |
| 80 v8::Persistent<v8::Object> v8Object; |
| 81 }; |
| 82 |
| 83 class JsFunction : public JsObject { |
| 84 WTF_MAKE_NONCOPYABLE(JsFunction); |
| 85 private: |
| 86 JsFunction(v8::Local<v8::Function> v8Handle); |
| 87 |
| 88 public: |
| 89 static Dart_Handle toDart(PassRefPtr<JsFunction> jsObject); |
| 90 |
| 91 static PassRefPtr<JsFunction> create(v8::Local<v8::Function> v8Handle); |
| 92 |
| 93 v8::Local<v8::Function> localV8Function(); |
| 94 |
| 95 static const int dartClassId; |
| 96 static const bool isNode = false; |
| 97 static const bool isEventTarget = false; |
| 98 static const bool isActive = false; |
| 99 static const bool isGarbageCollected = false; |
| 100 |
| 101 typedef JsFunction NativeType; |
| 102 }; |
| 103 |
| 104 class JsArray : public JsObject { |
| 105 WTF_MAKE_NONCOPYABLE(JsArray); |
| 106 private: |
| 107 JsArray(v8::Local<v8::Array> v8Handle); |
| 108 |
| 109 public: |
| 110 static Dart_Handle toDart(PassRefPtr<JsArray> jsObject); |
| 111 |
| 112 static PassRefPtr<JsArray> create(v8::Local<v8::Array> v8Handle); |
| 113 |
| 114 v8::Local<v8::Array> localV8Array(); |
| 115 |
| 116 static const int dartClassId; |
| 117 static const bool isNode = false; |
| 118 static const bool isEventTarget = false; |
| 119 static const bool isActive = false; |
| 120 static const bool isGarbageCollected = false; |
| 121 |
| 122 typedef JsArray NativeType; |
| 123 }; |
| 124 |
| 125 } |
| 126 |
| 127 #endif // DartJsInterop_h |
| OLD | NEW |