OLD | NEW |
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 Loading... |
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()-
>ToString()); |
| 380 return true; |
| 381 } |
| 382 |
| 383 void V8InjectedScriptHost::setBreakpointMethodCustom(const v8::FunctionCallbackI
nfo<v8::Value>& args) |
| 384 { |
| 385 String scriptId; |
| 386 int lineNumber, columnNumber; |
| 387 if (!getFunctionLocation(args, &scriptId, &lineNumber, &columnNumber)) |
| 388 return; |
| 389 |
| 390 InjectedScriptHost* host = V8InjectedScriptHost::toNative(args.Holder()); |
| 391 host->setBreakpoint(scriptId, lineNumber, columnNumber); |
| 392 } |
| 393 |
| 394 void V8InjectedScriptHost::removeBreakpointMethodCustom(const v8::FunctionCallba
ckInfo<v8::Value>& args) |
| 395 { |
| 396 String scriptId; |
| 397 int lineNumber, columnNumber; |
| 398 if (!getFunctionLocation(args, &scriptId, &lineNumber, &columnNumber)) |
| 399 return; |
| 400 |
| 401 InjectedScriptHost* host = V8InjectedScriptHost::toNative(args.Holder()); |
| 402 host->removeBreakpoint(scriptId, lineNumber, columnNumber); |
| 403 } |
| 404 |
366 | 405 |
367 } // namespace WebCore | 406 } // namespace WebCore |
368 | 407 |
OLD | NEW |