| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2010-2011 Google Inc. All rights reserved. | 2 * Copyright (c) 2010-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 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 469 { | 469 { |
| 470 ASSERT(isPaused()); | 470 ASSERT(isPaused()); |
| 471 ASSERT(!m_executionState.IsEmpty()); | 471 ASSERT(!m_executionState.IsEmpty()); |
| 472 v8::Local<v8::Value> argv[] = { m_executionState }; | 472 v8::Local<v8::Value> argv[] = { m_executionState }; |
| 473 v8::Local<v8::Value> result = callDebuggerMethod("frameCount", WTF_ARRAY_LEN
GTH(argv), argv).ToLocalChecked(); | 473 v8::Local<v8::Value> result = callDebuggerMethod("frameCount", WTF_ARRAY_LEN
GTH(argv), argv).ToLocalChecked(); |
| 474 if (result->IsInt32()) | 474 if (result->IsInt32()) |
| 475 return result->Int32Value(); | 475 return result->Int32Value(); |
| 476 return 0; | 476 return 0; |
| 477 } | 477 } |
| 478 | 478 |
| 479 PassOwnPtr<JavaScriptCallFrame> V8DebuggerImpl::wrapCallFrames() | 479 PassOwnPtr<JavaScriptCallFrame> V8DebuggerImpl::currentCallFrames() |
| 480 { | 480 { |
| 481 if (!m_isolate->InContext()) |
| 482 return nullptr; |
| 481 v8::Local<v8::Value> currentCallFrameV8; | 483 v8::Local<v8::Value> currentCallFrameV8; |
| 482 if (m_executionState.IsEmpty()) { | 484 if (m_executionState.IsEmpty()) { |
| 483 v8::Local<v8::Function> currentCallFrameFunction = v8::Local<v8::Functio
n>::Cast(m_debuggerScript.Get(m_isolate)->Get(v8InternalizedString("currentCallF
rame"))); | 485 v8::Local<v8::Function> currentCallFrameFunction = v8::Local<v8::Functio
n>::Cast(m_debuggerScript.Get(m_isolate)->Get(v8InternalizedString("currentCallF
rame"))); |
| 484 currentCallFrameV8 = v8::Debug::Call(debuggerContext(), currentCallFrame
Function).ToLocalChecked(); | 486 currentCallFrameV8 = v8::Debug::Call(debuggerContext(), currentCallFrame
Function).ToLocalChecked(); |
| 485 } else { | 487 } else { |
| 486 v8::Local<v8::Value> argv[] = { m_executionState }; | 488 v8::Local<v8::Value> argv[] = { m_executionState }; |
| 487 currentCallFrameV8 = callDebuggerMethod("currentCallFrame", WTF_ARRAY_LE
NGTH(argv), argv).ToLocalChecked(); | 489 currentCallFrameV8 = callDebuggerMethod("currentCallFrame", WTF_ARRAY_LE
NGTH(argv), argv).ToLocalChecked(); |
| 488 } | 490 } |
| 489 ASSERT(!currentCallFrameV8.IsEmpty()); | 491 ASSERT(!currentCallFrameV8.IsEmpty()); |
| 490 if (!currentCallFrameV8->IsObject()) | 492 if (!currentCallFrameV8->IsObject()) |
| 491 return nullptr; | 493 return nullptr; |
| 492 return JavaScriptCallFrame::create(debuggerContext(), v8::Local<v8::Object>:
:Cast(currentCallFrameV8)); | 494 return JavaScriptCallFrame::create(debuggerContext(), v8::Local<v8::Object>:
:Cast(currentCallFrameV8)); |
| 493 } | 495 } |
| 494 | 496 |
| 495 PassOwnPtr<JavaScriptCallFrame> V8DebuggerImpl::currentCallFrames() | |
| 496 { | |
| 497 if (!m_isolate->InContext()) | |
| 498 return nullptr; | |
| 499 | |
| 500 // Filter out stack traces entirely consisting of V8's internal scripts. | |
| 501 v8::Local<v8::StackTrace> stackTrace = v8::StackTrace::CurrentStackTrace(m_i
solate, 1); | |
| 502 if (!stackTrace->GetFrameCount()) | |
| 503 return nullptr; | |
| 504 | |
| 505 return wrapCallFrames(); | |
| 506 } | |
| 507 | |
| 508 PassOwnPtr<JavaScriptCallFrame> V8DebuggerImpl::callFrame(int index) | 497 PassOwnPtr<JavaScriptCallFrame> V8DebuggerImpl::callFrame(int index) |
| 509 { | 498 { |
| 510 if (!m_isolate->InContext()) | 499 if (!m_isolate->InContext()) |
| 511 return nullptr; | 500 return nullptr; |
| 512 v8::HandleScope handleScope(m_isolate); | 501 v8::HandleScope handleScope(m_isolate); |
| 513 | 502 |
| 514 v8::Local<v8::Value> currentCallFrameV8; | 503 v8::Local<v8::Value> currentCallFrameV8; |
| 515 if (m_executionState.IsEmpty()) { | 504 if (m_executionState.IsEmpty()) { |
| 516 v8::Local<v8::Function> currentCallFrameFunction = v8::Local<v8::Functio
n>::Cast(m_debuggerScript.Get(m_isolate)->Get(v8InternalizedString("currentCallF
rameByIndex"))); | 505 v8::Local<v8::Function> currentCallFrameFunction = v8::Local<v8::Functio
n>::Cast(m_debuggerScript.Get(m_isolate)->Get(v8InternalizedString("currentCallF
rameByIndex"))); |
| 517 currentCallFrameV8 = v8::Debug::Call(debuggerContext(), currentCallFrame
Function, v8::Integer::New(m_isolate, index)).ToLocalChecked(); | 506 currentCallFrameV8 = v8::Debug::Call(debuggerContext(), currentCallFrame
Function, v8::Integer::New(m_isolate, index)).ToLocalChecked(); |
| (...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 884 } | 873 } |
| 885 | 874 |
| 886 v8::Local<v8::Context> V8DebuggerImpl::regexContext() | 875 v8::Local<v8::Context> V8DebuggerImpl::regexContext() |
| 887 { | 876 { |
| 888 if (m_regexContext.IsEmpty()) | 877 if (m_regexContext.IsEmpty()) |
| 889 m_regexContext.Reset(m_isolate, v8::Context::New(m_isolate)); | 878 m_regexContext.Reset(m_isolate, v8::Context::New(m_isolate)); |
| 890 return m_regexContext.Get(m_isolate); | 879 return m_regexContext.Get(m_isolate); |
| 891 } | 880 } |
| 892 | 881 |
| 893 } // namespace blink | 882 } // namespace blink |
| OLD | NEW |