| 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 17 matching lines...) Expand all Loading... |
| 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 "platform/v8_inspector/V8RuntimeAgentImpl.h" | 31 #include "platform/v8_inspector/V8RuntimeAgentImpl.h" |
| 32 | 32 |
| 33 #include "platform/inspector_protocol/Parser.h" | 33 #include "platform/inspector_protocol/Parser.h" |
| 34 #include "platform/inspector_protocol/Values.h" | 34 #include "platform/inspector_protocol/Values.h" |
| 35 #include "platform/v8_inspector/InjectedScript.h" | 35 #include "platform/v8_inspector/InjectedScript.h" |
| 36 #include "platform/v8_inspector/InspectedContext.h" | 36 #include "platform/v8_inspector/InspectedContext.h" |
| 37 #include "platform/v8_inspector/RemoteObjectId.h" | 37 #include "platform/v8_inspector/RemoteObjectId.h" |
| 38 #include "platform/v8_inspector/V8Compat.h" |
| 38 #include "platform/v8_inspector/V8ConsoleMessage.h" | 39 #include "platform/v8_inspector/V8ConsoleMessage.h" |
| 39 #include "platform/v8_inspector/V8Debugger.h" | 40 #include "platform/v8_inspector/V8Debugger.h" |
| 40 #include "platform/v8_inspector/V8DebuggerAgentImpl.h" | 41 #include "platform/v8_inspector/V8DebuggerAgentImpl.h" |
| 41 #include "platform/v8_inspector/V8InspectorImpl.h" | 42 #include "platform/v8_inspector/V8InspectorImpl.h" |
| 42 #include "platform/v8_inspector/V8InspectorSessionImpl.h" | 43 #include "platform/v8_inspector/V8InspectorSessionImpl.h" |
| 43 #include "platform/v8_inspector/V8StackTraceImpl.h" | 44 #include "platform/v8_inspector/V8StackTraceImpl.h" |
| 44 #include "platform/v8_inspector/V8StringUtil.h" | 45 #include "platform/v8_inspector/V8StringUtil.h" |
| 45 #include "platform/v8_inspector/public/V8InspectorClient.h" | 46 #include "platform/v8_inspector/public/V8InspectorClient.h" |
| 46 | 47 |
| 47 namespace blink { | 48 namespace blink { |
| (...skipping 26 matching lines...) Expand all Loading... |
| 74 } | 75 } |
| 75 if (!value.ToLocalChecked()->IsPromise()) { | 76 if (!value.ToLocalChecked()->IsPromise()) { |
| 76 callback->sendFailure(notPromiseError); | 77 callback->sendFailure(notPromiseError); |
| 77 return; | 78 return; |
| 78 } | 79 } |
| 79 v8::Local<v8::Promise> promise = v8::Local<v8::Promise>::Cast(value.ToLo
calChecked()); | 80 v8::Local<v8::Promise> promise = v8::Local<v8::Promise>::Cast(value.ToLo
calChecked()); |
| 80 Callback* rawCallback = callback.get(); | 81 Callback* rawCallback = callback.get(); |
| 81 ProtocolPromiseHandler<Callback>* handler = new ProtocolPromiseHandler(i
nspector, contextGroupId, executionContextId, objectGroup, returnByValue, genera
tePreview, std::move(callback)); | 82 ProtocolPromiseHandler<Callback>* handler = new ProtocolPromiseHandler(i
nspector, contextGroupId, executionContextId, objectGroup, returnByValue, genera
tePreview, std::move(callback)); |
| 82 v8::Local<v8::Value> wrapper = handler->m_wrapper.Get(inspector->isolate
()); | 83 v8::Local<v8::Value> wrapper = handler->m_wrapper.Get(inspector->isolate
()); |
| 83 | 84 |
| 84 v8::Local<v8::Function> thenCallbackFunction = v8::Function::New(context
, thenCallback, wrapper, 0, v8::ConstructorBehavior::kThrow).ToLocalChecked(); | 85 v8::Local<v8::Function> thenCallbackFunction = V8_FUNCTION_NEW_REMOVE_PR
OTOTYPE(context, thenCallback, wrapper, 0).ToLocalChecked(); |
| 85 if (promise->Then(context, thenCallbackFunction).IsEmpty()) { | 86 if (promise->Then(context, thenCallbackFunction).IsEmpty()) { |
| 86 rawCallback->sendFailure("Internal error"); | 87 rawCallback->sendFailure("Internal error"); |
| 87 return; | 88 return; |
| 88 } | 89 } |
| 89 v8::Local<v8::Function> catchCallbackFunction = v8::Function::New(contex
t, catchCallback, wrapper, 0, v8::ConstructorBehavior::kThrow).ToLocalChecked(); | 90 v8::Local<v8::Function> catchCallbackFunction = V8_FUNCTION_NEW_REMOVE_P
ROTOTYPE(context, catchCallback, wrapper, 0).ToLocalChecked(); |
| 90 if (promise->Catch(context, catchCallbackFunction).IsEmpty()) { | 91 if (promise->Catch(context, catchCallbackFunction).IsEmpty()) { |
| 91 rawCallback->sendFailure("Internal error"); | 92 rawCallback->sendFailure("Internal error"); |
| 92 return; | 93 return; |
| 93 } | 94 } |
| 94 } | 95 } |
| 95 private: | 96 private: |
| 96 static void thenCallback(const v8::FunctionCallbackInfo<v8::Value>& info) | 97 static void thenCallback(const v8::FunctionCallbackInfo<v8::Value>& info) |
| 97 { | 98 { |
| 98 ProtocolPromiseHandler<Callback>* handler = static_cast<ProtocolPromiseH
andler<Callback>*>(info.Data().As<v8::External>()->Value()); | 99 ProtocolPromiseHandler<Callback>* handler = static_cast<ProtocolPromiseH
andler<Callback>*>(info.Data().As<v8::External>()->Value()); |
| 99 DCHECK(handler); | 100 DCHECK(handler); |
| (...skipping 582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 682 reportMessage(message, true); | 683 reportMessage(message, true); |
| 683 } | 684 } |
| 684 | 685 |
| 685 void V8RuntimeAgentImpl::reportMessage(V8ConsoleMessage* message, bool generateP
review) | 686 void V8RuntimeAgentImpl::reportMessage(V8ConsoleMessage* message, bool generateP
review) |
| 686 { | 687 { |
| 687 message->reportToFrontend(&m_frontend, m_session, generatePreview); | 688 message->reportToFrontend(&m_frontend, m_session, generatePreview); |
| 688 m_frontend.flush(); | 689 m_frontend.flush(); |
| 689 } | 690 } |
| 690 | 691 |
| 691 } // namespace blink | 692 } // namespace blink |
| OLD | NEW |