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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007-2011 Google Inc. All rights reserved. 2 * Copyright (C) 2007-2011 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 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 v8::Handle<v8::Value> functionValue = args[0]; 317 v8::Handle<v8::Value> functionValue = args[0];
318 int scopeIndex = args[1]->Int32Value(); 318 int scopeIndex = args[1]->Int32Value();
319 String variableName = toWebCoreStringWithUndefinedOrNullCheck(args[2]); 319 String variableName = toWebCoreStringWithUndefinedOrNullCheck(args[2]);
320 v8::Handle<v8::Value> newValue = args[3]; 320 v8::Handle<v8::Value> newValue = args[3];
321 321
322 InjectedScriptHost* host = V8InjectedScriptHost::toNative(args.Holder()); 322 InjectedScriptHost* host = V8InjectedScriptHost::toNative(args.Holder());
323 ScriptDebugServer& debugServer = host->scriptDebugServer(); 323 ScriptDebugServer& debugServer = host->scriptDebugServer();
324 return debugServer.setFunctionVariableValue(functionValue, scopeIndex, varia bleName, newValue); 324 return debugServer.setFunctionVariableValue(functionValue, scopeIndex, varia bleName, newValue);
325 } 325 }
326 326
327 static bool getFunctionLocation(const v8::Arguments& args, String* scriptId, int * lineNumber, int* columnNumber)
328 {
329 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.
330 if (!fn->IsFunction())
331 return false;
332 v8::HandleScope handleScope;
333 v8::Handle<v8::Function> function = v8::Handle<v8::Function>::Cast(fn);
334 *lineNumber = function->GetScriptLineNumber();
335 *columnNumber = function->GetScriptColumnNumber();
336 if (*lineNumber == v8::Function::kLineOffsetNotFound || *columnNumber == v8: :Function::kLineOffsetNotFound)
337 return false;
338 *scriptId = v8StringToWebCoreString<String>(function->GetScriptId()->ToStrin g(), Externalize);
vsevik 2013/05/06 11:52:13 *scriptId = toWebCoreStringWithUndefinedOrNullChec
SeRya 2013/05/30 09:56:27 Done.
339 return true;
340 }
341
342 v8::Handle<v8::Value> V8InjectedScriptHost::setBreakpointMethodCustom(const v8:: Arguments& args)
343 {
344 String scriptId;
345 int lineNumber, columnNumber;
346 if (!getFunctionLocation(args, &scriptId, &lineNumber, &columnNumber))
347 return v8::Undefined();
348
349 InjectedScriptHost* host = V8InjectedScriptHost::toNative(args.Holder());
350 host->setBreakpoint(scriptId, lineNumber, columnNumber);
351 return v8::Undefined();
352 }
353
354 v8::Handle<v8::Value> V8InjectedScriptHost::removeBreakpointMethodCustom(const v 8::Arguments& args)
355 {
356 String scriptId;
357 int lineNumber, columnNumber;
358 if (!getFunctionLocation(args, &scriptId, &lineNumber, &columnNumber))
359 return v8::Undefined();
360
361 InjectedScriptHost* host = V8InjectedScriptHost::toNative(args.Holder());
362 host->removeBreakpoint(scriptId, lineNumber, columnNumber);
363 return v8::Undefined();
364 }
365
327 366
328 } // namespace WebCore 367 } // namespace WebCore
329 368
OLDNEW
« 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