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

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: win compile 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/V8ValueCopier.h" 45 #include "platform/v8_inspector/V8ValueCopier.h"
46 #include "platform/v8_inspector/protocol/Protocol.h"
46 #include "platform/v8_inspector/public/V8InspectorClient.h" 47 #include "platform/v8_inspector/public/V8InspectorClient.h"
47 48
48 using blink::protocol::Array; 49 namespace v8_inspector {
49 using blink::protocol::Debugger::CallFrame;
50 using blink::protocol::Runtime::PropertyDescriptor;
51 using blink::protocol::Runtime::InternalPropertyDescriptor;
52 using blink::protocol::Runtime::RemoteObject;
53 using blink::protocol::Maybe;
54 50
55 namespace v8_inspector { 51 using protocol::Array;
52 using protocol::Runtime::PropertyDescriptor;
53 using protocol::Runtime::InternalPropertyDescriptor;
54 using protocol::Runtime::RemoteObject;
55 using protocol::Maybe;
56 56
57 static bool hasInternalError(ErrorString* errorString, bool hasError) 57 static bool hasInternalError(ErrorString* errorString, bool hasError)
58 { 58 {
59 if (hasError) 59 if (hasError)
60 *errorString = "Internal error"; 60 *errorString = "Internal error";
61 return hasError; 61 return hasError;
62 } 62 }
63 63
64 std::unique_ptr<InjectedScript> InjectedScript::create(InspectedContext* inspect edContext) 64 std::unique_ptr<InjectedScript> InjectedScript::create(InspectedContext* inspect edContext)
65 { 65 {
(...skipping 14 matching lines...) Expand all
80 String16 injectedScriptSource(reinterpret_cast<const char*>(InjectedScriptSo urce_js), sizeof(InjectedScriptSource_js)); 80 String16 injectedScriptSource(reinterpret_cast<const char*>(InjectedScriptSo urce_js), sizeof(InjectedScriptSource_js));
81 v8::Local<v8::Value> value; 81 v8::Local<v8::Value> value;
82 if (!inspectedContext->inspector()->compileAndRunInternalScript(context, toV 8String(isolate, injectedScriptSource)).ToLocal(&value)) 82 if (!inspectedContext->inspector()->compileAndRunInternalScript(context, toV 8String(isolate, injectedScriptSource)).ToLocal(&value))
83 return nullptr; 83 return nullptr;
84 DCHECK(value->IsFunction()); 84 DCHECK(value->IsFunction());
85 v8::Local<v8::Function> function = v8::Local<v8::Function>::Cast(value); 85 v8::Local<v8::Function> function = v8::Local<v8::Function>::Cast(value);
86 v8::Local<v8::Object> windowGlobal = context->Global(); 86 v8::Local<v8::Object> windowGlobal = context->Global();
87 v8::Local<v8::Value> info[] = { scriptHostWrapper, windowGlobal, v8::Number: :New(isolate, inspectedContext->contextId()) }; 87 v8::Local<v8::Value> info[] = { scriptHostWrapper, windowGlobal, v8::Number: :New(isolate, inspectedContext->contextId()) };
88 v8::MicrotasksScope microtasksScope(isolate, v8::MicrotasksScope::kDoNotRunM icrotasks); 88 v8::MicrotasksScope microtasksScope(isolate, v8::MicrotasksScope::kDoNotRunM icrotasks);
89 v8::Local<v8::Value> injectedScriptValue; 89 v8::Local<v8::Value> injectedScriptValue;
90 if (!function->Call(context, windowGlobal, PROTOCOL_ARRAY_LENGTH(info), info ).ToLocal(&injectedScriptValue)) 90 if (!function->Call(context, windowGlobal, V8_INSPECTOR_ARRAY_LENGTH(info), info).ToLocal(&injectedScriptValue))
91 return nullptr; 91 return nullptr;
92 if (!injectedScriptValue->IsObject()) 92 if (!injectedScriptValue->IsObject())
93 return nullptr; 93 return nullptr;
94 return wrapUnique(new InjectedScript(inspectedContext, injectedScriptValue.A s<v8::Object>(), std::move(injectedScriptNative))); 94 return wrapUnique(new InjectedScript(inspectedContext, injectedScriptValue.A s<v8::Object>(), std::move(injectedScriptNative)));
95 } 95 }
96 96
97 InjectedScript::InjectedScript(InspectedContext* context, v8::Local<v8::Object> object, std::unique_ptr<InjectedScriptNative> injectedScriptNative) 97 InjectedScript::InjectedScript(InspectedContext* context, v8::Local<v8::Object> object, std::unique_ptr<InjectedScriptNative> injectedScriptNative)
98 : m_context(context) 98 : m_context(context)
99 , m_value(context->isolate(), object) 99 , m_value(context->isolate(), object)
100 , m_native(std::move(injectedScriptNative)) 100 , m_native(std::move(injectedScriptNative))
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after
495 void InjectedScript::CallFrameScope::findInjectedScript(V8InspectorSessionImpl* session) 495 void InjectedScript::CallFrameScope::findInjectedScript(V8InspectorSessionImpl* session)
496 { 496 {
497 std::unique_ptr<RemoteCallFrameId> remoteId = RemoteCallFrameId::parse(m_err orString, m_remoteCallFrameId); 497 std::unique_ptr<RemoteCallFrameId> remoteId = RemoteCallFrameId::parse(m_err orString, m_remoteCallFrameId);
498 if (!remoteId) 498 if (!remoteId)
499 return; 499 return;
500 m_frameOrdinal = static_cast<size_t>(remoteId->frameOrdinal()); 500 m_frameOrdinal = static_cast<size_t>(remoteId->frameOrdinal());
501 m_injectedScript = session->findInjectedScript(m_errorString, remoteId.get() ); 501 m_injectedScript = session->findInjectedScript(m_errorString, remoteId.get() );
502 } 502 }
503 503
504 } // namespace v8_inspector 504 } // namespace v8_inspector
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698