Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(76)

Side by Side Diff: Source/bindings/core/dart/DartJsInterop.h

Issue 1532413002: Added Dartium changes onto 45.0.2454.104 (Closed) Base URL: http://src.chromium.org/blink/branches/chromium/2454
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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 "wtf/RefCounted.h"
36
37 #include <dart_api.h>
38 #include <dart_mirrors_api.h>
39 #include <v8.h>
40
41 namespace blink {
42
43 class LocalDOMWindow;
44 class Node;
45
46 class Element;
47
48 class JsInterop {
49 public:
50 static Dart_NativeFunction resolver(Dart_Handle nameHandle, int argumentCoun t, bool* autoSetupScope);
51 static const uint8_t* symbolizer(Dart_NativeFunction);
52
53 static v8::Local<v8::Value> fromDart(DartDOMData*, Dart_Handle, Dart_Handle& exception);
54 static Dart_Handle toDart(v8::Local<v8::Value>);
55
56 // Return a Blink Element instance (convert to a V8Object which is really a
57 // Javascript object) as a Dart JsObject that points to the Javascript objec t.
58 static void returnBlinkElement(Element*, Dart_NativeArguments, Dart_Handle&) ;
59 static v8::Local<v8::Object> blinkElement(Element* value, Dart_Handle& excep tion);
60
61 // JSInterop callthru.
62 static void jsInteropContextCallback(Dart_NativeArguments args);
63 static void jsInteropGetterCallback(Dart_NativeArguments args);
64 static void jsInteropCallMethodCallback(Dart_NativeArguments args);
65 };
66
67 class JsObject : public RefCounted<JsObject> {
68 WTF_MAKE_NONCOPYABLE(JsObject);
69 private:
70 JsObject(v8::Local<v8::Object> v8Handle);
71 public:
72 static Dart_Handle toDart(v8::Local<v8::Object>);
73 static Dart_Handle toDart(PassRefPtr<JsObject>);
74
75 ~JsObject();
76
77 static PassRefPtr<JsObject> create(v8::Local<v8::Object> v8Handle);
78
79 v8::Local<v8::Object> localV8Object();
80
81 static const int dartClassId;
82 static const bool isNode = false;
83 static const bool isEventTarget = false;
84 static const bool isActive = false;
85 static const bool isGarbageCollected = false;
86
87 typedef JsObject NativeType;
88 friend class JsFunction;
89 friend class JsArray;
90 private:
91 v8::Persistent<v8::Object> v8Object;
92 };
93
94 class JsFunction : public JsObject {
95 WTF_MAKE_NONCOPYABLE(JsFunction);
96 private:
97 JsFunction(v8::Local<v8::Function> v8Handle);
98
99 public:
100 static Dart_Handle toDart(PassRefPtr<JsFunction> jsObject);
101
102 static PassRefPtr<JsFunction> create(v8::Local<v8::Function> v8Handle);
103
104 v8::Local<v8::Function> localV8Function();
105
106 static const int dartClassId;
107 static const bool isNode = false;
108 static const bool isEventTarget = false;
109 static const bool isActive = false;
110 static const bool isGarbageCollected = false;
111
112 typedef JsFunction NativeType;
113 };
114
115 class JsArray : public JsObject {
116 WTF_MAKE_NONCOPYABLE(JsArray);
117 private:
118 JsArray(v8::Local<v8::Array> v8Handle);
119
120 public:
121 static Dart_Handle toDart(PassRefPtr<JsArray> jsObject);
122
123 static PassRefPtr<JsArray> create(v8::Local<v8::Array> v8Handle);
124
125 v8::Local<v8::Array> localV8Array();
126
127 static const int dartClassId;
128 static const bool isNode = false;
129 static const bool isEventTarget = false;
130 static const bool isActive = false;
131 static const bool isGarbageCollected = false;
132
133 typedef JsArray NativeType;
134 };
135
136 }
137
138 #endif // DartJsInterop_h
OLDNEW
« no previous file with comments | « Source/bindings/core/dart/DartIsolateDestructionObserver.cpp ('k') | Source/bindings/core/dart/DartJsInterop.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698