| 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 "platform/inspector_protocol/Allocator.h" | 8 #include "platform/inspector_protocol/Allocator.h" |
| 9 #include "platform/inspector_protocol/Collections.h" |
| 9 #include "platform/v8_inspector/V8DebuggerAgentImpl.h" | 10 #include "platform/v8_inspector/V8DebuggerAgentImpl.h" |
| 10 #include "wtf/HashMap.h" | |
| 11 | 11 |
| 12 #include <v8.h> | 12 #include <v8.h> |
| 13 | 13 |
| 14 namespace blink { | 14 namespace blink { |
| 15 | 15 |
| 16 class V8AsyncCallTracker final { | 16 class V8AsyncCallTracker final { |
| 17 PROTOCOL_DISALLOW_COPY(V8AsyncCallTracker); | 17 PROTOCOL_DISALLOW_COPY(V8AsyncCallTracker); |
| 18 public: | 18 public: |
| 19 static PassOwnPtr<V8AsyncCallTracker> create(V8DebuggerAgentImpl* debuggerAg
ent) | 19 static PassOwnPtr<V8AsyncCallTracker> create(V8DebuggerAgentImpl* debuggerAg
ent) |
| 20 { | 20 { |
| 21 return adoptPtr(new V8AsyncCallTracker(debuggerAgent)); | 21 return adoptPtr(new V8AsyncCallTracker(debuggerAgent)); |
| 22 } | 22 } |
| 23 | 23 |
| 24 ~V8AsyncCallTracker(); | 24 ~V8AsyncCallTracker(); |
| 25 | 25 |
| 26 void asyncCallTrackingStateChanged(bool tracking); | 26 void asyncCallTrackingStateChanged(bool tracking); |
| 27 void resetAsyncOperations(); | 27 void resetAsyncOperations(); |
| 28 | 28 |
| 29 void didReceiveV8AsyncTaskEvent(v8::Local<v8::Context>, const String& eventT
ype, const String& eventName, int id); | 29 void didReceiveV8AsyncTaskEvent(v8::Local<v8::Context>, const String& eventT
ype, const String& eventName, int id); |
| 30 | 30 |
| 31 void contextDisposed(int contextId); | 31 void contextDisposed(int contextId); |
| 32 | 32 |
| 33 private: | 33 private: |
| 34 struct Operations { | 34 struct Operations { |
| 35 HashMap<String, int> map; | 35 protocol::HashMap<String, int> map; |
| 36 int contextId; | 36 int contextId; |
| 37 V8AsyncCallTracker* target; | 37 V8AsyncCallTracker* target; |
| 38 v8::Global<v8::Context> context; | 38 v8::Global<v8::Context> context; |
| 39 }; | 39 }; |
| 40 | 40 |
| 41 static void weakCallback(const v8::WeakCallbackInfo<Operations>& data); | 41 static void weakCallback(const v8::WeakCallbackInfo<Operations>& data); |
| 42 | 42 |
| 43 explicit V8AsyncCallTracker(V8DebuggerAgentImpl*); | 43 explicit V8AsyncCallTracker(V8DebuggerAgentImpl*); |
| 44 | 44 |
| 45 void didEnqueueV8AsyncTask(v8::Local<v8::Context>, const String& eventName,
int id); | 45 void didEnqueueV8AsyncTask(v8::Local<v8::Context>, const String& eventName,
int id); |
| 46 void willHandleV8AsyncTask(v8::Local<v8::Context>, const String& eventName,
int id); | 46 void willHandleV8AsyncTask(v8::Local<v8::Context>, const String& eventName,
int id); |
| 47 void completeOperations(const HashMap<String, int>& contextCallChains); | 47 void completeOperations(const protocol::HashMap<String, int>& contextCallCha
ins); |
| 48 | 48 |
| 49 V8DebuggerAgentImpl* m_debuggerAgent; | 49 V8DebuggerAgentImpl* m_debuggerAgent; |
| 50 HashMap<int, OwnPtr<Operations>> m_idToOperations; | 50 protocol::HashMap<int, OwnPtr<Operations>> m_idToOperations; |
| 51 }; | 51 }; |
| 52 | 52 |
| 53 } // namespace blink | 53 } // namespace blink |
| 54 | 54 |
| 55 #endif // V8AsyncCallTracker_h | 55 #endif // V8AsyncCallTracker_h |
| OLD | NEW |