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 #ifndef PromiseTracker_h | 5 #ifndef PromiseTracker_h |
6 #define PromiseTracker_h | 6 #define PromiseTracker_h |
7 | 7 |
8 #include "bindings/core/v8/V8GlobalValueMap.h" | 8 #include "bindings/core/v8/V8GlobalValueMap.h" |
9 #include "core/InspectorFrontend.h" | 9 #include "core/InspectorFrontend.h" |
10 #include "core/InspectorTypeBuilder.h" | 10 #include "core/InspectorTypeBuilder.h" |
11 #include "platform/heap/Handle.h" | 11 #include "platform/heap/Handle.h" |
12 #include "wtf/HashMap.h" | 12 #include "wtf/HashMap.h" |
13 #include "wtf/Noncopyable.h" | 13 #include "wtf/Noncopyable.h" |
14 #include "wtf/RefPtr.h" | 14 #include "wtf/RefPtr.h" |
15 #include "wtf/Vector.h" | 15 #include "wtf/Vector.h" |
16 #include <v8.h> | 16 #include <v8.h> |
17 | 17 |
18 namespace blink { | 18 namespace blink { |
19 | 19 |
20 class ScriptState; | 20 class ScriptState; |
21 class ScriptValue; | 21 class ScriptValue; |
22 | 22 |
23 class PromiseTracker final : public NoBaseWillBeGarbageCollected<PromiseTracker>
{ | 23 class PromiseTracker final : public NoBaseWillBeGarbageCollectedFinalized<Promis
eTracker> { |
24 WTF_MAKE_NONCOPYABLE(PromiseTracker); | 24 WTF_MAKE_NONCOPYABLE(PromiseTracker); |
25 DECLARE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(PromiseTracker); | |
26 public: | 25 public: |
27 class Listener : public WillBeGarbageCollectedMixin { | 26 class Listener : public WillBeGarbageCollectedMixin { |
28 public: | 27 public: |
29 virtual ~Listener() { } | 28 virtual ~Listener() { } |
30 virtual void didUpdatePromise(InspectorFrontend::Debugger::EventType::En
um, PassRefPtr<TypeBuilder::Debugger::PromiseDetails>) = 0; | 29 virtual void didUpdatePromise(InspectorFrontend::Debugger::EventType::En
um, PassRefPtr<TypeBuilder::Debugger::PromiseDetails>) = 0; |
31 }; | 30 }; |
32 | 31 |
33 static PassOwnPtrWillBeRawPtr<PromiseTracker> create(Listener* listener, v8:
:Isolate* isolate) | 32 static PassOwnPtrWillBeRawPtr<PromiseTracker> create(Listener* listener, v8:
:Isolate* isolate) |
34 { | 33 { |
35 return adoptPtrWillBeNoop(new PromiseTracker(listener, isolate)); | 34 return adoptPtrWillBeNoop(new PromiseTracker(listener, isolate)); |
36 } | 35 } |
37 | 36 |
| 37 ~PromiseTracker(); |
| 38 |
38 bool isEnabled() const { return m_isEnabled; } | 39 bool isEnabled() const { return m_isEnabled; } |
39 void setEnabled(bool enabled, bool captureStacks); | 40 void setEnabled(bool enabled, bool captureStacks); |
40 void clear(); | 41 void clear(); |
41 void didReceiveV8PromiseEvent(ScriptState*, v8::Local<v8::Object> promise, v
8::Local<v8::Value> parentPromise, int status); | 42 void didReceiveV8PromiseEvent(ScriptState*, v8::Local<v8::Object> promise, v
8::Local<v8::Value> parentPromise, int status); |
42 ScriptValue promiseById(int promiseId); | 43 ScriptValue promiseById(int promiseId); |
43 | 44 |
44 DECLARE_TRACE(); | 45 DECLARE_TRACE(); |
45 | 46 |
46 private: | 47 private: |
47 PromiseTracker(Listener*, v8::Isolate*); | 48 PromiseTracker(Listener*, v8::Isolate*); |
(...skipping 27 matching lines...) Expand all Loading... |
75 static MapType* MapFromWeakCallbackInfo(const v8::WeakCallbackInfo<WeakC
allbackDataType>&); | 76 static MapType* MapFromWeakCallbackInfo(const v8::WeakCallbackInfo<WeakC
allbackDataType>&); |
76 static int KeyFromWeakCallbackInfo(const v8::WeakCallbackInfo<WeakCallba
ckDataType>&); | 77 static int KeyFromWeakCallbackInfo(const v8::WeakCallbackInfo<WeakCallba
ckDataType>&); |
77 }; | 78 }; |
78 | 79 |
79 IdToPromiseMapTraits::MapType m_idToPromise; | 80 IdToPromiseMapTraits::MapType m_idToPromise; |
80 }; | 81 }; |
81 | 82 |
82 } // namespace blink | 83 } // namespace blink |
83 | 84 |
84 #endif // !defined(PromiseTracker_h) | 85 #endif // !defined(PromiseTracker_h) |
OLD | NEW |