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

Unified Diff: Source/bindings/v8/custom/V8InjectedScriptHostCustom.cpp

Issue 14294004: Implementing console command 'debug'. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: Source/bindings/v8/custom/V8InjectedScriptHostCustom.cpp
diff --git a/Source/bindings/v8/custom/V8InjectedScriptHostCustom.cpp b/Source/bindings/v8/custom/V8InjectedScriptHostCustom.cpp
index fb7ce20fd550142279eed75d4f3377c4ed05d34c..d574ae41502ece6972cc235ef442c7dcb7673bf9 100644
--- a/Source/bindings/v8/custom/V8InjectedScriptHostCustom.cpp
+++ b/Source/bindings/v8/custom/V8InjectedScriptHostCustom.cpp
@@ -324,6 +324,45 @@ v8::Handle<v8::Value> V8InjectedScriptHost::setFunctionVariableValueMethodCustom
return debugServer.setFunctionVariableValue(functionValue, scopeIndex, variableName, newValue);
}
+static bool getFunctionLocation(const v8::Arguments& args, String* scriptId, int* lineNumber, int* columnNumber)
+{
+ v8::Handle<v8::Value> fn = args[0];
vsevik 2013/05/06 11:52:13 if (args.Length() < 1) return v8::Undefine
SeRya 2013/05/30 09:56:27 Done.
+ if (!fn->IsFunction())
+ return false;
+ v8::HandleScope handleScope;
+ v8::Handle<v8::Function> function = v8::Handle<v8::Function>::Cast(fn);
+ *lineNumber = function->GetScriptLineNumber();
+ *columnNumber = function->GetScriptColumnNumber();
+ if (*lineNumber == v8::Function::kLineOffsetNotFound || *columnNumber == v8::Function::kLineOffsetNotFound)
+ return false;
+ *scriptId = v8StringToWebCoreString<String>(function->GetScriptId()->ToString(), Externalize);
vsevik 2013/05/06 11:52:13 *scriptId = toWebCoreStringWithUndefinedOrNullChec
SeRya 2013/05/30 09:56:27 Done.
+ return true;
+}
+
+v8::Handle<v8::Value> V8InjectedScriptHost::setBreakpointMethodCustom(const v8::Arguments& args)
+{
+ String scriptId;
+ int lineNumber, columnNumber;
+ if (!getFunctionLocation(args, &scriptId, &lineNumber, &columnNumber))
+ return v8::Undefined();
+
+ InjectedScriptHost* host = V8InjectedScriptHost::toNative(args.Holder());
+ host->setBreakpoint(scriptId, lineNumber, columnNumber);
+ return v8::Undefined();
+}
+
+v8::Handle<v8::Value> V8InjectedScriptHost::removeBreakpointMethodCustom(const v8::Arguments& args)
+{
+ String scriptId;
+ int lineNumber, columnNumber;
+ if (!getFunctionLocation(args, &scriptId, &lineNumber, &columnNumber))
+ return v8::Undefined();
+
+ InjectedScriptHost* host = V8InjectedScriptHost::toNative(args.Holder());
+ host->removeBreakpoint(scriptId, lineNumber, columnNumber);
+ return v8::Undefined();
+}
+
} // namespace WebCore
« no previous file with comments | « LayoutTests/inspector/debugger/debug-console-command-expected.txt ('k') | Source/core/inspector/InjectedScriptExterns.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698