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

Side by Side Diff: third_party/WebKit/Source/platform/v8_inspector/InjectedScript.cpp

Issue 2251343003: [DevTools] Generate separate copies of inspector_protocol. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: improvements Created 4 years, 3 months 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
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 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
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 "platform/v8_inspector/InjectedScript.h" 31 #include "platform/v8_inspector/InjectedScript.h"
32 32
33 #include "platform/v8_inspector/InjectedScriptNative.h" 33 #include "platform/v8_inspector/InjectedScriptNative.h"
34 #include "platform/v8_inspector/InjectedScriptSource.h" 34 #include "platform/v8_inspector/InjectedScriptSource.h"
35 #include "platform/v8_inspector/InspectedContext.h" 35 #include "platform/v8_inspector/InspectedContext.h"
36 #include "platform/v8_inspector/RemoteObjectId.h" 36 #include "platform/v8_inspector/RemoteObjectId.h"
37 #include "platform/v8_inspector/StringUtil.h"
37 #include "platform/v8_inspector/V8Compat.h" 38 #include "platform/v8_inspector/V8Compat.h"
38 #include "platform/v8_inspector/V8Console.h" 39 #include "platform/v8_inspector/V8Console.h"
39 #include "platform/v8_inspector/V8FunctionCall.h" 40 #include "platform/v8_inspector/V8FunctionCall.h"
40 #include "platform/v8_inspector/V8InjectedScriptHost.h" 41 #include "platform/v8_inspector/V8InjectedScriptHost.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/protocol/Protocol.h"
45 #include "platform/v8_inspector/public/V8InspectorClient.h" 46 #include "platform/v8_inspector/public/V8InspectorClient.h"
46 47
47 using blink::protocol::Array; 48 namespace v8_inspector {
48 using blink::protocol::Debugger::CallFrame;
49 using blink::protocol::Runtime::PropertyDescriptor;
50 using blink::protocol::Runtime::InternalPropertyDescriptor;
51 using blink::protocol::Runtime::RemoteObject;
52 using blink::protocol::Maybe;
53 49
54 namespace v8_inspector { 50 using protocol::Array;
51 using protocol::Runtime::PropertyDescriptor;
52 using protocol::Runtime::InternalPropertyDescriptor;
53 using protocol::Runtime::RemoteObject;
54 using protocol::Maybe;
55 55
56 static bool hasInternalError(ErrorString* errorString, bool hasError) 56 static bool hasInternalError(ErrorString* errorString, bool hasError)
57 { 57 {
58 if (hasError) 58 if (hasError)
59 *errorString = "Internal error"; 59 *errorString = "Internal error";
60 return hasError; 60 return hasError;
61 } 61 }
62 62
63 std::unique_ptr<InjectedScript> InjectedScript::create(InspectedContext* inspect edContext) 63 std::unique_ptr<InjectedScript> InjectedScript::create(InspectedContext* inspect edContext)
64 { 64 {
(...skipping 14 matching lines...) Expand all
79 String16 injectedScriptSource(reinterpret_cast<const char*>(InjectedScriptSo urce_js), sizeof(InjectedScriptSource_js)); 79 String16 injectedScriptSource(reinterpret_cast<const char*>(InjectedScriptSo urce_js), sizeof(InjectedScriptSource_js));
80 v8::Local<v8::Value> value; 80 v8::Local<v8::Value> value;
81 if (!inspectedContext->inspector()->compileAndRunInternalScript(context, toV 8String(isolate, injectedScriptSource)).ToLocal(&value)) 81 if (!inspectedContext->inspector()->compileAndRunInternalScript(context, toV 8String(isolate, injectedScriptSource)).ToLocal(&value))
82 return nullptr; 82 return nullptr;
83 DCHECK(value->IsFunction()); 83 DCHECK(value->IsFunction());
84 v8::Local<v8::Function> function = v8::Local<v8::Function>::Cast(value); 84 v8::Local<v8::Function> function = v8::Local<v8::Function>::Cast(value);
85 v8::Local<v8::Object> windowGlobal = context->Global(); 85 v8::Local<v8::Object> windowGlobal = context->Global();
86 v8::Local<v8::Value> info[] = { scriptHostWrapper, windowGlobal, v8::Number: :New(isolate, inspectedContext->contextId()) }; 86 v8::Local<v8::Value> info[] = { scriptHostWrapper, windowGlobal, v8::Number: :New(isolate, inspectedContext->contextId()) };
87 v8::MicrotasksScope microtasksScope(isolate, v8::MicrotasksScope::kDoNotRunM icrotasks); 87 v8::MicrotasksScope microtasksScope(isolate, v8::MicrotasksScope::kDoNotRunM icrotasks);
88 v8::Local<v8::Value> injectedScriptValue; 88 v8::Local<v8::Value> injectedScriptValue;
89 if (!function->Call(context, windowGlobal, PROTOCOL_ARRAY_LENGTH(info), info ).ToLocal(&injectedScriptValue)) 89 if (!function->Call(context, windowGlobal, V8_INSPECTOR_ARRAY_LENGTH(info), info).ToLocal(&injectedScriptValue))
90 return nullptr; 90 return nullptr;
91 if (!injectedScriptValue->IsObject()) 91 if (!injectedScriptValue->IsObject())
92 return nullptr; 92 return nullptr;
93 return wrapUnique(new InjectedScript(inspectedContext, injectedScriptValue.A s<v8::Object>(), std::move(injectedScriptNative))); 93 return wrapUnique(new InjectedScript(inspectedContext, injectedScriptValue.A s<v8::Object>(), std::move(injectedScriptNative)));
94 } 94 }
95 95
96 InjectedScript::InjectedScript(InspectedContext* context, v8::Local<v8::Object> object, std::unique_ptr<InjectedScriptNative> injectedScriptNative) 96 InjectedScript::InjectedScript(InspectedContext* context, v8::Local<v8::Object> object, std::unique_ptr<InjectedScriptNative> injectedScriptNative)
97 : m_context(context) 97 : m_context(context)
98 , m_value(context->isolate(), object) 98 , m_value(context->isolate(), object)
99 , m_native(std::move(injectedScriptNative)) 99 , m_native(std::move(injectedScriptNative))
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after
494 void InjectedScript::CallFrameScope::findInjectedScript(V8InspectorSessionImpl* session) 494 void InjectedScript::CallFrameScope::findInjectedScript(V8InspectorSessionImpl* session)
495 { 495 {
496 std::unique_ptr<RemoteCallFrameId> remoteId = RemoteCallFrameId::parse(m_err orString, m_remoteCallFrameId); 496 std::unique_ptr<RemoteCallFrameId> remoteId = RemoteCallFrameId::parse(m_err orString, m_remoteCallFrameId);
497 if (!remoteId) 497 if (!remoteId)
498 return; 498 return;
499 m_frameOrdinal = static_cast<size_t>(remoteId->frameOrdinal()); 499 m_frameOrdinal = static_cast<size_t>(remoteId->frameOrdinal());
500 m_injectedScript = session->findInjectedScript(m_errorString, remoteId.get() ); 500 m_injectedScript = session->findInjectedScript(m_errorString, remoteId.get() );
501 } 501 }
502 502
503 } // namespace v8_inspector 503 } // namespace v8_inspector
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698