| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 class EventListener; | 45 class EventListener; |
| 46 class EventTarget; | 46 class EventTarget; |
| 47 class ExecutionContext; | 47 class ExecutionContext; |
| 48 class ExecutionContextTask; | 48 class ExecutionContextTask; |
| 49 class MutationObserver; | 49 class MutationObserver; |
| 50 class XMLHttpRequest; | 50 class XMLHttpRequest; |
| 51 | 51 |
| 52 class AsyncCallStackTracker { | 52 class AsyncCallStackTracker { |
| 53 WTF_MAKE_NONCOPYABLE(AsyncCallStackTracker); | 53 WTF_MAKE_NONCOPYABLE(AsyncCallStackTracker); |
| 54 public: | 54 public: |
| 55 class AsyncCallStack : public RefCounted<AsyncCallStack> { | 55 class AsyncCallStack FINAL : public RefCountedWillBeGarbageCollectedFinalize
d<AsyncCallStack> { |
| 56 public: | 56 public: |
| 57 AsyncCallStack(const String&, const ScriptValue&); | 57 AsyncCallStack(const String&, const ScriptValue&); |
| 58 ~AsyncCallStack(); | 58 ~AsyncCallStack(); |
| 59 void trace(Visitor*) { } |
| 59 String description() const { return m_description; } | 60 String description() const { return m_description; } |
| 60 ScriptValue callFrames() const { return m_callFrames; } | 61 ScriptValue callFrames() const { return m_callFrames; } |
| 61 private: | 62 private: |
| 62 String m_description; | 63 String m_description; |
| 63 ScriptValue m_callFrames; | 64 ScriptValue m_callFrames; |
| 64 }; | 65 }; |
| 65 | 66 |
| 66 typedef Deque<RefPtr<AsyncCallStack>, 4> AsyncCallStackVector; | 67 typedef WillBeHeapDeque<RefPtrWillBeMember<AsyncCallStack>, 4> AsyncCallStac
kVector; |
| 67 | 68 |
| 68 class AsyncCallChain : public RefCounted<AsyncCallChain> { | 69 class AsyncCallChain : public RefCountedWillBeGarbageCollected<AsyncCallChai
n> { |
| 69 public: | 70 public: |
| 70 AsyncCallChain() { } | 71 AsyncCallChain() { } |
| 71 AsyncCallChain(const AsyncCallChain& t) : m_callStacks(t.m_callStacks) {
} | 72 AsyncCallChain(const AsyncCallChain& t) : m_callStacks(t.m_callStacks) {
} |
| 72 AsyncCallStackVector callStacks() const { return m_callStacks; } | 73 AsyncCallStackVector callStacks() const { return m_callStacks; } |
| 74 void trace(Visitor*); |
| 73 private: | 75 private: |
| 74 friend class AsyncCallStackTracker; | 76 friend class AsyncCallStackTracker; |
| 75 AsyncCallStackVector m_callStacks; | 77 AsyncCallStackVector m_callStacks; |
| 76 }; | 78 }; |
| 77 | 79 |
| 78 AsyncCallStackTracker(); | 80 AsyncCallStackTracker(); |
| 79 | 81 |
| 80 bool isEnabled() const { return m_maxAsyncCallStackDepth; } | 82 bool isEnabled() const { return m_maxAsyncCallStackDepth; } |
| 81 void setAsyncCallStackDepth(int); | 83 void setAsyncCallStackDepth(int); |
| 82 const AsyncCallChain* currentAsyncCallChain() const; | 84 const AsyncCallChain* currentAsyncCallChain() const; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 111 int traceAsyncOperationStarting(ExecutionContext*, const String& operationNa
me, const ScriptValue& callFrames); | 113 int traceAsyncOperationStarting(ExecutionContext*, const String& operationNa
me, const ScriptValue& callFrames); |
| 112 void traceAsyncOperationCompleted(ExecutionContext*, int operationId); | 114 void traceAsyncOperationCompleted(ExecutionContext*, int operationId); |
| 113 void traceAsyncCallbackStarting(ExecutionContext*, int operationId); | 115 void traceAsyncCallbackStarting(ExecutionContext*, int operationId); |
| 114 | 116 |
| 115 void didFireAsyncCall(); | 117 void didFireAsyncCall(); |
| 116 void clear(); | 118 void clear(); |
| 117 | 119 |
| 118 private: | 120 private: |
| 119 void willHandleXHREvent(XMLHttpRequest*, Event*); | 121 void willHandleXHREvent(XMLHttpRequest*, Event*); |
| 120 | 122 |
| 121 PassRefPtr<AsyncCallChain> createAsyncCallChain(const String& description, c
onst ScriptValue& callFrames); | 123 PassRefPtrWillBeRawPtr<AsyncCallChain> createAsyncCallChain(const String& de
scription, const ScriptValue& callFrames); |
| 122 void setCurrentAsyncCallChain(ExecutionContext*, PassRefPtr<AsyncCallChain>)
; | 124 void setCurrentAsyncCallChain(ExecutionContext*, PassRefPtrWillBeRawPtr<Asyn
cCallChain>); |
| 123 void clearCurrentAsyncCallChain(); | 125 void clearCurrentAsyncCallChain(); |
| 124 static void ensureMaxAsyncCallChainDepth(AsyncCallChain*, unsigned); | 126 static void ensureMaxAsyncCallChainDepth(AsyncCallChain*, unsigned); |
| 125 bool validateCallFrames(const ScriptValue& callFrames); | 127 bool validateCallFrames(const ScriptValue& callFrames); |
| 126 | 128 |
| 127 class ExecutionContextData; | 129 class ExecutionContextData; |
| 128 ExecutionContextData* createContextDataIfNeeded(ExecutionContext*); | 130 ExecutionContextData* createContextDataIfNeeded(ExecutionContext*); |
| 129 | 131 |
| 130 unsigned m_maxAsyncCallStackDepth; | 132 unsigned m_maxAsyncCallStackDepth; |
| 131 RefPtr<AsyncCallChain> m_currentAsyncCallChain; | 133 RefPtrWillBePersistent<AsyncCallChain> m_currentAsyncCallChain; |
| 132 unsigned m_nestedAsyncCallCount; | 134 unsigned m_nestedAsyncCallCount; |
| 133 typedef HashMap<ExecutionContext*, ExecutionContextData*> ExecutionContextDa
taMap; | 135 typedef HashMap<ExecutionContext*, ExecutionContextData*> ExecutionContextDa
taMap; |
| 134 ExecutionContextDataMap m_executionContextDataMap; | 136 ExecutionContextDataMap m_executionContextDataMap; |
| 135 }; | 137 }; |
| 136 | 138 |
| 137 } // namespace blink | 139 } // namespace blink |
| 138 | 140 |
| 139 #endif // !defined(AsyncCallStackTracker_h) | 141 #endif // !defined(AsyncCallStackTracker_h) |
| OLD | NEW |