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 "core/InspectorTypeBuilder.h" | 8 #include "core/InspectorTypeBuilder.h" |
9 #include "platform/heap/Handle.h" | 9 #include "platform/heap/Handle.h" |
10 #include "wtf/HashMap.h" | 10 #include "wtf/HashMap.h" |
11 #include "wtf/Noncopyable.h" | 11 #include "wtf/Noncopyable.h" |
12 #include "wtf/RefPtr.h" | 12 #include "wtf/RefPtr.h" |
13 #include "wtf/Vector.h" | 13 #include "wtf/Vector.h" |
14 #include <v8.h> | 14 #include <v8.h> |
15 | 15 |
16 namespace blink { | 16 namespace blink { |
17 | 17 |
18 class ScriptState; | 18 class ScriptState; |
19 | 19 |
20 class PromiseTracker FINAL { | 20 class PromiseTracker FINAL : public NoBaseWillBeGarbageCollected<PromiseTracker>
{ |
21 WTF_MAKE_NONCOPYABLE(PromiseTracker); | 21 WTF_MAKE_NONCOPYABLE(PromiseTracker); |
22 DISALLOW_ALLOCATION(); | 22 DECLARE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(PromiseTracker); |
23 public: | 23 public: |
24 PromiseTracker(); | 24 static PassOwnPtrWillBeRawPtr<PromiseTracker> create() |
25 ~PromiseTracker(); | 25 { |
| 26 return adoptPtrWillBeNoop(new PromiseTracker()); |
| 27 } |
26 | 28 |
27 bool isEnabled() const { return m_isEnabled; } | 29 bool isEnabled() const { return m_isEnabled; } |
28 void setEnabled(bool); | 30 void setEnabled(bool); |
29 | 31 |
30 void clear(); | 32 void clear(); |
31 | 33 |
32 void didReceiveV8PromiseEvent(ScriptState*, v8::Handle<v8::Object> promise,
v8::Handle<v8::Value> parentPromise, int status); | 34 void didReceiveV8PromiseEvent(ScriptState*, v8::Handle<v8::Object> promise,
v8::Handle<v8::Value> parentPromise, int status); |
33 | 35 |
34 PassRefPtr<TypeBuilder::Array<TypeBuilder::Debugger::PromiseDetails> > promi
ses(); | 36 PassRefPtr<TypeBuilder::Array<TypeBuilder::Debugger::PromiseDetails> > promi
ses(); |
35 | 37 |
36 class PromiseData; | 38 class PromiseData; |
37 | 39 |
38 typedef WillBeHeapVector<RefPtrWillBeMember<PromiseData> > PromiseDataVector
; | 40 typedef WillBeHeapVector<RefPtrWillBeMember<PromiseData> > PromiseDataVector
; |
39 typedef WillBeHeapHashMap<int, PromiseDataVector> PromiseDataMap; | 41 typedef WillBeHeapHashMap<int, PromiseDataVector> PromiseDataMap; |
40 | 42 |
41 void trace(Visitor*); | 43 void trace(Visitor*); |
42 | 44 |
| 45 PromiseDataMap& promiseDataMap() { return m_promiseDataMap; } |
| 46 |
43 private: | 47 private: |
| 48 PromiseTracker(); |
| 49 |
44 int circularSequentialId(); | 50 int circularSequentialId(); |
45 PassRefPtrWillBeRawPtr<PromiseData> createPromiseDataIfNeeded(v8::Isolate*,
v8::Handle<v8::Object> promise); | 51 PassRefPtrWillBeRawPtr<PromiseData> createPromiseDataIfNeeded(v8::Isolate*,
v8::Handle<v8::Object> promise); |
46 | 52 |
47 bool m_isEnabled; | |
48 int m_circularSequentialId; | 53 int m_circularSequentialId; |
49 PromiseDataMap m_promiseDataMap; | 54 PromiseDataMap m_promiseDataMap; |
| 55 bool m_isEnabled; |
50 }; | 56 }; |
51 | 57 |
52 } // namespace blink | 58 } // namespace blink |
53 | 59 |
54 #endif // !defined(PromiseTracker_h) | 60 #endif // !defined(PromiseTracker_h) |
OLD | NEW |