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

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

Issue 1806643002: Revert of Remove V8RecrusionScope, cleanup call sites. (patchset #8 id:140001 of https://codereview… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Reverts 1805543002 Created 4 years, 9 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 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "platform/v8_inspector/V8InjectedScriptHost.h" 5 #include "platform/v8_inspector/V8InjectedScriptHost.h"
6 6
7 #include "platform/inspector_protocol/String16.h" 7 #include "platform/inspector_protocol/String16.h"
8 #include "platform/inspector_protocol/Values.h" 8 #include "platform/inspector_protocol/Values.h"
9 #include "platform/v8_inspector/InjectedScript.h" 9 #include "platform/v8_inspector/InjectedScript.h"
10 #include "platform/v8_inspector/InjectedScriptHost.h" 10 #include "platform/v8_inspector/InjectedScriptHost.h"
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 isolate->ThrowException(v8::Exception::Error(v8::String::NewFromUtf8(iso late, "The argument must be a string."))); 273 isolate->ThrowException(v8::Exception::Error(v8::String::NewFromUtf8(iso late, "The argument must be a string.")));
274 return; 274 return;
275 } 275 }
276 276
277 ASSERT(isolate->InContext()); 277 ASSERT(isolate->InContext());
278 v8::TryCatch tryCatch(isolate); 278 v8::TryCatch tryCatch(isolate);
279 v8::Local<v8::Value> result; 279 v8::Local<v8::Value> result;
280 InjectedScriptHost* host = V8InjectedScriptHost::unwrap(isolate->GetCurrentC ontext(), info.Holder()); 280 InjectedScriptHost* host = V8InjectedScriptHost::unwrap(isolate->GetCurrentC ontext(), info.Holder());
281 if (!host->debugger()) 281 if (!host->debugger())
282 return; 282 return;
283 if (!host->debugger()->compileAndRunInternalScript(isolate->GetCurrentContex t(), expression).ToLocal(&result)) { 283 if (!host->debugger()->client()->compileAndRunInternalScript(expression).ToL ocal(&result)) {
284 v8SetReturnValue(info, tryCatch.ReThrow()); 284 v8SetReturnValue(info, tryCatch.ReThrow());
285 return; 285 return;
286 } 286 }
287 v8SetReturnValue(info, result); 287 v8SetReturnValue(info, result);
288 } 288 }
289 289
290 static void setExceptionAsReturnValue(const v8::FunctionCallbackInfo<v8::Value>& info, v8::Local<v8::Object> returnValue, v8::TryCatch& tryCatch) 290 static void setExceptionAsReturnValue(const v8::FunctionCallbackInfo<v8::Value>& info, v8::Local<v8::Object> returnValue, v8::TryCatch& tryCatch)
291 { 291 {
292 v8::Isolate* isolate = info.GetIsolate(); 292 v8::Isolate* isolate = info.GetIsolate();
293 returnValue->Set(v8::String::NewFromUtf8(isolate, "result"), tryCatch.Except ion()); 293 returnValue->Set(v8::String::NewFromUtf8(isolate, "result"), tryCatch.Except ion());
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 return; 326 return;
327 } 327 }
328 328
329 v8::Local<v8::Symbol> commandLineAPISymbolValue = V8Debugger::commandLineAPI Symbol(isolate); 329 v8::Local<v8::Symbol> commandLineAPISymbolValue = V8Debugger::commandLineAPI Symbol(isolate);
330 v8::Local<v8::Object> global = context->Global(); 330 v8::Local<v8::Object> global = context->Global();
331 if (info.Length() >= 2 && info[1]->IsObject()) { 331 if (info.Length() >= 2 && info[1]->IsObject()) {
332 v8::Local<v8::Object> commandLineAPI = info[1]->ToObject(isolate); 332 v8::Local<v8::Object> commandLineAPI = info[1]->ToObject(isolate);
333 global->Set(commandLineAPISymbolValue, commandLineAPI); 333 global->Set(commandLineAPISymbolValue, commandLineAPI);
334 } 334 }
335 335
336 v8::MaybeLocal<v8::Value> result = host->debugger()->runCompiledScript(conte xt, script); 336 v8::MaybeLocal<v8::Value> result = host->debugger()->client()->runCompiledSc ript(context, script);
337 if (result.IsEmpty()) { 337 if (result.IsEmpty()) {
338 global->Delete(context, commandLineAPISymbolValue); 338 global->Delete(context, commandLineAPISymbolValue);
339 setExceptionAsReturnValue(info, wrappedResult, tryCatch); 339 setExceptionAsReturnValue(info, wrappedResult, tryCatch);
340 return; 340 return;
341 } 341 }
342 342
343 global->Delete(context, commandLineAPISymbolValue); 343 global->Delete(context, commandLineAPISymbolValue);
344 wrappedResult->Set(v8::String::NewFromUtf8(isolate, "result"), result.ToLoca lChecked()); 344 wrappedResult->Set(v8::String::NewFromUtf8(isolate, "result"), result.ToLoca lChecked());
345 wrappedResult->Set(v8::String::NewFromUtf8(isolate, "exceptionDetails"), v8: :Undefined(isolate)); 345 wrappedResult->Set(v8::String::NewFromUtf8(isolate, "exceptionDetails"), v8: :Undefined(isolate));
346 v8SetReturnValue(info, wrappedResult); 346 v8SetReturnValue(info, wrappedResult);
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
589 } // namespace 589 } // namespace
590 590
591 v8::Local<v8::FunctionTemplate> V8InjectedScriptHost::createWrapperTemplate(v8:: Isolate* isolate) 591 v8::Local<v8::FunctionTemplate> V8InjectedScriptHost::createWrapperTemplate(v8:: Isolate* isolate)
592 { 592 {
593 protocol::Vector<InspectorWrapperBase::V8MethodConfiguration> methods(WTF_AR RAY_LENGTH(V8InjectedScriptHostMethods)); 593 protocol::Vector<InspectorWrapperBase::V8MethodConfiguration> methods(WTF_AR RAY_LENGTH(V8InjectedScriptHostMethods));
594 std::copy(V8InjectedScriptHostMethods, V8InjectedScriptHostMethods + WTF_ARR AY_LENGTH(V8InjectedScriptHostMethods), methods.begin()); 594 std::copy(V8InjectedScriptHostMethods, V8InjectedScriptHostMethods + WTF_ARR AY_LENGTH(V8InjectedScriptHostMethods), methods.begin());
595 protocol::Vector<InspectorWrapperBase::V8AttributeConfiguration> attributes; 595 protocol::Vector<InspectorWrapperBase::V8AttributeConfiguration> attributes;
596 return InjectedScriptHostWrapper::createWrapperTemplate(isolate, methods, at tributes); 596 return InjectedScriptHostWrapper::createWrapperTemplate(isolate, methods, at tributes);
597 } 597 }
598 598
599 v8::Local<v8::Object> V8InjectedScriptHost::wrap(v8::Local<v8::FunctionTemplate> constructorTemplate, v8::Local<v8::Context> context, InjectedScriptHost* host) 599 v8::Local<v8::Object> V8InjectedScriptHost::wrap(V8DebuggerClient* client, v8::L ocal<v8::FunctionTemplate> constructorTemplate, v8::Local<v8::Context> context, InjectedScriptHost* host)
600 { 600 {
601 return InjectedScriptHostWrapper::wrap(constructorTemplate, context, host); 601 return InjectedScriptHostWrapper::wrap(client, constructorTemplate, context, host);
602 } 602 }
603 603
604 InjectedScriptHost* V8InjectedScriptHost::unwrap(v8::Local<v8::Context> context, v8::Local<v8::Object> object) 604 InjectedScriptHost* V8InjectedScriptHost::unwrap(v8::Local<v8::Context> context, v8::Local<v8::Object> object)
605 { 605 {
606 return InjectedScriptHostWrapper::unwrap(context, object); 606 return InjectedScriptHostWrapper::unwrap(context, object);
607 } 607 }
608 608
609 } // namespace blink 609 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698