Chromium Code Reviews| 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 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 373 v8::HandleScope handleScope; | 373 v8::HandleScope handleScope; |
| 374 v8::Handle<v8::Function> function = v8::Handle<v8::Function>::Cast(fn); | 374 v8::Handle<v8::Function> function = v8::Handle<v8::Function>::Cast(fn); |
| 375 *lineNumber = function->GetScriptLineNumber(); | 375 *lineNumber = function->GetScriptLineNumber(); |
| 376 *columnNumber = function->GetScriptColumnNumber(); | 376 *columnNumber = function->GetScriptColumnNumber(); |
| 377 if (*lineNumber == v8::Function::kLineOffsetNotFound || *columnNumber == v8: :Function::kLineOffsetNotFound) | 377 if (*lineNumber == v8::Function::kLineOffsetNotFound || *columnNumber == v8: :Function::kLineOffsetNotFound) |
| 378 return false; | 378 return false; |
| 379 *scriptId = toWebCoreStringWithUndefinedOrNullCheck(function->GetScriptId()) ; | 379 *scriptId = toWebCoreStringWithUndefinedOrNullCheck(function->GetScriptId()) ; |
| 380 return true; | 380 return true; |
| 381 } | 381 } |
| 382 | 382 |
| 383 void V8InjectedScriptHost::setBreakpointMethodCustom(const v8::FunctionCallbackI nfo<v8::Value>& args) | 383 void V8InjectedScriptHost::debugFunctionMethodCustom(const v8::FunctionCallbackI nfo<v8::Value>& args) |
| 384 { | 384 { |
| 385 String scriptId; | 385 String scriptId; |
| 386 int lineNumber; | 386 int lineNumber; |
| 387 int columnNumber; | 387 int columnNumber; |
| 388 if (!getFunctionLocation(args, &scriptId, &lineNumber, &columnNumber)) | 388 if (!getFunctionLocation(args, &scriptId, &lineNumber, &columnNumber)) |
| 389 return; | 389 return; |
| 390 | 390 |
| 391 InjectedScriptHost* host = V8InjectedScriptHost::toNative(args.Holder()); | 391 InjectedScriptHost* host = V8InjectedScriptHost::toNative(args.Holder()); |
| 392 host->setBreakpoint(scriptId, lineNumber, columnNumber); | 392 host->debugFunction(scriptId, lineNumber, columnNumber); |
| 393 } | 393 } |
| 394 | 394 |
| 395 void V8InjectedScriptHost::removeBreakpointMethodCustom(const v8::FunctionCallba ckInfo<v8::Value>& args) | 395 void V8InjectedScriptHost::undebugFunctionMethodCustom(const v8::FunctionCallbac kInfo<v8::Value>& args) |
| 396 { | 396 { |
| 397 String scriptId; | 397 String scriptId; |
| 398 int lineNumber; | 398 int lineNumber; |
| 399 int columnNumber; | 399 int columnNumber; |
| 400 if (!getFunctionLocation(args, &scriptId, &lineNumber, &columnNumber)) | 400 if (!getFunctionLocation(args, &scriptId, &lineNumber, &columnNumber)) |
| 401 return; | 401 return; |
| 402 | 402 |
| 403 InjectedScriptHost* host = V8InjectedScriptHost::toNative(args.Holder()); | 403 InjectedScriptHost* host = V8InjectedScriptHost::toNative(args.Holder()); |
| 404 host->removeBreakpoint(scriptId, lineNumber, columnNumber); | 404 host->undebugFunction(scriptId, lineNumber, columnNumber); |
| 405 } | 405 } |
| 406 | 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 ASSERT(args.Length() > 0 && args[0]->IsFunction()); | |
| 416 v8::Handle<v8::Function> function = v8::Handle<v8::Function>::Cast(args[0]); | |
|
yurys
2013/06/17 12:06:14
Please add a note that we rely on IsFunction check
SeRya
2013/06/17 15:08:57
Done.
| |
| 417 v8::Handle<v8::Value> name = function->GetName(); | |
| 418 if (!name->IsString() || !v8::Handle<v8::String>::Cast(name)->Length()) | |
| 419 name = function->GetInferredName(); | |
| 420 | |
| 421 InjectedScriptHost* host = V8InjectedScriptHost::toNative(args.Holder()); | |
| 422 host->monitorFunction(scriptId, lineNumber, columnNumber, toWebCoreStringWit hUndefinedOrNullCheck(name)); | |
| 423 } | |
| 424 | |
| 425 void V8InjectedScriptHost::unmonitorFunctionMethodCustom(const v8::FunctionCallb ackInfo<v8::Value>& args) | |
| 426 { | |
| 427 String scriptId; | |
| 428 int lineNumber; | |
| 429 int columnNumber; | |
| 430 if (!getFunctionLocation(args, &scriptId, &lineNumber, &columnNumber)) | |
| 431 return; | |
| 432 | |
| 433 InjectedScriptHost* host = V8InjectedScriptHost::toNative(args.Holder()); | |
| 434 host->unmonitorFunction(scriptId, lineNumber, columnNumber); | |
| 435 } | |
| 407 | 436 |
| 408 } // namespace WebCore | 437 } // namespace WebCore |
| 409 | 438 |
| OLD | NEW |