| 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 class EventTarget; | 47 class EventTarget; |
| 48 class ExecutionContext; | 48 class ExecutionContext; |
| 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 : public RefCounted<AsyncCallStack> { |
| 56 public: | 56 public: |
| 57 AsyncCallStack(const String&, const StackTrace&); | 57 AsyncCallStack(const String&, const StackTraces&); |
| 58 ~AsyncCallStack(); | 58 ~AsyncCallStack(); |
| 59 String description() const { return m_description; } | 59 String description() const { return m_description; } |
| 60 StackTrace callFrames() const { return m_callFrames; } | 60 StackTraces callFrames() const { return m_callFrames; } |
| 61 private: | 61 private: |
| 62 String m_description; | 62 String m_description; |
| 63 StackTrace m_callFrames; | 63 StackTraces m_callFrames; |
| 64 }; | 64 }; |
| 65 | 65 |
| 66 typedef Deque<RefPtr<AsyncCallStack>, 4> AsyncCallStackVector; | 66 typedef Deque<RefPtr<AsyncCallStack>, 4> AsyncCallStackVector; |
| 67 | 67 |
| 68 class AsyncCallChain : public RefCounted<AsyncCallChain> { | 68 class AsyncCallChain : public RefCounted<AsyncCallChain> { |
| 69 public: | 69 public: |
| 70 AsyncCallChain() { } | 70 AsyncCallChain() { } |
| 71 AsyncCallChain(const AsyncCallChain& t) : m_callStacks(t.m_callStacks) {
} | 71 AsyncCallChain(const AsyncCallChain& t) : m_callStacks(t.m_callStacks) {
} |
| 72 AsyncCallStackVector callStacks() const { return m_callStacks; } | 72 AsyncCallStackVector callStacks() const { return m_callStacks; } |
| 73 private: | 73 private: |
| 74 friend class AsyncCallStackTracker; | 74 friend class AsyncCallStackTracker; |
| 75 AsyncCallStackVector m_callStacks; | 75 AsyncCallStackVector m_callStacks; |
| 76 }; | 76 }; |
| 77 | 77 |
| 78 AsyncCallStackTracker(); | 78 AsyncCallStackTracker(); |
| 79 | 79 |
| 80 bool isEnabled() const { return m_maxAsyncCallStackDepth; } | 80 bool isEnabled() const { return m_maxAsyncCallStackDepth; } |
| 81 void setAsyncCallStackDepth(int); | 81 void setAsyncCallStackDepth(int); |
| 82 const AsyncCallChain* currentAsyncCallChain() const; | 82 const AsyncCallChain* currentAsyncCallChain() const; |
| 83 | 83 |
| 84 void didInstallTimer(ExecutionContext*, int timerId, bool singleShot, const
StackTrace& callFrames); | 84 void didInstallTimer(ExecutionContext*, int timerId, bool singleShot, const
StackTraces& callFrames); |
| 85 void didRemoveTimer(ExecutionContext*, int timerId); | 85 void didRemoveTimer(ExecutionContext*, int timerId); |
| 86 void willFireTimer(ExecutionContext*, int timerId); | 86 void willFireTimer(ExecutionContext*, int timerId); |
| 87 | 87 |
| 88 void didRequestAnimationFrame(ExecutionContext*, int callbackId, const Stack
Trace& callFrames); | 88 void didRequestAnimationFrame(ExecutionContext*, int callbackId, const Stack
Traces& callFrames); |
| 89 void didCancelAnimationFrame(ExecutionContext*, int callbackId); | 89 void didCancelAnimationFrame(ExecutionContext*, int callbackId); |
| 90 void willFireAnimationFrame(ExecutionContext*, int callbackId); | 90 void willFireAnimationFrame(ExecutionContext*, int callbackId); |
| 91 | 91 |
| 92 void didEnqueueEvent(EventTarget*, Event*, const StackTrace& callFrames); | 92 void didEnqueueEvent(EventTarget*, Event*, const StackTraces& callFrames); |
| 93 void didRemoveEvent(EventTarget*, Event*); | 93 void didRemoveEvent(EventTarget*, Event*); |
| 94 void willHandleEvent(EventTarget*, Event*, EventListener*, bool useCapture); | 94 void willHandleEvent(EventTarget*, Event*, EventListener*, bool useCapture); |
| 95 void willLoadXHR(XMLHttpRequest*, const StackTrace& callFrames); | 95 void willLoadXHR(XMLHttpRequest*, const StackTraces& callFrames); |
| 96 | 96 |
| 97 void didEnqueueMutationRecord(ExecutionContext*, MutationObserver*, const St
ackTrace& callFrames); | 97 void didEnqueueMutationRecord(ExecutionContext*, MutationObserver*, const St
ackTraces& callFrames); |
| 98 bool hasEnqueuedMutationRecord(ExecutionContext*, MutationObserver*); | 98 bool hasEnqueuedMutationRecord(ExecutionContext*, MutationObserver*); |
| 99 void didClearAllMutationRecords(ExecutionContext*, MutationObserver*); | 99 void didClearAllMutationRecords(ExecutionContext*, MutationObserver*); |
| 100 void willDeliverMutationRecords(ExecutionContext*, MutationObserver*); | 100 void willDeliverMutationRecords(ExecutionContext*, MutationObserver*); |
| 101 | 101 |
| 102 void didFireAsyncCall(); | 102 void didFireAsyncCall(); |
| 103 void clear(); | 103 void clear(); |
| 104 | 104 |
| 105 private: | 105 private: |
| 106 void willHandleXHREvent(XMLHttpRequest*, EventTarget*, Event*); | 106 void willHandleXHREvent(XMLHttpRequest*, EventTarget*, Event*); |
| 107 | 107 |
| 108 PassRefPtr<AsyncCallChain> createAsyncCallChain(const String& description, c
onst StackTrace& callFrames); | 108 PassRefPtr<AsyncCallChain> createAsyncCallChain(const String& description, c
onst StackTraces& callFrames); |
| 109 void setCurrentAsyncCallChain(PassRefPtr<AsyncCallChain>); | 109 void setCurrentAsyncCallChain(PassRefPtr<AsyncCallChain>); |
| 110 void clearCurrentAsyncCallChain(); | 110 void clearCurrentAsyncCallChain(); |
| 111 static void ensureMaxAsyncCallChainDepth(AsyncCallChain*, unsigned); | 111 static void ensureMaxAsyncCallChainDepth(AsyncCallChain*, unsigned); |
| 112 static bool validateCallFrames(const StackTrace& callFrames); | 112 static bool validateCallFrames(const StackTraces& callFrames); |
| 113 | 113 |
| 114 class ExecutionContextData; | 114 class ExecutionContextData; |
| 115 ExecutionContextData* createContextDataIfNeeded(ExecutionContext*); | 115 ExecutionContextData* createContextDataIfNeeded(ExecutionContext*); |
| 116 | 116 |
| 117 unsigned m_maxAsyncCallStackDepth; | 117 unsigned m_maxAsyncCallStackDepth; |
| 118 RefPtr<AsyncCallChain> m_currentAsyncCallChain; | 118 RefPtr<AsyncCallChain> m_currentAsyncCallChain; |
| 119 unsigned m_nestedAsyncCallCount; | 119 unsigned m_nestedAsyncCallCount; |
| 120 typedef HashMap<ExecutionContext*, ExecutionContextData*> ExecutionContextDa
taMap; | 120 typedef HashMap<ExecutionContext*, ExecutionContextData*> ExecutionContextDa
taMap; |
| 121 ExecutionContextDataMap m_executionContextDataMap; | 121 ExecutionContextDataMap m_executionContextDataMap; |
| 122 }; | 122 }; |
| 123 | 123 |
| 124 } // namespace WebCore | 124 } // namespace WebCore |
| 125 | 125 |
| 126 #endif // !defined(AsyncCallStackTracker_h) | 126 #endif // !defined(AsyncCallStackTracker_h) |
| OLD | NEW |