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

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, 6 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 345 matching lines...) Expand 10 before | Expand all | Expand 10 after
356 v8::Handle<v8::Value> functionValue = args[0]; 356 v8::Handle<v8::Value> functionValue = args[0];
357 int scopeIndex = args[1]->Int32Value(); 357 int scopeIndex = args[1]->Int32Value();
358 String variableName = toWebCoreStringWithUndefinedOrNullCheck(args[2]); 358 String variableName = toWebCoreStringWithUndefinedOrNullCheck(args[2]);
359 v8::Handle<v8::Value> newValue = args[3]; 359 v8::Handle<v8::Value> newValue = args[3];
360 360
361 InjectedScriptHost* host = V8InjectedScriptHost::toNative(args.Holder()); 361 InjectedScriptHost* host = V8InjectedScriptHost::toNative(args.Holder());
362 ScriptDebugServer& debugServer = host->scriptDebugServer(); 362 ScriptDebugServer& debugServer = host->scriptDebugServer();
363 v8SetReturnValue(args, debugServer.setFunctionVariableValue(functionValue, s copeIndex, variableName, newValue)); 363 v8SetReturnValue(args, debugServer.setFunctionVariableValue(functionValue, s copeIndex, variableName, newValue));
364 } 364 }
365 365
366 static bool getFunctionLocation(const v8::FunctionCallbackInfo<v8::Value>& args, String* scriptId, int* lineNumber, int* columnNumber)
367 {
368 if (args.Length() < 1)
369 return false;
370 v8::Handle<v8::Value> fn = args[0];
371 if (!fn->IsFunction())
372 return false;
373 v8::HandleScope handleScope;
374 v8::Handle<v8::Function> function = v8::Handle<v8::Function>::Cast(fn);
375 *lineNumber = function->GetScriptLineNumber();
376 *columnNumber = function->GetScriptColumnNumber();
377 if (*lineNumber == v8::Function::kLineOffsetNotFound || *columnNumber == v8: :Function::kLineOffsetNotFound)
378 return false;
379 *scriptId = toWebCoreStringWithUndefinedOrNullCheck(function->GetScriptId()) ;
380 return true;
381 }
382
383 void V8InjectedScriptHost::setBreakpointMethodCustom(const v8::FunctionCallbackI nfo<v8::Value>& args)
384 {
385 String scriptId;
386 int lineNumber;
387 int columnNumber;
388 if (!getFunctionLocation(args, &scriptId, &lineNumber, &columnNumber))
389 return;
390
391 InjectedScriptHost* host = V8InjectedScriptHost::toNative(args.Holder());
392 host->setBreakpoint(scriptId, lineNumber, columnNumber);
393 }
394
395 void V8InjectedScriptHost::removeBreakpointMethodCustom(const v8::FunctionCallba ckInfo<v8::Value>& args)
396 {
397 String scriptId;
398 int lineNumber;
399 int columnNumber;
400 if (!getFunctionLocation(args, &scriptId, &lineNumber, &columnNumber))
401 return;
402
403 InjectedScriptHost* host = V8InjectedScriptHost::toNative(args.Holder());
404 host->removeBreakpoint(scriptId, lineNumber, columnNumber);
405 }
406
366 407
367 } // namespace WebCore 408 } // namespace WebCore
368 409
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