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

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 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 setExceptionAsReturnValue(info, wrappedResult, tryCatch); 351 setExceptionAsReturnValue(info, wrappedResult, tryCatch);
352 return; 352 return;
353 } 353 }
354 354
355 global->Delete(context, commandLineAPISymbolValue); 355 global->Delete(context, commandLineAPISymbolValue);
356 wrappedResult->Set(v8::String::NewFromUtf8(isolate, "result"), result.ToLoca lChecked()); 356 wrappedResult->Set(v8::String::NewFromUtf8(isolate, "result"), result.ToLoca lChecked());
357 wrappedResult->Set(v8::String::NewFromUtf8(isolate, "exceptionDetails"), v8: :Undefined(isolate)); 357 wrappedResult->Set(v8::String::NewFromUtf8(isolate, "exceptionDetails"), v8: :Undefined(isolate));
358 v8SetReturnValue(info, wrappedResult); 358 v8SetReturnValue(info, wrappedResult);
359 } 359 }
360 360
361 void V8InjectedScriptHost::setFunctionVariableValueCallback(const v8::FunctionCa llbackInfo<v8::Value>& info)
362 {
363 if (info.Length() < 4 || !info[0]->IsFunction() || !info[1]->IsInt32() || !i nfo[2]->IsString())
364 return;
365
366 v8::Local<v8::Value> functionValue = info[0];
367 int scopeIndex = info[1].As<v8::Int32>()->Value();
368 String16 variableName = toProtocolStringWithTypeCheck(info[2]);
369 v8::Local<v8::Value> newValue = info[3];
370
371 InjectedScriptHost* host = V8InjectedScriptHost::unwrap(info.GetIsolate()->G etCurrentContext(), info.Holder());
372 if (!host->debugger())
373 return;
374 v8SetReturnValue(info, host->debugger()->setFunctionVariableValue(functionVa lue, scopeIndex, variableName, newValue));
375 }
376
377 static bool getFunctionLocation(const v8::FunctionCallbackInfo<v8::Value>& info, String16* scriptId, int* lineNumber, int* columnNumber) 361 static bool getFunctionLocation(const v8::FunctionCallbackInfo<v8::Value>& info, String16* scriptId, int* lineNumber, int* columnNumber)
378 { 362 {
379 if (info.Length() < 1 || !info[0]->IsFunction()) 363 if (info.Length() < 1 || !info[0]->IsFunction())
380 return false; 364 return false;
381 v8::Local<v8::Function> function = v8::Local<v8::Function>::Cast(info[0]); 365 v8::Local<v8::Function> function = v8::Local<v8::Function>::Cast(info[0]);
382 *lineNumber = function->GetScriptLineNumber(); 366 *lineNumber = function->GetScriptLineNumber();
383 *columnNumber = function->GetScriptColumnNumber(); 367 *columnNumber = function->GetScriptColumnNumber();
384 if (*lineNumber == v8::Function::kLineOffsetNotFound || *columnNumber == v8: :Function::kLineOffsetNotFound) 368 if (*lineNumber == v8::Function::kLineOffsetNotFound || *columnNumber == v8: :Function::kLineOffsetNotFound)
385 return false; 369 return false;
386 *scriptId = String16::number(function->ScriptId()); 370 *scriptId = String16::number(function->ScriptId());
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
575 {"getEventListeners", V8InjectedScriptHost::getEventListenersCallback}, 559 {"getEventListeners", V8InjectedScriptHost::getEventListenersCallback},
576 {"eval", V8InjectedScriptHost::evalCallback}, 560 {"eval", V8InjectedScriptHost::evalCallback},
577 {"evaluateWithExceptionDetails", V8InjectedScriptHost::evaluateWithException DetailsCallback}, 561 {"evaluateWithExceptionDetails", V8InjectedScriptHost::evaluateWithException DetailsCallback},
578 {"debugFunction", V8InjectedScriptHost::debugFunctionCallback}, 562 {"debugFunction", V8InjectedScriptHost::debugFunctionCallback},
579 {"undebugFunction", V8InjectedScriptHost::undebugFunctionCallback}, 563 {"undebugFunction", V8InjectedScriptHost::undebugFunctionCallback},
580 {"monitorFunction", V8InjectedScriptHost::monitorFunctionCallback}, 564 {"monitorFunction", V8InjectedScriptHost::monitorFunctionCallback},
581 {"unmonitorFunction", V8InjectedScriptHost::unmonitorFunctionCallback}, 565 {"unmonitorFunction", V8InjectedScriptHost::unmonitorFunctionCallback},
582 {"callFunction", V8InjectedScriptHost::callFunctionCallback}, 566 {"callFunction", V8InjectedScriptHost::callFunctionCallback},
583 {"suppressWarningsAndCallFunction", V8InjectedScriptHost::suppressWarningsAn dCallFunctionCallback}, 567 {"suppressWarningsAndCallFunction", V8InjectedScriptHost::suppressWarningsAn dCallFunctionCallback},
584 {"setNonEnumProperty", V8InjectedScriptHost::setNonEnumPropertyCallback}, 568 {"setNonEnumProperty", V8InjectedScriptHost::setNonEnumPropertyCallback},
585 {"setFunctionVariableValue", V8InjectedScriptHost::setFunctionVariableValueC allback},
586 {"bind", V8InjectedScriptHost::bindCallback}, 569 {"bind", V8InjectedScriptHost::bindCallback},
587 {"objectForId", V8InjectedScriptHost::objectForIdCallback}, 570 {"objectForId", V8InjectedScriptHost::objectForIdCallback},
588 {"idToObjectGroupName", V8InjectedScriptHost::idToObjectGroupNameCallback}, 571 {"idToObjectGroupName", V8InjectedScriptHost::idToObjectGroupNameCallback},
589 }; 572 };
590 573
591 } // namespace 574 } // namespace
592 575
593 v8::Local<v8::FunctionTemplate> V8InjectedScriptHost::createWrapperTemplate(v8:: Isolate* isolate) 576 v8::Local<v8::FunctionTemplate> V8InjectedScriptHost::createWrapperTemplate(v8:: Isolate* isolate)
594 { 577 {
595 protocol::Vector<InspectorWrapperBase::V8MethodConfiguration> methods(WTF_AR RAY_LENGTH(V8InjectedScriptHostMethods)); 578 protocol::Vector<InspectorWrapperBase::V8MethodConfiguration> methods(WTF_AR RAY_LENGTH(V8InjectedScriptHostMethods));
596 std::copy(V8InjectedScriptHostMethods, V8InjectedScriptHostMethods + WTF_ARR AY_LENGTH(V8InjectedScriptHostMethods), methods.begin()); 579 std::copy(V8InjectedScriptHostMethods, V8InjectedScriptHostMethods + WTF_ARR AY_LENGTH(V8InjectedScriptHostMethods), methods.begin());
597 protocol::Vector<InspectorWrapperBase::V8AttributeConfiguration> attributes; 580 protocol::Vector<InspectorWrapperBase::V8AttributeConfiguration> attributes;
598 return InjectedScriptHostWrapper::createWrapperTemplate(isolate, methods, at tributes); 581 return InjectedScriptHostWrapper::createWrapperTemplate(isolate, methods, at tributes);
599 } 582 }
600 583
601 v8::Local<v8::Object> V8InjectedScriptHost::wrap(v8::Local<v8::FunctionTemplate> constructorTemplate, v8::Local<v8::Context> context, InjectedScriptHost* host) 584 v8::Local<v8::Object> V8InjectedScriptHost::wrap(v8::Local<v8::FunctionTemplate> constructorTemplate, v8::Local<v8::Context> context, InjectedScriptHost* host)
602 { 585 {
603 return InjectedScriptHostWrapper::wrap(constructorTemplate, context, host); 586 return InjectedScriptHostWrapper::wrap(constructorTemplate, context, host);
604 } 587 }
605 588
606 InjectedScriptHost* V8InjectedScriptHost::unwrap(v8::Local<v8::Context> context, v8::Local<v8::Object> object) 589 InjectedScriptHost* V8InjectedScriptHost::unwrap(v8::Local<v8::Context> context, v8::Local<v8::Object> object)
607 { 590 {
608 return InjectedScriptHostWrapper::unwrap(context, object); 591 return InjectedScriptHostWrapper::unwrap(context, object);
609 } 592 }
610 593
611 } // namespace blink 594 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698