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

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

Issue 1786243002: [DevTools] Move restartFrame and setCallFrameVariableValue to V8DebuggerAgent (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@dgozman-patch
Patch Set: 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 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
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);
347 } 347 }
348 348
349 void V8InjectedScriptHost::setFunctionVariableValueCallback(const v8::FunctionCa llbackInfo<v8::Value>& info)
350 {
351 if (info.Length() < 4 || !info[0]->IsFunction() || !info[1]->IsInt32() || !i nfo[2]->IsString())
352 return;
353
354 v8::Local<v8::Value> functionValue = info[0];
355 int scopeIndex = info[1].As<v8::Int32>()->Value();
356 String16 variableName = toProtocolStringWithTypeCheck(info[2]);
357 v8::Local<v8::Value> newValue = info[3];
358
359 InjectedScriptHost* host = V8InjectedScriptHost::unwrap(info.GetIsolate()->G etCurrentContext(), info.Holder());
360 if (!host->debugger())
361 return;
362 v8SetReturnValue(info, host->debugger()->setFunctionVariableValue(functionVa lue, scopeIndex, variableName, newValue));
363 }
364
365 static bool getFunctionLocation(const v8::FunctionCallbackInfo<v8::Value>& info, String16* scriptId, int* lineNumber, int* columnNumber) 349 static bool getFunctionLocation(const v8::FunctionCallbackInfo<v8::Value>& info, String16* scriptId, int* lineNumber, int* columnNumber)
366 { 350 {
367 if (info.Length() < 1 || !info[0]->IsFunction()) 351 if (info.Length() < 1 || !info[0]->IsFunction())
368 return false; 352 return false;
369 v8::Local<v8::Function> function = v8::Local<v8::Function>::Cast(info[0]); 353 v8::Local<v8::Function> function = v8::Local<v8::Function>::Cast(info[0]);
370 *lineNumber = function->GetScriptLineNumber(); 354 *lineNumber = function->GetScriptLineNumber();
371 *columnNumber = function->GetScriptColumnNumber(); 355 *columnNumber = function->GetScriptColumnNumber();
372 if (*lineNumber == v8::Function::kLineOffsetNotFound || *columnNumber == v8: :Function::kLineOffsetNotFound) 356 if (*lineNumber == v8::Function::kLineOffsetNotFound || *columnNumber == v8: :Function::kLineOffsetNotFound)
373 return false; 357 return false;
374 *scriptId = String16::number(function->ScriptId()); 358 *scriptId = String16::number(function->ScriptId());
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
573 {"getEventListeners", V8InjectedScriptHost::getEventListenersCallback}, 557 {"getEventListeners", V8InjectedScriptHost::getEventListenersCallback},
574 {"eval", V8InjectedScriptHost::evalCallback}, 558 {"eval", V8InjectedScriptHost::evalCallback},
575 {"evaluateWithExceptionDetails", V8InjectedScriptHost::evaluateWithException DetailsCallback}, 559 {"evaluateWithExceptionDetails", V8InjectedScriptHost::evaluateWithException DetailsCallback},
576 {"debugFunction", V8InjectedScriptHost::debugFunctionCallback}, 560 {"debugFunction", V8InjectedScriptHost::debugFunctionCallback},
577 {"undebugFunction", V8InjectedScriptHost::undebugFunctionCallback}, 561 {"undebugFunction", V8InjectedScriptHost::undebugFunctionCallback},
578 {"monitorFunction", V8InjectedScriptHost::monitorFunctionCallback}, 562 {"monitorFunction", V8InjectedScriptHost::monitorFunctionCallback},
579 {"unmonitorFunction", V8InjectedScriptHost::unmonitorFunctionCallback}, 563 {"unmonitorFunction", V8InjectedScriptHost::unmonitorFunctionCallback},
580 {"callFunction", V8InjectedScriptHost::callFunctionCallback}, 564 {"callFunction", V8InjectedScriptHost::callFunctionCallback},
581 {"suppressWarningsAndCallFunction", V8InjectedScriptHost::suppressWarningsAn dCallFunctionCallback}, 565 {"suppressWarningsAndCallFunction", V8InjectedScriptHost::suppressWarningsAn dCallFunctionCallback},
582 {"setNonEnumProperty", V8InjectedScriptHost::setNonEnumPropertyCallback}, 566 {"setNonEnumProperty", V8InjectedScriptHost::setNonEnumPropertyCallback},
583 {"setFunctionVariableValue", V8InjectedScriptHost::setFunctionVariableValueC allback},
584 {"bind", V8InjectedScriptHost::bindCallback}, 567 {"bind", V8InjectedScriptHost::bindCallback},
585 {"objectForId", V8InjectedScriptHost::objectForIdCallback}, 568 {"objectForId", V8InjectedScriptHost::objectForIdCallback},
586 {"idToObjectGroupName", V8InjectedScriptHost::idToObjectGroupNameCallback}, 569 {"idToObjectGroupName", V8InjectedScriptHost::idToObjectGroupNameCallback},
587 }; 570 };
588 571
589 } // namespace 572 } // namespace
590 573
591 v8::Local<v8::FunctionTemplate> V8InjectedScriptHost::createWrapperTemplate(v8:: Isolate* isolate) 574 v8::Local<v8::FunctionTemplate> V8InjectedScriptHost::createWrapperTemplate(v8:: Isolate* isolate)
592 { 575 {
593 protocol::Vector<InspectorWrapperBase::V8MethodConfiguration> methods(WTF_AR RAY_LENGTH(V8InjectedScriptHostMethods)); 576 protocol::Vector<InspectorWrapperBase::V8MethodConfiguration> methods(WTF_AR RAY_LENGTH(V8InjectedScriptHostMethods));
594 std::copy(V8InjectedScriptHostMethods, V8InjectedScriptHostMethods + WTF_ARR AY_LENGTH(V8InjectedScriptHostMethods), methods.begin()); 577 std::copy(V8InjectedScriptHostMethods, V8InjectedScriptHostMethods + WTF_ARR AY_LENGTH(V8InjectedScriptHostMethods), methods.begin());
595 protocol::Vector<InspectorWrapperBase::V8AttributeConfiguration> attributes; 578 protocol::Vector<InspectorWrapperBase::V8AttributeConfiguration> attributes;
596 return InjectedScriptHostWrapper::createWrapperTemplate(isolate, methods, at tributes); 579 return InjectedScriptHostWrapper::createWrapperTemplate(isolate, methods, at tributes);
597 } 580 }
598 581
599 v8::Local<v8::Object> V8InjectedScriptHost::wrap(V8DebuggerClient* client, v8::L ocal<v8::FunctionTemplate> constructorTemplate, v8::Local<v8::Context> context, InjectedScriptHost* host) 582 v8::Local<v8::Object> V8InjectedScriptHost::wrap(V8DebuggerClient* client, v8::L ocal<v8::FunctionTemplate> constructorTemplate, v8::Local<v8::Context> context, InjectedScriptHost* host)
600 { 583 {
601 return InjectedScriptHostWrapper::wrap(client, constructorTemplate, context, host); 584 return InjectedScriptHostWrapper::wrap(client, constructorTemplate, context, host);
602 } 585 }
603 586
604 InjectedScriptHost* V8InjectedScriptHost::unwrap(v8::Local<v8::Context> context, v8::Local<v8::Object> object) 587 InjectedScriptHost* V8InjectedScriptHost::unwrap(v8::Local<v8::Context> context, v8::Local<v8::Object> object)
605 { 588 {
606 return InjectedScriptHostWrapper::unwrap(context, object); 589 return InjectedScriptHostWrapper::unwrap(context, object);
607 } 590 }
608 591
609 } // namespace blink 592 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698