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 <memory> | 7 #include <memory> |
8 #include "bindings/core/v8/SourceLocation.h" | 8 #include "bindings/core/v8/SourceLocation.h" |
9 #include "bindings/core/v8/V8BindingForCore.h" | 9 #include "bindings/core/v8/V8BindingForCore.h" |
10 #include "bindings/core/v8/V8DOMException.h" | 10 #include "bindings/core/v8/V8DOMException.h" |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 bool recurring) { | 82 bool recurring) { |
83 v8_inspector_->asyncTaskScheduled(ToV8InspectorStringView(operation_name), | 83 v8_inspector_->asyncTaskScheduled(ToV8InspectorStringView(operation_name), |
84 task, recurring); | 84 task, recurring); |
85 } | 85 } |
86 | 86 |
87 void ThreadDebugger::AsyncTaskCanceled(void* task) { | 87 void ThreadDebugger::AsyncTaskCanceled(void* task) { |
88 v8_inspector_->asyncTaskCanceled(task); | 88 v8_inspector_->asyncTaskCanceled(task); |
89 } | 89 } |
90 | 90 |
91 void ThreadDebugger::AllAsyncTasksCanceled() { | 91 void ThreadDebugger::AllAsyncTasksCanceled() { |
| 92 current_async_tasks_ = 0; |
92 v8_inspector_->allAsyncTasksCanceled(); | 93 v8_inspector_->allAsyncTasksCanceled(); |
93 } | 94 } |
94 | 95 |
95 void ThreadDebugger::AsyncTaskStarted(void* task) { | 96 void ThreadDebugger::AsyncTaskStarted(void* task) { |
| 97 ++current_async_tasks_; |
96 v8_inspector_->asyncTaskStarted(task); | 98 v8_inspector_->asyncTaskStarted(task); |
97 } | 99 } |
98 | 100 |
99 void ThreadDebugger::AsyncTaskFinished(void* task) { | 101 void ThreadDebugger::AsyncTaskFinished(void* task) { |
| 102 if (current_async_tasks_ > 0) |
| 103 --current_async_tasks_; |
100 v8_inspector_->asyncTaskFinished(task); | 104 v8_inspector_->asyncTaskFinished(task); |
101 } | 105 } |
102 | 106 |
103 unsigned ThreadDebugger::PromiseRejected( | 107 unsigned ThreadDebugger::PromiseRejected( |
104 v8::Local<v8::Context> context, | 108 v8::Local<v8::Context> context, |
105 const String& error_message, | 109 const String& error_message, |
106 v8::Local<v8::Value> exception, | 110 v8::Local<v8::Value> exception, |
107 std::unique_ptr<SourceLocation> location) { | 111 std::unique_ptr<SourceLocation> location) { |
108 const String default_message = "Uncaught (in promise)"; | 112 const String default_message = "Uncaught (in promise)"; |
109 String message = error_message; | 113 String message = error_message; |
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
471 void ThreadDebugger::OnTimer(TimerBase* timer) { | 475 void ThreadDebugger::OnTimer(TimerBase* timer) { |
472 for (size_t index = 0; index < timers_.size(); ++index) { | 476 for (size_t index = 0; index < timers_.size(); ++index) { |
473 if (timers_[index].get() == timer) { | 477 if (timers_[index].get() == timer) { |
474 timer_callbacks_[index](timer_data_[index]); | 478 timer_callbacks_[index](timer_data_[index]); |
475 return; | 479 return; |
476 } | 480 } |
477 } | 481 } |
478 } | 482 } |
479 | 483 |
480 } // namespace blink | 484 } // namespace blink |
OLD | NEW |