| 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/SourceLocation.h" | 7 #include "bindings/core/v8/SourceLocation.h" |
| 8 #include "bindings/core/v8/V8Binding.h" | 8 #include "bindings/core/v8/V8Binding.h" |
| 9 #include "bindings/core/v8/V8DOMException.h" | 9 #include "bindings/core/v8/V8DOMException.h" |
| 10 #include "bindings/core/v8/V8DOMTokenList.h" | 10 #include "bindings/core/v8/V8DOMTokenList.h" |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 } | 130 } |
| 131 | 131 |
| 132 void ThreadDebugger::promiseRejectionRevoked(v8::Local<v8::Context> context, | 132 void ThreadDebugger::promiseRejectionRevoked(v8::Local<v8::Context> context, |
| 133 unsigned promiseRejectionId) { | 133 unsigned promiseRejectionId) { |
| 134 const String message = "Handler added to rejected promise"; | 134 const String message = "Handler added to rejected promise"; |
| 135 v8Inspector()->exceptionRevoked(context, promiseRejectionId, | 135 v8Inspector()->exceptionRevoked(context, promiseRejectionId, |
| 136 toV8InspectorStringView(message)); | 136 toV8InspectorStringView(message)); |
| 137 } | 137 } |
| 138 | 138 |
| 139 void ThreadDebugger::beginUserGesture() { | 139 void ThreadDebugger::beginUserGesture() { |
| 140 m_userGestureIndicator = wrapUnique( | 140 m_userGestureIndicator = WTF::wrapUnique( |
| 141 new UserGestureIndicator(DocumentUserGestureToken::create(nullptr))); | 141 new UserGestureIndicator(DocumentUserGestureToken::create(nullptr))); |
| 142 } | 142 } |
| 143 | 143 |
| 144 void ThreadDebugger::endUserGesture() { | 144 void ThreadDebugger::endUserGesture() { |
| 145 m_userGestureIndicator.reset(); | 145 m_userGestureIndicator.reset(); |
| 146 } | 146 } |
| 147 | 147 |
| 148 std::unique_ptr<v8_inspector::StringBuffer> ThreadDebugger::valueSubtype( | 148 std::unique_ptr<v8_inspector::StringBuffer> ThreadDebugger::valueSubtype( |
| 149 v8::Local<v8::Value> value) { | 149 v8::Local<v8::Value> value) { |
| 150 static const char kNode[] = "node"; | 150 static const char kNode[] = "node"; |
| (...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 452 toCoreString(title))); | 452 toCoreString(title))); |
| 453 } | 453 } |
| 454 | 454 |
| 455 void ThreadDebugger::startRepeatingTimer( | 455 void ThreadDebugger::startRepeatingTimer( |
| 456 double interval, | 456 double interval, |
| 457 V8InspectorClient::TimerCallback callback, | 457 V8InspectorClient::TimerCallback callback, |
| 458 void* data) { | 458 void* data) { |
| 459 m_timerData.append(data); | 459 m_timerData.append(data); |
| 460 m_timerCallbacks.append(callback); | 460 m_timerCallbacks.append(callback); |
| 461 | 461 |
| 462 std::unique_ptr<Timer<ThreadDebugger>> timer = | 462 std::unique_ptr<Timer<ThreadDebugger>> timer = WTF::wrapUnique( |
| 463 wrapUnique(new Timer<ThreadDebugger>(this, &ThreadDebugger::onTimer)); | 463 new Timer<ThreadDebugger>(this, &ThreadDebugger::onTimer)); |
| 464 Timer<ThreadDebugger>* timerPtr = timer.get(); | 464 Timer<ThreadDebugger>* timerPtr = timer.get(); |
| 465 m_timers.append(std::move(timer)); | 465 m_timers.append(std::move(timer)); |
| 466 timerPtr->startRepeating(interval, BLINK_FROM_HERE); | 466 timerPtr->startRepeating(interval, BLINK_FROM_HERE); |
| 467 } | 467 } |
| 468 | 468 |
| 469 void ThreadDebugger::cancelTimer(void* data) { | 469 void ThreadDebugger::cancelTimer(void* data) { |
| 470 for (size_t index = 0; index < m_timerData.size(); ++index) { | 470 for (size_t index = 0; index < m_timerData.size(); ++index) { |
| 471 if (m_timerData[index] == data) { | 471 if (m_timerData[index] == data) { |
| 472 m_timers[index]->stop(); | 472 m_timers[index]->stop(); |
| 473 m_timerCallbacks.remove(index); | 473 m_timerCallbacks.remove(index); |
| 474 m_timers.remove(index); | 474 m_timers.remove(index); |
| 475 m_timerData.remove(index); | 475 m_timerData.remove(index); |
| 476 return; | 476 return; |
| 477 } | 477 } |
| 478 } | 478 } |
| 479 } | 479 } |
| 480 | 480 |
| 481 void ThreadDebugger::onTimer(TimerBase* timer) { | 481 void ThreadDebugger::onTimer(TimerBase* timer) { |
| 482 for (size_t index = 0; index < m_timers.size(); ++index) { | 482 for (size_t index = 0; index < m_timers.size(); ++index) { |
| 483 if (m_timers[index].get() == timer) { | 483 if (m_timers[index].get() == timer) { |
| 484 m_timerCallbacks[index](m_timerData[index]); | 484 m_timerCallbacks[index](m_timerData[index]); |
| 485 return; | 485 return; |
| 486 } | 486 } |
| 487 } | 487 } |
| 488 } | 488 } |
| 489 | 489 |
| 490 } // namespace blink | 490 } // namespace blink |
| OLD | NEW |