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

Side by Side Diff: Source/bindings/v8/custom/V8InjectedScriptHostCustom.cpp

Issue 16143005: monitor console command implemented. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Replacing set[Debug/Monitor]Breakpoint() by setBreakpoint(..., source,...). 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) 366 void V8InjectedScriptHost::setBreakpointMethodCustom(const v8::FunctionCallbackI nfo<v8::Value>& args)
384 { 367 {
385 String scriptId; 368 if (args.Length() < 5) {
vsevik 2013/06/11 09:18:32 Can we avoid having custom bindings at all?
386 int lineNumber; 369 v8::ThrowException(v8::Exception::Error(v8::String::New("5 argument expe cted.")));
387 int columnNumber;
388 if (!getFunctionLocation(args, &scriptId, &lineNumber, &columnNumber))
389 return; 370 return;
371 }
372 if (!args[0]->IsString()) {
373 v8::ThrowException(v8::Exception::Error(v8::String::New("scriptId must b e a string.")));
374 return;
375 }
376
377 String scriptId = toWebCoreStringWithUndefinedOrNullCheck(args[0]->ToString( ));
378 int lineNumber = args[1]->Int32Value();
379 int columnNumber = args[2]->Int32Value();
380 String source = toWebCoreStringWithUndefinedOrNullCheck(args[3]->ToString()) ;
381 String condition = toWebCoreStringWithUndefinedOrNullCheck(args[4]->ToString ());
390 382
391 InjectedScriptHost* host = V8InjectedScriptHost::toNative(args.Holder()); 383 InjectedScriptHost* host = V8InjectedScriptHost::toNative(args.Holder());
392 host->setBreakpoint(scriptId, lineNumber, columnNumber); 384 host->setBreakpoint(scriptId, lineNumber, columnNumber, source, condition);
393 } 385 }
394 386
395 void V8InjectedScriptHost::removeBreakpointMethodCustom(const v8::FunctionCallba ckInfo<v8::Value>& args) 387 void V8InjectedScriptHost::removeBreakpointMethodCustom(const v8::FunctionCallba ckInfo<v8::Value>& args)
396 { 388 {
397 String scriptId; 389 if (args.Length() < 4) {
398 int lineNumber; 390 v8::ThrowException(v8::Exception::Error(v8::String::New("4 argument expe cted.")));
399 int columnNumber;
400 if (!getFunctionLocation(args, &scriptId, &lineNumber, &columnNumber))
401 return; 391 return;
392 }
393
394 String scriptId = toWebCoreStringWithUndefinedOrNullCheck(args[0]->ToString( ));
395 int lineNumber = args[1]->Int32Value();
396 int columnNumber = args[2]->Int32Value();
397 String source = toWebCoreStringWithUndefinedOrNullCheck(args[3]->ToString()) ;
402 398
403 InjectedScriptHost* host = V8InjectedScriptHost::toNative(args.Holder()); 399 InjectedScriptHost* host = V8InjectedScriptHost::toNative(args.Holder());
404 host->removeBreakpoint(scriptId, lineNumber, columnNumber); 400 host->removeBreakpoint(scriptId, lineNumber, columnNumber, source);
405 } 401 }
406 402
407
408 } // namespace WebCore 403 } // namespace WebCore
409 404
OLDNEW
« no previous file with comments | « LayoutTests/inspector/debugger/monitor-console-command-expected.txt ('k') | Source/core/inspector/InjectedScriptHost.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698