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

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

Issue 2044343002: DevTools: update V8Inspector to work with the new v8_inspector API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review comment addressed Created 4 years, 6 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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 String16 injectedScriptSource(reinterpret_cast<const char*>(InjectedScriptSo urce_js), sizeof(InjectedScriptSource_js)); 87 String16 injectedScriptSource(reinterpret_cast<const char*>(InjectedScriptSo urce_js), sizeof(InjectedScriptSource_js));
88 v8::Local<v8::Value> value; 88 v8::Local<v8::Value> value;
89 if (!inspectedContext->debugger()->compileAndRunInternalScript(context, toV8 String(isolate, injectedScriptSource)).ToLocal(&value)) 89 if (!inspectedContext->debugger()->compileAndRunInternalScript(context, toV8 String(isolate, injectedScriptSource)).ToLocal(&value))
90 return nullptr; 90 return nullptr;
91 DCHECK(value->IsFunction()); 91 DCHECK(value->IsFunction());
92 v8::Local<v8::Function> function = v8::Local<v8::Function>::Cast(value); 92 v8::Local<v8::Function> function = v8::Local<v8::Function>::Cast(value);
93 v8::Local<v8::Object> windowGlobal = context->Global(); 93 v8::Local<v8::Object> windowGlobal = context->Global();
94 v8::Local<v8::Value> info[] = { scriptHostWrapper, windowGlobal, v8::Number: :New(isolate, inspectedContext->contextId()) }; 94 v8::Local<v8::Value> info[] = { scriptHostWrapper, windowGlobal, v8::Number: :New(isolate, inspectedContext->contextId()) };
95 v8::MicrotasksScope microtasksScope(isolate, v8::MicrotasksScope::kDoNotRunM icrotasks); 95 v8::MicrotasksScope microtasksScope(isolate, v8::MicrotasksScope::kDoNotRunM icrotasks);
96 v8::Local<v8::Value> injectedScriptValue; 96 v8::Local<v8::Value> injectedScriptValue;
97 if (!function->Call(context, windowGlobal, WTF_ARRAY_LENGTH(info), info).ToL ocal(&injectedScriptValue)) 97 if (!function->Call(context, windowGlobal, PROTOCOL_ARRAY_LENGTH(info), info ).ToLocal(&injectedScriptValue))
98 return nullptr; 98 return nullptr;
99 if (!injectedScriptValue->IsObject()) 99 if (!injectedScriptValue->IsObject())
100 return nullptr; 100 return nullptr;
101 return wrapUnique(new InjectedScript(inspectedContext, injectedScriptValue.A s<v8::Object>(), std::move(injectedScriptNative))); 101 return wrapUnique(new InjectedScript(inspectedContext, injectedScriptValue.A s<v8::Object>(), std::move(injectedScriptNative)));
102 } 102 }
103 103
104 InjectedScript::InjectedScript(InspectedContext* context, v8::Local<v8::Object> object, std::unique_ptr<InjectedScriptNative> injectedScriptNative) 104 InjectedScript::InjectedScript(InspectedContext* context, v8::Local<v8::Object> object, std::unique_ptr<InjectedScriptNative> injectedScriptNative)
105 : m_context(context) 105 : m_context(context)
106 , m_value(context->isolate(), object) 106 , m_value(context->isolate(), object)
107 , m_native(std::move(injectedScriptNative)) 107 , m_native(std::move(injectedScriptNative))
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after
518 void InjectedScript::CallFrameScope::findInjectedScript(V8InspectorSessionImpl* session) 518 void InjectedScript::CallFrameScope::findInjectedScript(V8InspectorSessionImpl* session)
519 { 519 {
520 std::unique_ptr<RemoteCallFrameId> remoteId = RemoteCallFrameId::parse(m_err orString, m_remoteCallFrameId); 520 std::unique_ptr<RemoteCallFrameId> remoteId = RemoteCallFrameId::parse(m_err orString, m_remoteCallFrameId);
521 if (!remoteId) 521 if (!remoteId)
522 return; 522 return;
523 m_frameOrdinal = static_cast<size_t>(remoteId->frameOrdinal()); 523 m_frameOrdinal = static_cast<size_t>(remoteId->frameOrdinal());
524 m_injectedScript = session->findInjectedScript(m_errorString, remoteId.get() ); 524 m_injectedScript = session->findInjectedScript(m_errorString, remoteId.get() );
525 } 525 }
526 526
527 } // namespace blink 527 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698