| 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 V8AsyncCallTracker_h | 5 #ifndef V8AsyncCallTracker_h |
| 6 #define V8AsyncCallTracker_h | 6 #define V8AsyncCallTracker_h |
| 7 | 7 |
| 8 #include "bindings/core/v8/ScriptState.h" | 8 #include "bindings/core/v8/ScriptState.h" |
| 9 #include "core/inspector/InspectorDebuggerAgent.h" | 9 #include "core/inspector/InspectorDebuggerAgent.h" |
| 10 #include "platform/heap/Handle.h" | 10 #include "platform/heap/Handle.h" |
| 11 #include "wtf/Forward.h" | 11 #include "wtf/Forward.h" |
| 12 #include "wtf/HashMap.h" | 12 #include "wtf/HashMap.h" |
| 13 #include "wtf/Noncopyable.h" | 13 #include "wtf/Noncopyable.h" |
| 14 | 14 |
| 15 namespace blink { | 15 namespace blink { |
| 16 | 16 |
| 17 class InspectorDebuggerAgent; | 17 class InspectorDebuggerAgent; |
| 18 class ScriptState; | 18 class ScriptState; |
| 19 | 19 |
| 20 class V8AsyncCallTracker final : public NoBaseWillBeGarbageCollectedFinalized<V8
AsyncCallTracker>, public ScriptState::Observer, public InspectorDebuggerAgent::
AsyncCallTrackingListener { | 20 class V8AsyncCallTracker final : public NoBaseWillBeGarbageCollectedFinalized<V8
AsyncCallTracker>, public ScriptState::Observer, public InspectorDebuggerAgent::
AsyncCallTrackingListener { |
| 21 WTF_MAKE_NONCOPYABLE(V8AsyncCallTracker); | 21 WTF_MAKE_NONCOPYABLE(V8AsyncCallTracker); |
| 22 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(V8AsyncCallTracker); | 22 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(V8AsyncCallTracker); |
| 23 public: | 23 public: |
| 24 explicit V8AsyncCallTracker(InspectorDebuggerAgent*); | 24 static PassOwnPtrWillBeRawPtr<V8AsyncCallTracker> create(InspectorDebuggerAg
ent* debuggerAgent) |
| 25 { |
| 26 return adoptPtrWillBeNoop(new V8AsyncCallTracker(debuggerAgent)); |
| 27 } |
| 28 |
| 25 ~V8AsyncCallTracker(); | 29 ~V8AsyncCallTracker(); |
| 26 void trace(Visitor*); | 30 void trace(Visitor*); |
| 27 | 31 |
| 28 // InspectorDebuggerAgent::AsyncCallTrackingListener implementation: | 32 // InspectorDebuggerAgent::AsyncCallTrackingListener implementation: |
| 29 void asyncCallTrackingStateChanged(bool tracking) override; | 33 void asyncCallTrackingStateChanged(bool tracking) override; |
| 30 void resetAsyncCallChains() override; | 34 void resetAsyncCallChains() override; |
| 31 | 35 |
| 32 void didReceiveV8AsyncTaskEvent(ScriptState*, const String& eventType, const
String& eventName, int id); | 36 void didReceiveV8AsyncTaskEvent(ScriptState*, const String& eventType, const
String& eventName, int id); |
| 33 | 37 |
| 34 // ScriptState::Observer implementation: | 38 // ScriptState::Observer implementation: |
| 35 void willDisposeScriptState(ScriptState*) override; | 39 void willDisposeScriptState(ScriptState*) override; |
| 36 | 40 |
| 37 private: | 41 private: |
| 42 explicit V8AsyncCallTracker(InspectorDebuggerAgent*); |
| 43 |
| 38 void didEnqueueV8AsyncTask(ScriptState*, const String& eventName, int id); | 44 void didEnqueueV8AsyncTask(ScriptState*, const String& eventName, int id); |
| 39 void willHandleV8AsyncTask(ScriptState*, const String& eventName, int id); | 45 void willHandleV8AsyncTask(ScriptState*, const String& eventName, int id); |
| 40 | 46 |
| 41 class V8ContextAsyncCallChains; | 47 class V8ContextAsyncCallChains; |
| 42 using V8ContextAsyncChainMap = WillBeHeapHashMap<ScriptState*, OwnPtrWillBeM
ember<V8ContextAsyncCallChains> >; | 48 using V8ContextAsyncChainMap = WillBeHeapHashMap<ScriptState*, OwnPtrWillBeM
ember<V8ContextAsyncCallChains> >; |
| 43 V8ContextAsyncChainMap m_contextAsyncCallChainMap; | 49 V8ContextAsyncChainMap m_contextAsyncCallChainMap; |
| 44 RawPtrWillBeMember<InspectorDebuggerAgent> m_debuggerAgent; | 50 RawPtrWillBeMember<InspectorDebuggerAgent> m_debuggerAgent; |
| 45 }; | 51 }; |
| 46 | 52 |
| 47 } // namespace blink | 53 } // namespace blink |
| 48 | 54 |
| 49 #endif // V8AsyncCallTracker_h | 55 #endif // V8AsyncCallTracker_h |
| OLD | NEW |