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 "config.h" | 5 #include "config.h" |
6 #include "core/inspector/V8AsyncCallTracker.h" | 6 #include "core/inspector/V8AsyncCallTracker.h" |
7 | 7 |
8 #include "bindings/core/v8/V8PerContextData.h" | 8 #include "bindings/core/v8/V8PerContextData.h" |
9 #include "core/inspector/AsyncCallChainMap.h" | 9 #include "core/inspector/AsyncCallChainMap.h" |
10 #include "platform/heap/Handle.h" | 10 #include "platform/heap/Handle.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 class V8AsyncCallTracker::V8ContextAsyncCallChains final : public NoBaseWillBeGa
rbageCollectedFinalized<V8AsyncCallTracker::V8ContextAsyncCallChains> { | 26 class V8AsyncCallTracker::V8ContextAsyncCallChains final : public NoBaseWillBeGa
rbageCollectedFinalized<V8AsyncCallTracker::V8ContextAsyncCallChains> { |
27 WTF_MAKE_NONCOPYABLE(V8ContextAsyncCallChains); | 27 WTF_MAKE_NONCOPYABLE(V8ContextAsyncCallChains); |
28 public: | 28 public: |
29 explicit V8ContextAsyncCallChains(InspectorDebuggerAgent* debuggerAgent) | 29 explicit V8ContextAsyncCallChains(InspectorDebuggerAgent* debuggerAgent) |
30 : m_v8AsyncCallChains(debuggerAgent) | 30 : m_v8AsyncCallChains(debuggerAgent) |
31 { | 31 { |
32 } | 32 } |
33 | 33 |
34 ~V8ContextAsyncCallChains() | 34 ~V8ContextAsyncCallChains() |
35 { | 35 { |
| 36 ASSERT(m_v8AsyncCallChains.hasBeenDisposed()); |
| 37 } |
| 38 |
| 39 void dispose() |
| 40 { |
36 // FIXME: get rid of the dispose method and this class altogether once A
syncCallChainMap is always allocated on C++ heap. | 41 // FIXME: get rid of the dispose method and this class altogether once A
syncCallChainMap is always allocated on C++ heap. |
37 m_v8AsyncCallChains.dispose(); | 42 m_v8AsyncCallChains.dispose(); |
38 } | 43 } |
39 | 44 |
40 void trace(Visitor* visitor) | 45 void trace(Visitor* visitor) |
41 { | 46 { |
42 #if ENABLE(OILPAN) | 47 #if ENABLE(OILPAN) |
43 visitor->trace(m_v8AsyncCallChains); | 48 visitor->trace(m_v8AsyncCallChains); |
44 #endif | 49 #endif |
45 } | 50 } |
(...skipping 27 matching lines...) Expand all Loading... |
73 #endif | 78 #endif |
74 InspectorDebuggerAgent::AsyncCallTrackingListener::trace(visitor); | 79 InspectorDebuggerAgent::AsyncCallTrackingListener::trace(visitor); |
75 } | 80 } |
76 | 81 |
77 void V8AsyncCallTracker::asyncCallTrackingStateChanged(bool) | 82 void V8AsyncCallTracker::asyncCallTrackingStateChanged(bool) |
78 { | 83 { |
79 } | 84 } |
80 | 85 |
81 void V8AsyncCallTracker::resetAsyncCallChains() | 86 void V8AsyncCallTracker::resetAsyncCallChains() |
82 { | 87 { |
83 for (auto& it : m_contextAsyncCallChainMap) | 88 for (auto& it : m_contextAsyncCallChainMap) { |
84 it.key->removeObserver(this); | 89 it.key->removeObserver(this); |
| 90 it.value->dispose(); |
| 91 } |
85 m_contextAsyncCallChainMap.clear(); | 92 m_contextAsyncCallChainMap.clear(); |
86 } | 93 } |
87 | 94 |
88 void V8AsyncCallTracker::willDisposeScriptState(ScriptState* state) | 95 void V8AsyncCallTracker::willDisposeScriptState(ScriptState* state) |
89 { | 96 { |
90 m_contextAsyncCallChainMap.remove(state); | 97 m_contextAsyncCallChainMap.remove(state); |
91 } | 98 } |
92 | 99 |
93 void V8AsyncCallTracker::didReceiveV8AsyncTaskEvent(ScriptState* state, const St
ring& eventType, const String& eventName, int id) | 100 void V8AsyncCallTracker::didReceiveV8AsyncTaskEvent(ScriptState* state, const St
ring& eventType, const String& eventName, int id) |
94 { | 101 { |
(...skipping 28 matching lines...) Expand all Loading... |
123 if (V8ContextAsyncCallChains* contextCallChains = m_contextAsyncCallChainMap
.get(state)) { | 130 if (V8ContextAsyncCallChains* contextCallChains = m_contextAsyncCallChainMap
.get(state)) { |
124 String taskId = makeV8AsyncTaskUniqueId(eventName, id); | 131 String taskId = makeV8AsyncTaskUniqueId(eventName, id); |
125 m_debuggerAgent->setCurrentAsyncCallChain(state->isolate(), contextCallC
hains->m_v8AsyncCallChains.get(taskId)); | 132 m_debuggerAgent->setCurrentAsyncCallChain(state->isolate(), contextCallC
hains->m_v8AsyncCallChains.get(taskId)); |
126 contextCallChains->m_v8AsyncCallChains.remove(taskId); | 133 contextCallChains->m_v8AsyncCallChains.remove(taskId); |
127 } else { | 134 } else { |
128 m_debuggerAgent->setCurrentAsyncCallChain(state->isolate(), nullptr); | 135 m_debuggerAgent->setCurrentAsyncCallChain(state->isolate(), nullptr); |
129 } | 136 } |
130 } | 137 } |
131 | 138 |
132 } // namespace blink | 139 } // namespace blink |
OLD | NEW |