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 bool ThreadDebugger::AsyncTaskStarted(void* task, bool optional) { |
96 v8_inspector_->asyncTaskStarted(task); | 97 if (!current_async_tasks_ || !optional) { |
| 98 ++current_async_tasks_; |
| 99 v8_inspector_->asyncTaskStarted(task); |
| 100 return true; |
| 101 } |
| 102 return false; |
97 } | 103 } |
98 | 104 |
99 void ThreadDebugger::AsyncTaskFinished(void* task) { | 105 void ThreadDebugger::AsyncTaskFinished(void* task) { |
| 106 if (current_async_tasks_ > 0) |
| 107 --current_async_tasks_; |
100 v8_inspector_->asyncTaskFinished(task); | 108 v8_inspector_->asyncTaskFinished(task); |
101 } | 109 } |
102 | 110 |
103 unsigned ThreadDebugger::PromiseRejected( | 111 unsigned ThreadDebugger::PromiseRejected( |
104 v8::Local<v8::Context> context, | 112 v8::Local<v8::Context> context, |
105 const String& error_message, | 113 const String& error_message, |
106 v8::Local<v8::Value> exception, | 114 v8::Local<v8::Value> exception, |
107 std::unique_ptr<SourceLocation> location) { | 115 std::unique_ptr<SourceLocation> location) { |
108 const String default_message = "Uncaught (in promise)"; | 116 const String default_message = "Uncaught (in promise)"; |
109 String message = error_message; | 117 String message = error_message; |
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
471 void ThreadDebugger::OnTimer(TimerBase* timer) { | 479 void ThreadDebugger::OnTimer(TimerBase* timer) { |
472 for (size_t index = 0; index < timers_.size(); ++index) { | 480 for (size_t index = 0; index < timers_.size(); ++index) { |
473 if (timers_[index].get() == timer) { | 481 if (timers_[index].get() == timer) { |
474 timer_callbacks_[index](timer_data_[index]); | 482 timer_callbacks_[index](timer_data_[index]); |
475 return; | 483 return; |
476 } | 484 } |
477 } | 485 } |
478 } | 486 } |
479 | 487 |
480 } // namespace blink | 488 } // namespace blink |
OLD | NEW |