| 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 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 v8::Local<v8::Value> exception; | 288 v8::Local<v8::Value> exception; |
| 289 v8::Local<v8::Array> hitBreakpoints; | 289 v8::Local<v8::Array> hitBreakpoints; |
| 290 handleProgramBreak(m_pausedContext, m_executionState, exception, hitBrea
kpoints); | 290 handleProgramBreak(m_pausedContext, m_executionState, exception, hitBrea
kpoints); |
| 291 return; | 291 return; |
| 292 } | 292 } |
| 293 | 293 |
| 294 if (!canBreakProgram()) | 294 if (!canBreakProgram()) |
| 295 return; | 295 return; |
| 296 | 296 |
| 297 v8::HandleScope scope(m_isolate); | 297 v8::HandleScope scope(m_isolate); |
| 298 if (m_breakProgramCallbackTemplate.IsEmpty()) { | 298 v8::Local<v8::Function> breakFunction; |
| 299 v8::Local<v8::FunctionTemplate> templ = v8::FunctionTemplate::New(m_isol
ate); | 299 if (!v8::Function::New(m_isolate->GetCurrentContext(), &V8DebuggerImpl::brea
kProgramCallback, v8::External::New(m_isolate, this)).ToLocal(&breakFunction)) |
| 300 templ->SetCallHandler(&V8DebuggerImpl::breakProgramCallback, v8::Externa
l::New(m_isolate, this)); | 300 return; |
| 301 m_breakProgramCallbackTemplate.Reset(m_isolate, templ); | 301 v8::Debug::Call(debuggerContext(), breakFunction).ToLocalChecked(); |
| 302 } | |
| 303 | |
| 304 v8::Local<v8::Function> breakProgramFunction = v8::Local<v8::FunctionTemplat
e>::New(m_isolate, m_breakProgramCallbackTemplate)->GetFunction(); | |
| 305 v8::Debug::Call(debuggerContext(), breakProgramFunction).ToLocalChecked(); | |
| 306 } | 302 } |
| 307 | 303 |
| 308 void V8DebuggerImpl::continueProgram() | 304 void V8DebuggerImpl::continueProgram() |
| 309 { | 305 { |
| 310 if (isPaused()) | 306 if (isPaused()) |
| 311 m_client->quitMessageLoopOnPause(); | 307 m_client->quitMessageLoopOnPause(); |
| 312 m_pausedContext.Clear(); | 308 m_pausedContext.Clear(); |
| 313 m_executionState.Clear(); | 309 m_executionState.Clear(); |
| 314 } | 310 } |
| 315 | 311 |
| (...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 836 if (!m_contexts.contains(contextGroupId)) | 832 if (!m_contexts.contains(contextGroupId)) |
| 837 return nullptr; | 833 return nullptr; |
| 838 return m_contexts.get(contextGroupId); | 834 return m_contexts.get(contextGroupId); |
| 839 } | 835 } |
| 840 | 836 |
| 841 V8InspectorSessionImpl* V8DebuggerImpl::sessionForContextGroup(int contextGroupI
d) | 837 V8InspectorSessionImpl* V8DebuggerImpl::sessionForContextGroup(int contextGroupI
d) |
| 842 { | 838 { |
| 843 return contextGroupId ? m_sessions.get(contextGroupId) : nullptr; | 839 return contextGroupId ? m_sessions.get(contextGroupId) : nullptr; |
| 844 } | 840 } |
| 845 | 841 |
| 846 v8::MaybeLocal<v8::FunctionTemplate> V8DebuggerImpl::functionTemplate(const Stri
ng16& name) | |
| 847 { | |
| 848 if (!m_templates.contains(name)) | |
| 849 return v8::MaybeLocal<v8::FunctionTemplate>(); | |
| 850 return m_templates.get(name)->Get(m_isolate); | |
| 851 } | |
| 852 | |
| 853 void V8DebuggerImpl::setFunctionTemplate(const String16& name, v8::Local<v8::Fun
ctionTemplate> functionTemplate) | |
| 854 { | |
| 855 OwnPtr<v8::Global<v8::FunctionTemplate>> global = adoptPtr(new v8::Global<v8
::FunctionTemplate>(m_isolate, functionTemplate)); | |
| 856 m_templates.set(name, global.release()); | |
| 857 } | |
| 858 | |
| 859 } // namespace blink | 842 } // namespace blink |
| OLD | NEW |