| 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/CoreExport.h" | 9 #include "core/CoreExport.h" |
| 10 #include "core/InspectorFrontend.h" | 10 #include "core/InspectorFrontend.h" |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 int promiseId(v8::Local<v8::Object> promise, bool* isNewPromise); | 52 int promiseId(v8::Local<v8::Object> promise, bool* isNewPromise); |
| 53 | 53 |
| 54 int m_circularSequentialId; | 54 int m_circularSequentialId; |
| 55 bool m_isEnabled; | 55 bool m_isEnabled; |
| 56 bool m_captureStacks; | 56 bool m_captureStacks; |
| 57 RawPtrWillBeMember<Listener> m_listener; | 57 RawPtrWillBeMember<Listener> m_listener; |
| 58 | 58 |
| 59 v8::Isolate* m_isolate; | 59 v8::Isolate* m_isolate; |
| 60 v8::Persistent<v8::NativeWeakMap> m_promiseToId; | 60 v8::Persistent<v8::NativeWeakMap> m_promiseToId; |
| 61 | 61 |
| 62 #if !ENABLE(OILPAN) |
| 62 WeakPtrFactory<PromiseTracker> m_weakPtrFactory; | 63 WeakPtrFactory<PromiseTracker> m_weakPtrFactory; |
| 64 #endif |
| 63 | 65 |
| 64 class PromiseWeakCallbackData; | 66 class PromiseWeakCallbackData; |
| 65 class IdToPromiseMapTraits : public V8GlobalValueMapTraits<int, v8::Object,
v8::kWeakWithParameter> { | 67 class IdToPromiseMapTraits : public V8GlobalValueMapTraits<int, v8::Object,
v8::kWeakWithParameter> { |
| 66 public: | 68 public: |
| 67 // Weak traits: | 69 // Weak traits: |
| 68 typedef PromiseWeakCallbackData WeakCallbackDataType; | 70 typedef PromiseWeakCallbackData WeakCallbackDataType; |
| 69 typedef v8::GlobalValueMap<int, v8::Object, IdToPromiseMapTraits> MapTyp
e; | 71 typedef v8::GlobalValueMap<int, v8::Object, IdToPromiseMapTraits> MapTyp
e; |
| 70 | 72 |
| 71 static WeakCallbackDataType* WeakCallbackParameter(MapType*, int key, v8
::Local<v8::Object>& value); | 73 static WeakCallbackDataType* WeakCallbackParameter(MapType*, int key, v8
::Local<v8::Object>& value); |
| 72 static void OnWeakCallback(const v8::WeakCallbackInfo<WeakCallbackDataTy
pe>&) { } | 74 static void OnWeakCallback(const v8::WeakCallbackInfo<WeakCallbackDataTy
pe>&) { } |
| 73 // This method will be called if the value is removed from the map. | 75 // This method will be called if the value is removed from the map. |
| 74 static void DisposeCallbackData(WeakCallbackDataType*); | 76 static void DisposeCallbackData(WeakCallbackDataType*); |
| 75 // This method is called if weakly referenced value is collected. | 77 // This method is called if weakly referenced value is collected. |
| 76 static void DisposeWeak(const v8::WeakCallbackInfo<WeakCallbackDataType>
&); | 78 static void DisposeWeak(const v8::WeakCallbackInfo<WeakCallbackDataType>
&); |
| 77 | 79 |
| 78 static MapType* MapFromWeakCallbackInfo(const v8::WeakCallbackInfo<WeakC
allbackDataType>&); | 80 static MapType* MapFromWeakCallbackInfo(const v8::WeakCallbackInfo<WeakC
allbackDataType>&); |
| 79 static int KeyFromWeakCallbackInfo(const v8::WeakCallbackInfo<WeakCallba
ckDataType>&); | 81 static int KeyFromWeakCallbackInfo(const v8::WeakCallbackInfo<WeakCallba
ckDataType>&); |
| 80 }; | 82 }; |
| 81 | 83 |
| 82 IdToPromiseMapTraits::MapType m_idToPromise; | 84 IdToPromiseMapTraits::MapType m_idToPromise; |
| 83 }; | 85 }; |
| 84 | 86 |
| 85 } // namespace blink | 87 } // namespace blink |
| 86 | 88 |
| 87 #endif // !defined(PromiseTracker_h) | 89 #endif // !defined(PromiseTracker_h) |
| OLD | NEW |