OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 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 | 30 |
31 #include "src/inspector/V8RuntimeAgentImpl.h" | 31 #include "src/inspector/V8RuntimeAgentImpl.h" |
32 | 32 |
33 #include "src/inspector/InjectedScript.h" | 33 #include "src/inspector/InjectedScript.h" |
34 #include "src/inspector/InspectedContext.h" | 34 #include "src/inspector/InspectedContext.h" |
35 #include "src/inspector/RemoteObjectId.h" | 35 #include "src/inspector/RemoteObjectId.h" |
36 #include "src/inspector/StringUtil.h" | 36 #include "src/inspector/StringUtil.h" |
37 #include "src/inspector/V8Compat.h" | |
38 #include "src/inspector/V8ConsoleMessage.h" | 37 #include "src/inspector/V8ConsoleMessage.h" |
39 #include "src/inspector/V8Debugger.h" | 38 #include "src/inspector/V8Debugger.h" |
40 #include "src/inspector/V8DebuggerAgentImpl.h" | 39 #include "src/inspector/V8DebuggerAgentImpl.h" |
41 #include "src/inspector/V8InspectorImpl.h" | 40 #include "src/inspector/V8InspectorImpl.h" |
42 #include "src/inspector/V8InspectorSessionImpl.h" | 41 #include "src/inspector/V8InspectorSessionImpl.h" |
43 #include "src/inspector/V8StackTraceImpl.h" | 42 #include "src/inspector/V8StackTraceImpl.h" |
44 #include "src/inspector/protocol/Protocol.h" | 43 #include "src/inspector/protocol/Protocol.h" |
45 #include "src/inspector/public/V8InspectorClient.h" | 44 |
| 45 #include "include/v8-inspector.h" |
46 | 46 |
47 namespace v8_inspector { | 47 namespace v8_inspector { |
48 | 48 |
49 namespace V8RuntimeAgentImplState { | 49 namespace V8RuntimeAgentImplState { |
50 static const char customObjectFormatterEnabled[] = | 50 static const char customObjectFormatterEnabled[] = |
51 "customObjectFormatterEnabled"; | 51 "customObjectFormatterEnabled"; |
52 static const char runtimeEnabled[] = "runtimeEnabled"; | 52 static const char runtimeEnabled[] = "runtimeEnabled"; |
53 }; | 53 }; |
54 | 54 |
55 using protocol::Runtime::RemoteObject; | 55 using protocol::Runtime::RemoteObject; |
(...skipping 24 matching lines...) Expand all Loading... |
80 } | 80 } |
81 v8::Local<v8::Promise> promise = | 81 v8::Local<v8::Promise> promise = |
82 v8::Local<v8::Promise>::Cast(value.ToLocalChecked()); | 82 v8::Local<v8::Promise>::Cast(value.ToLocalChecked()); |
83 Callback* rawCallback = callback.get(); | 83 Callback* rawCallback = callback.get(); |
84 ProtocolPromiseHandler<Callback>* handler = new ProtocolPromiseHandler( | 84 ProtocolPromiseHandler<Callback>* handler = new ProtocolPromiseHandler( |
85 inspector, contextGroupId, executionContextId, objectGroup, | 85 inspector, contextGroupId, executionContextId, objectGroup, |
86 returnByValue, generatePreview, std::move(callback)); | 86 returnByValue, generatePreview, std::move(callback)); |
87 v8::Local<v8::Value> wrapper = handler->m_wrapper.Get(inspector->isolate()); | 87 v8::Local<v8::Value> wrapper = handler->m_wrapper.Get(inspector->isolate()); |
88 | 88 |
89 v8::Local<v8::Function> thenCallbackFunction = | 89 v8::Local<v8::Function> thenCallbackFunction = |
90 V8_FUNCTION_NEW_REMOVE_PROTOTYPE(context, thenCallback, wrapper, 0) | 90 v8::Function::New(context, thenCallback, wrapper, 0, |
| 91 v8::ConstructorBehavior::kThrow) |
91 .ToLocalChecked(); | 92 .ToLocalChecked(); |
92 if (promise->Then(context, thenCallbackFunction).IsEmpty()) { | 93 if (promise->Then(context, thenCallbackFunction).IsEmpty()) { |
93 rawCallback->sendFailure("Internal error"); | 94 rawCallback->sendFailure("Internal error"); |
94 return; | 95 return; |
95 } | 96 } |
96 v8::Local<v8::Function> catchCallbackFunction = | 97 v8::Local<v8::Function> catchCallbackFunction = |
97 V8_FUNCTION_NEW_REMOVE_PROTOTYPE(context, catchCallback, wrapper, 0) | 98 v8::Function::New(context, catchCallback, wrapper, 0, |
| 99 v8::ConstructorBehavior::kThrow) |
98 .ToLocalChecked(); | 100 .ToLocalChecked(); |
99 if (promise->Catch(context, catchCallbackFunction).IsEmpty()) { | 101 if (promise->Catch(context, catchCallbackFunction).IsEmpty()) { |
100 rawCallback->sendFailure("Internal error"); | 102 rawCallback->sendFailure("Internal error"); |
101 return; | 103 return; |
102 } | 104 } |
103 } | 105 } |
104 | 106 |
105 private: | 107 private: |
106 static void thenCallback(const v8::FunctionCallbackInfo<v8::Value>& info) { | 108 static void thenCallback(const v8::FunctionCallbackInfo<v8::Value>& info) { |
107 ProtocolPromiseHandler<Callback>* handler = | 109 ProtocolPromiseHandler<Callback>* handler = |
(...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
717 if (m_enabled) reportMessage(message, true); | 719 if (m_enabled) reportMessage(message, true); |
718 } | 720 } |
719 | 721 |
720 void V8RuntimeAgentImpl::reportMessage(V8ConsoleMessage* message, | 722 void V8RuntimeAgentImpl::reportMessage(V8ConsoleMessage* message, |
721 bool generatePreview) { | 723 bool generatePreview) { |
722 message->reportToFrontend(&m_frontend, m_session, generatePreview); | 724 message->reportToFrontend(&m_frontend, m_session, generatePreview); |
723 m_frontend.flush(); | 725 m_frontend.flush(); |
724 } | 726 } |
725 | 727 |
726 } // namespace v8_inspector | 728 } // namespace v8_inspector |
OLD | NEW |