| 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 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 364 v8SetReturnValue(args, debugServer.setFunctionVariableValue(functionValue, s
copeIndex, variableName, newValue)); | 364 v8SetReturnValue(args, debugServer.setFunctionVariableValue(functionValue, s
copeIndex, variableName, newValue)); |
| 365 } | 365 } |
| 366 | 366 |
| 367 static bool getFunctionLocation(const v8::FunctionCallbackInfo<v8::Value>& args,
String* scriptId, int* lineNumber, int* columnNumber) | 367 static bool getFunctionLocation(const v8::FunctionCallbackInfo<v8::Value>& args,
String* scriptId, int* lineNumber, int* columnNumber) |
| 368 { | 368 { |
| 369 if (args.Length() < 1) | 369 if (args.Length() < 1) |
| 370 return false; | 370 return false; |
| 371 v8::Handle<v8::Value> fn = args[0]; | 371 v8::Handle<v8::Value> fn = args[0]; |
| 372 if (!fn->IsFunction()) | 372 if (!fn->IsFunction()) |
| 373 return false; | 373 return false; |
| 374 v8::HandleScope handleScope; | |
| 375 v8::Handle<v8::Function> function = v8::Handle<v8::Function>::Cast(fn); | 374 v8::Handle<v8::Function> function = v8::Handle<v8::Function>::Cast(fn); |
| 376 *lineNumber = function->GetScriptLineNumber(); | 375 *lineNumber = function->GetScriptLineNumber(); |
| 377 *columnNumber = function->GetScriptColumnNumber(); | 376 *columnNumber = function->GetScriptColumnNumber(); |
| 378 if (*lineNumber == v8::Function::kLineOffsetNotFound || *columnNumber == v8:
:Function::kLineOffsetNotFound) | 377 if (*lineNumber == v8::Function::kLineOffsetNotFound || *columnNumber == v8:
:Function::kLineOffsetNotFound) |
| 379 return false; | 378 return false; |
| 380 *scriptId = toWebCoreStringWithUndefinedOrNullCheck(function->GetScriptId())
; | 379 *scriptId = toWebCoreStringWithUndefinedOrNullCheck(function->GetScriptId())
; |
| 381 return true; | 380 return true; |
| 382 } | 381 } |
| 383 | 382 |
| 384 void V8InjectedScriptHost::setBreakpointMethodCustom(const v8::FunctionCallbackI
nfo<v8::Value>& args) | 383 void V8InjectedScriptHost::debugFunctionMethodCustom(const v8::FunctionCallbackI
nfo<v8::Value>& args) |
| 385 { | 384 { |
| 386 String scriptId; | 385 String scriptId; |
| 387 int lineNumber; | 386 int lineNumber; |
| 388 int columnNumber; | 387 int columnNumber; |
| 389 if (!getFunctionLocation(args, &scriptId, &lineNumber, &columnNumber)) | 388 if (!getFunctionLocation(args, &scriptId, &lineNumber, &columnNumber)) |
| 390 return; | 389 return; |
| 391 | 390 |
| 392 InjectedScriptHost* host = V8InjectedScriptHost::toNative(args.Holder()); | 391 InjectedScriptHost* host = V8InjectedScriptHost::toNative(args.Holder()); |
| 393 host->setBreakpoint(scriptId, lineNumber, columnNumber); | 392 host->debugFunction(scriptId, lineNumber, columnNumber); |
| 394 } | 393 } |
| 395 | 394 |
| 396 void V8InjectedScriptHost::removeBreakpointMethodCustom(const v8::FunctionCallba
ckInfo<v8::Value>& args) | 395 void V8InjectedScriptHost::undebugFunctionMethodCustom(const v8::FunctionCallbac
kInfo<v8::Value>& args) |
| 397 { | 396 { |
| 398 String scriptId; | 397 String scriptId; |
| 399 int lineNumber; | 398 int lineNumber; |
| 400 int columnNumber; | 399 int columnNumber; |
| 401 if (!getFunctionLocation(args, &scriptId, &lineNumber, &columnNumber)) | 400 if (!getFunctionLocation(args, &scriptId, &lineNumber, &columnNumber)) |
| 402 return; | 401 return; |
| 403 | 402 |
| 404 InjectedScriptHost* host = V8InjectedScriptHost::toNative(args.Holder()); | 403 InjectedScriptHost* host = V8InjectedScriptHost::toNative(args.Holder()); |
| 405 host->removeBreakpoint(scriptId, lineNumber, columnNumber); | 404 host->undebugFunction(scriptId, lineNumber, columnNumber); |
| 406 } | 405 } |
| 407 | 406 |
| 407 void V8InjectedScriptHost::monitorFunctionMethodCustom(const v8::FunctionCallbac
kInfo<v8::Value>& args) |
| 408 { |
| 409 String scriptId; |
| 410 int lineNumber; |
| 411 int columnNumber; |
| 412 if (!getFunctionLocation(args, &scriptId, &lineNumber, &columnNumber)) |
| 413 return; |
| 414 |
| 415 v8::Handle<v8::Function> function = v8::Handle<v8::Function>::Cast(args[0]); |
| 416 v8::Handle<v8::Value> name; |
| 417 if (args.Length() > 0 && args[0]->IsFunction()) { |
| 418 v8::Handle<v8::Function> function = v8::Handle<v8::Function>::Cast(args[
0]); |
| 419 name = function->GetName(); |
| 420 if (!name->IsString() || !v8::Handle<v8::String>::Cast(name)->Length()) |
| 421 name = function->GetInferredName(); |
| 422 } |
| 423 |
| 424 InjectedScriptHost* host = V8InjectedScriptHost::toNative(args.Holder()); |
| 425 host->monitorFunction(scriptId, lineNumber, columnNumber, toWebCoreStringWit
hUndefinedOrNullCheck(name)); |
| 426 } |
| 427 |
| 428 void V8InjectedScriptHost::unmonitorFunctionMethodCustom(const v8::FunctionCallb
ackInfo<v8::Value>& args) |
| 429 { |
| 430 String scriptId; |
| 431 int lineNumber; |
| 432 int columnNumber; |
| 433 if (!getFunctionLocation(args, &scriptId, &lineNumber, &columnNumber)) |
| 434 return; |
| 435 |
| 436 InjectedScriptHost* host = V8InjectedScriptHost::toNative(args.Holder()); |
| 437 host->unmonitorFunction(scriptId, lineNumber, columnNumber); |
| 438 } |
| 408 | 439 |
| 409 } // namespace WebCore | 440 } // namespace WebCore |
| 441 |
| OLD | NEW |