OLD | NEW |
1 // Copyright 2014, Google Inc. | 1 // Copyright 2014, 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 10 matching lines...) Expand all Loading... |
21 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 21 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
22 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 22 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
23 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 23 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
24 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
25 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
26 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
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 #include "DartInjectedScriptHost.h" |
31 | 32 |
32 #include "DartInjectedScriptHost.h" | 33 #include "DartNode.h" |
| 34 |
| 35 #include "bindings/dart/DartDOMWrapper.h" |
| 36 #include "bindings/dart/DartHandleProxy.h" |
| 37 #include "bindings/dart/DartInjectedScript.h" |
| 38 #include "bindings/dart/V8Converter.h" |
| 39 #include "core/events/EventTarget.h" |
| 40 #include "core/frame/DOMWindow.h" |
| 41 #include "core/inspector/InjectedScript.h" |
| 42 #include "core/inspector/InjectedScriptHost.h" |
| 43 #include "core/inspector/InspectorDOMAgent.h" |
| 44 #include "modules/webdatabase/Database.h" |
| 45 #include "platform/JSONValues.h" |
33 | 46 |
34 namespace WebCore { | 47 namespace WebCore { |
35 | 48 |
36 namespace DartInjectedScriptHostInternal { | 49 namespace DartInjectedScriptHostInternal { |
37 | 50 |
38 void inspectCallback(Dart_NativeArguments args) | 51 void inspectCallback(Dart_NativeArguments args) |
39 { | 52 { |
40 // FIXME: proper implementation. | 53 Dart_Handle exception = 0; |
41 DART_UNIMPLEMENTED(); | 54 { |
| 55 InjectedScriptHost* receiver = DartDOMWrapper::receiver< InjectedScriptH
ost >(args); |
| 56 Dart_Handle receiverHandle = Dart_GetNativeArgument(args, 0); |
| 57 ASSERT(!Dart_IsError(receiverHandle)); |
| 58 DartInjectedScript* injectedScript = 0; |
| 59 // FIXME: this is a hack. For convenience we store the |
| 60 // DartInjectedScript as the Dart_Peer of the InjectedScriptHost object |
| 61 // and use it to generate JSON from the Dart_Handle. This differs from |
| 62 // the behavior of V8InjectedScriptHost which assumes the argument |
| 63 // passed as an argument is already JSON. To handle things in the same |
| 64 // way as JavaScript we would need to generate a DartInjectedScript |
| 65 // Dart class. I have put off implementing the correct solution as the |
| 66 // way native binding classes are done for Dartium is in flux at the |
| 67 // moment. |
| 68 Dart_Handle ALLOW_UNUSED result = Dart_GetPeer(receiverHandle, reinterpr
et_cast<void**>(&injectedScript)); |
| 69 if (Dart_IsError(result)) { |
| 70 exception = result; |
| 71 goto fail; |
| 72 } |
| 73 ASSERT(injectedScript); |
| 74 Dart_Handle object = Dart_GetNativeArgument(args, 1); |
| 75 // FIXME: read in the hint argument as well. |
| 76 ASSERT(!Dart_IsError(object)); |
| 77 receiver->inspectImpl(injectedScript->wrapDartObject(object, "", false), |
| 78 JSONObject::create()); |
| 79 |
| 80 if (exception) |
| 81 goto fail; |
| 82 return; |
| 83 } |
| 84 |
| 85 fail: |
| 86 Dart_ThrowException(exception); |
42 } | 87 } |
43 | 88 |
44 void inspectedObjectCallback(Dart_NativeArguments args) | 89 void inspectedObjectCallback(Dart_NativeArguments args) |
45 { | 90 { |
46 // FIXME: proper implementation. | 91 // FIXME: proper implementation. |
47 DART_UNIMPLEMENTED(); | 92 DART_UNIMPLEMENTED(); |
48 } | 93 } |
49 | 94 |
50 void internalConstructorNameCallback(Dart_NativeArguments args) | 95 void internalConstructorNameCallback(Dart_NativeArguments args) |
51 { | 96 { |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 } | 165 } |
121 | 166 |
122 void setFunctionVariableValueCallback(Dart_NativeArguments args) | 167 void setFunctionVariableValueCallback(Dart_NativeArguments args) |
123 { | 168 { |
124 // FIXME: proper implementation. | 169 // FIXME: proper implementation. |
125 DART_UNIMPLEMENTED(); | 170 DART_UNIMPLEMENTED(); |
126 } | 171 } |
127 | 172 |
128 } | 173 } |
129 | 174 |
130 } | 175 } // namespace WebCore |
OLD | NEW |