| 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 FINAL : public RefCountedWillBeGarbageCollectedFinalize
d<AsyncCallStack> { | 55 class AsyncCallStack : public RefCounted<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*) { } | |
| 60 String description() const { return m_description; } | 59 String description() const { return m_description; } |
| 61 ScriptValue callFrames() const { return m_callFrames; } | 60 ScriptValue callFrames() const { return m_callFrames; } |
| 62 private: | 61 private: |
| 63 String m_description; | 62 String m_description; |
| 64 ScriptValue m_callFrames; | 63 ScriptValue m_callFrames; |
| 65 }; | 64 }; |
| 66 | 65 |
| 67 typedef WillBeHeapDeque<RefPtrWillBeMember<AsyncCallStack>, 4> AsyncCallStac
kVector; | 66 typedef Deque<RefPtr<AsyncCallStack>, 4> AsyncCallStackVector; |
| 68 | 67 |
| 69 class AsyncCallChain : public RefCountedWillBeGarbageCollected<AsyncCallChai
n> { | 68 class AsyncCallChain : public RefCounted<AsyncCallChain> { |
| 70 public: | 69 public: |
| 71 AsyncCallChain() { } | 70 AsyncCallChain() { } |
| 72 AsyncCallChain(const AsyncCallChain& t) : m_callStacks(t.m_callStacks) {
} | 71 AsyncCallChain(const AsyncCallChain& t) : m_callStacks(t.m_callStacks) {
} |
| 73 AsyncCallStackVector callStacks() const { return m_callStacks; } | 72 AsyncCallStackVector callStacks() const { return m_callStacks; } |
| 74 void trace(Visitor*); | |
| 75 private: | 73 private: |
| 76 friend class AsyncCallStackTracker; | 74 friend class AsyncCallStackTracker; |
| 77 AsyncCallStackVector m_callStacks; | 75 AsyncCallStackVector m_callStacks; |
| 78 }; | 76 }; |
| 79 | 77 |
| 80 AsyncCallStackTracker(); | 78 AsyncCallStackTracker(); |
| 81 | 79 |
| 82 bool isEnabled() const { return m_maxAsyncCallStackDepth; } | 80 bool isEnabled() const { return m_maxAsyncCallStackDepth; } |
| 83 void setAsyncCallStackDepth(int); | 81 void setAsyncCallStackDepth(int); |
| 84 const AsyncCallChain* currentAsyncCallChain() const; | 82 const AsyncCallChain* currentAsyncCallChain() const; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 113 int traceAsyncOperationStarting(ExecutionContext*, const String& operationNa
me, const ScriptValue& callFrames); | 111 int traceAsyncOperationStarting(ExecutionContext*, const String& operationNa
me, const ScriptValue& callFrames); |
| 114 void traceAsyncOperationCompleted(ExecutionContext*, int operationId); | 112 void traceAsyncOperationCompleted(ExecutionContext*, int operationId); |
| 115 void traceAsyncCallbackStarting(ExecutionContext*, int operationId); | 113 void traceAsyncCallbackStarting(ExecutionContext*, int operationId); |
| 116 | 114 |
| 117 void didFireAsyncCall(); | 115 void didFireAsyncCall(); |
| 118 void clear(); | 116 void clear(); |
| 119 | 117 |
| 120 private: | 118 private: |
| 121 void willHandleXHREvent(XMLHttpRequest*, Event*); | 119 void willHandleXHREvent(XMLHttpRequest*, Event*); |
| 122 | 120 |
| 123 PassRefPtrWillBeRawPtr<AsyncCallChain> createAsyncCallChain(const String& de
scription, const ScriptValue& callFrames); | 121 PassRefPtr<AsyncCallChain> createAsyncCallChain(const String& description, c
onst ScriptValue& callFrames); |
| 124 void setCurrentAsyncCallChain(ExecutionContext*, PassRefPtrWillBeRawPtr<Asyn
cCallChain>); | 122 void setCurrentAsyncCallChain(ExecutionContext*, PassRefPtr<AsyncCallChain>)
; |
| 125 void clearCurrentAsyncCallChain(); | 123 void clearCurrentAsyncCallChain(); |
| 126 static void ensureMaxAsyncCallChainDepth(AsyncCallChain*, unsigned); | 124 static void ensureMaxAsyncCallChainDepth(AsyncCallChain*, unsigned); |
| 127 bool validateCallFrames(const ScriptValue& callFrames); | 125 bool validateCallFrames(const ScriptValue& callFrames); |
| 128 | 126 |
| 129 class ExecutionContextData; | 127 class ExecutionContextData; |
| 130 ExecutionContextData* createContextDataIfNeeded(ExecutionContext*); | 128 ExecutionContextData* createContextDataIfNeeded(ExecutionContext*); |
| 131 | 129 |
| 132 unsigned m_maxAsyncCallStackDepth; | 130 unsigned m_maxAsyncCallStackDepth; |
| 133 RefPtrWillBePersistent<AsyncCallChain> m_currentAsyncCallChain; | 131 RefPtr<AsyncCallChain> m_currentAsyncCallChain; |
| 134 unsigned m_nestedAsyncCallCount; | 132 unsigned m_nestedAsyncCallCount; |
| 135 typedef HashMap<ExecutionContext*, ExecutionContextData*> ExecutionContextDa
taMap; | 133 typedef HashMap<ExecutionContext*, ExecutionContextData*> ExecutionContextDa
taMap; |
| 136 ExecutionContextDataMap m_executionContextDataMap; | 134 ExecutionContextDataMap m_executionContextDataMap; |
| 137 }; | 135 }; |
| 138 | 136 |
| 139 } // namespace blink | 137 } // namespace blink |
| 140 | 138 |
| 141 #endif // !defined(AsyncCallStackTracker_h) | 139 #endif // !defined(AsyncCallStackTracker_h) |
| OLD | NEW |