| 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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 TRACE_EVENT_INSTANT1("devtools.timeline", "TimeStamp", TRACE_EVENT_SCOPE_THR
EAD, "data", InspectorTimeStampEvent::data(currentExecutionContext(isolate), tit
le)); | 155 TRACE_EVENT_INSTANT1("devtools.timeline", "TimeStamp", TRACE_EVENT_SCOPE_THR
EAD, "data", InspectorTimeStampEvent::data(currentExecutionContext(isolate), tit
le)); |
| 156 } | 156 } |
| 157 | 157 |
| 158 void ThreadDebugger::startRepeatingTimer(double interval, V8DebuggerClient::Time
rCallback callback, void* data) | 158 void ThreadDebugger::startRepeatingTimer(double interval, V8DebuggerClient::Time
rCallback callback, void* data) |
| 159 { | 159 { |
| 160 m_timerData.append(data); | 160 m_timerData.append(data); |
| 161 m_timerCallbacks.append(callback); | 161 m_timerCallbacks.append(callback); |
| 162 | 162 |
| 163 OwnPtr<Timer<ThreadDebugger>> timer = adoptPtr(new Timer<ThreadDebugger>(thi
s, &ThreadDebugger::onTimer)); | 163 OwnPtr<Timer<ThreadDebugger>> timer = adoptPtr(new Timer<ThreadDebugger>(thi
s, &ThreadDebugger::onTimer)); |
| 164 Timer<ThreadDebugger>* timerPtr = timer.get(); | 164 Timer<ThreadDebugger>* timerPtr = timer.get(); |
| 165 m_timers.append(timer.release()); | 165 m_timers.append(std::move(timer)); |
| 166 timerPtr->startRepeating(interval, BLINK_FROM_HERE); | 166 timerPtr->startRepeating(interval, BLINK_FROM_HERE); |
| 167 } | 167 } |
| 168 | 168 |
| 169 void ThreadDebugger::cancelTimer(void* data) | 169 void ThreadDebugger::cancelTimer(void* data) |
| 170 { | 170 { |
| 171 for (size_t index = 0; index < m_timerData.size(); ++index) { | 171 for (size_t index = 0; index < m_timerData.size(); ++index) { |
| 172 if (m_timerData[index] == data) { | 172 if (m_timerData[index] == data) { |
| 173 m_timers[index]->stop(); | 173 m_timers[index]->stop(); |
| 174 m_timerCallbacks.remove(index); | 174 m_timerCallbacks.remove(index); |
| 175 m_timers.remove(index); | 175 m_timers.remove(index); |
| 176 m_timerData.remove(index); | 176 m_timerData.remove(index); |
| 177 return; | 177 return; |
| 178 } | 178 } |
| 179 } | 179 } |
| 180 } | 180 } |
| 181 | 181 |
| 182 void ThreadDebugger::onTimer(Timer<ThreadDebugger>* timer) | 182 void ThreadDebugger::onTimer(Timer<ThreadDebugger>* timer) |
| 183 { | 183 { |
| 184 for (size_t index = 0; index < m_timers.size(); ++index) { | 184 for (size_t index = 0; index < m_timers.size(); ++index) { |
| 185 if (m_timers[index] == timer) { | 185 if (m_timers[index] == timer) { |
| 186 m_timerCallbacks[index](m_timerData[index]); | 186 m_timerCallbacks[index](m_timerData[index]); |
| 187 return; | 187 return; |
| 188 } | 188 } |
| 189 } | 189 } |
| 190 } | 190 } |
| 191 | 191 |
| 192 } // namespace blink | 192 } // namespace blink |
| OLD | NEW |