OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "platform/v8_inspector/PromiseTracker.h" | 5 #include "platform/v8_inspector/PromiseTracker.h" |
6 | 6 |
| 7 #include "platform/inspector_protocol/String16.h" |
7 #include "platform/v8_inspector/V8DebuggerAgentImpl.h" | 8 #include "platform/v8_inspector/V8DebuggerAgentImpl.h" |
8 #include "platform/v8_inspector/V8StackTraceImpl.h" | 9 #include "platform/v8_inspector/V8StackTraceImpl.h" |
9 #include "platform/v8_inspector/public/V8DebuggerClient.h" | 10 #include "platform/v8_inspector/public/V8DebuggerClient.h" |
10 #include "wtf/PassOwnPtr.h" | 11 #include "wtf/PassOwnPtr.h" |
11 | 12 |
12 using namespace blink::protocol; | 13 using namespace blink::protocol; |
13 | 14 |
14 namespace blink { | 15 namespace blink { |
15 | 16 |
16 class PromiseTracker::PromiseWrapper { | 17 class PromiseTracker::PromiseWrapper { |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 } | 102 } |
102 | 103 |
103 void PromiseTracker::didReceiveV8PromiseEvent(v8::Local<v8::Context> context, v8
::Local<v8::Object> promise, v8::Local<v8::Value> parentPromise, int status) | 104 void PromiseTracker::didReceiveV8PromiseEvent(v8::Local<v8::Context> context, v8
::Local<v8::Object> promise, v8::Local<v8::Value> parentPromise, int status) |
104 { | 105 { |
105 ASSERT(isEnabled()); | 106 ASSERT(isEnabled()); |
106 ASSERT(!context.IsEmpty()); | 107 ASSERT(!context.IsEmpty()); |
107 | 108 |
108 bool isNewPromise = false; | 109 bool isNewPromise = false; |
109 int id = promiseId(promise, &isNewPromise); | 110 int id = promiseId(promise, &isNewPromise); |
110 | 111 |
111 String eventType = isNewPromise ? Debugger::PromiseUpdated::EventTypeEnum::N
ew : Debugger::PromiseUpdated::EventTypeEnum::Update; | 112 blink::protocol::String16 eventType = isNewPromise ? Debugger::PromiseUpdate
d::EventTypeEnum::New : Debugger::PromiseUpdated::EventTypeEnum::Update; |
112 | 113 |
113 String promiseStatus; | 114 blink::protocol::String16 promiseStatus; |
114 switch (status) { | 115 switch (status) { |
115 case 0: | 116 case 0: |
116 promiseStatus = Debugger::PromiseDetails::StatusEnum::Pending; | 117 promiseStatus = Debugger::PromiseDetails::StatusEnum::Pending; |
117 break; | 118 break; |
118 case 1: | 119 case 1: |
119 promiseStatus = Debugger::PromiseDetails::StatusEnum::Resolved; | 120 promiseStatus = Debugger::PromiseDetails::StatusEnum::Resolved; |
120 break; | 121 break; |
121 default: | 122 default: |
122 promiseStatus = Debugger::PromiseDetails::StatusEnum::Rejected; | 123 promiseStatus = Debugger::PromiseDetails::StatusEnum::Rejected; |
123 }; | 124 }; |
(...skipping 26 matching lines...) Expand all Loading... |
150 } | 151 } |
151 | 152 |
152 v8::Local<v8::Object> PromiseTracker::promiseById(int promiseId) | 153 v8::Local<v8::Object> PromiseTracker::promiseById(int promiseId) |
153 { | 154 { |
154 ASSERT(isEnabled()); | 155 ASSERT(isEnabled()); |
155 PromiseWrapper* wrapper = m_idToPromise.get(promiseId); | 156 PromiseWrapper* wrapper = m_idToPromise.get(promiseId); |
156 return wrapper ? wrapper->m_promise.Get(m_isolate) : v8::Local<v8::Object>()
; | 157 return wrapper ? wrapper->m_promise.Get(m_isolate) : v8::Local<v8::Object>()
; |
157 } | 158 } |
158 | 159 |
159 } // namespace blink | 160 } // namespace blink |
OLD | NEW |