| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "core/inspector/ThreadDebugger.h" | 5 #include "core/inspector/ThreadDebugger.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/ScriptCallStack.h" | 7 #include "bindings/core/v8/ScriptCallStack.h" |
| 8 #include "bindings/core/v8/ScriptValue.h" | 8 #include "bindings/core/v8/ScriptValue.h" |
| 9 #include "bindings/core/v8/V8Binding.h" | 9 #include "bindings/core/v8/V8Binding.h" |
| 10 #include "bindings/core/v8/V8DOMException.h" | 10 #include "bindings/core/v8/V8DOMException.h" |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 { | 130 { |
| 131 v8::Isolate* isolate = m_isolate; | 131 v8::Isolate* isolate = m_isolate; |
| 132 TRACE_EVENT_INSTANT1("devtools.timeline", "TimeStamp", TRACE_EVENT_SCOPE_THR
EAD, "data", InspectorTimeStampEvent::data(currentExecutionContext(isolate), tit
le)); | 132 TRACE_EVENT_INSTANT1("devtools.timeline", "TimeStamp", TRACE_EVENT_SCOPE_THR
EAD, "data", InspectorTimeStampEvent::data(currentExecutionContext(isolate), tit
le)); |
| 133 } | 133 } |
| 134 | 134 |
| 135 int ThreadDebugger::startRepeatingTimer(double interval, PassOwnPtr<V8DebuggerCl
ient::TimerCallback> callback) | 135 int ThreadDebugger::startRepeatingTimer(double interval, PassOwnPtr<V8DebuggerCl
ient::TimerCallback> callback) |
| 136 { | 136 { |
| 137 int id = ++m_lastTimerId; | 137 int id = ++m_lastTimerId; |
| 138 OwnPtr<Timer<ThreadDebugger>> timer = adoptPtr(new Timer<ThreadDebugger>(thi
s, &ThreadDebugger::onTimer)); | 138 OwnPtr<Timer<ThreadDebugger>> timer = adoptPtr(new Timer<ThreadDebugger>(thi
s, &ThreadDebugger::onTimer)); |
| 139 Timer<ThreadDebugger>* timerPtr = timer.get(); | 139 Timer<ThreadDebugger>* timerPtr = timer.get(); |
| 140 m_timerCallbacks.set(timerPtr, callback); | 140 m_timerCallbacks.set(timerPtr, std::move(callback)); |
| 141 m_timers.set(id, timer.release()); | 141 m_timers.set(id, timer.release()); |
| 142 timerPtr->startRepeating(interval, BLINK_FROM_HERE); | 142 timerPtr->startRepeating(interval, BLINK_FROM_HERE); |
| 143 return id; | 143 return id; |
| 144 } | 144 } |
| 145 | 145 |
| 146 void ThreadDebugger::cancelTimer(int id) | 146 void ThreadDebugger::cancelTimer(int id) |
| 147 { | 147 { |
| 148 if (!m_timers.contains(id)) | 148 if (!m_timers.contains(id)) |
| 149 return; | 149 return; |
| 150 Timer<ThreadDebugger>* timer = m_timers.get(id); | 150 Timer<ThreadDebugger>* timer = m_timers.get(id); |
| 151 timer->stop(); | 151 timer->stop(); |
| 152 m_timerCallbacks.remove(timer); | 152 m_timerCallbacks.remove(timer); |
| 153 m_timers.remove(id); | 153 m_timers.remove(id); |
| 154 } | 154 } |
| 155 | 155 |
| 156 void ThreadDebugger::onTimer(Timer<ThreadDebugger>* timer) | 156 void ThreadDebugger::onTimer(Timer<ThreadDebugger>* timer) |
| 157 { | 157 { |
| 158 ASSERT(m_timerCallbacks.contains(timer)); | 158 ASSERT(m_timerCallbacks.contains(timer)); |
| 159 (*m_timerCallbacks.get(timer))(); | 159 (*m_timerCallbacks.get(timer))(); |
| 160 } | 160 } |
| 161 | 161 |
| 162 } // namespace blink | 162 } // namespace blink |
| OLD | NEW |