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 26 matching lines...) Expand all Loading... |
37 #include "wtf/HashSet.h" | 37 #include "wtf/HashSet.h" |
38 #include "wtf/Noncopyable.h" | 38 #include "wtf/Noncopyable.h" |
39 #include "wtf/PassRefPtr.h" | 39 #include "wtf/PassRefPtr.h" |
40 #include "wtf/RefPtr.h" | 40 #include "wtf/RefPtr.h" |
41 | 41 |
42 namespace WebCore { | 42 namespace WebCore { |
43 | 43 |
44 class EventListener; | 44 class EventListener; |
45 class EventTarget; | 45 class EventTarget; |
46 class ExecutionContext; | 46 class ExecutionContext; |
| 47 class XMLHttpRequest; |
47 | 48 |
48 class AsyncCallStackTracker { | 49 class AsyncCallStackTracker { |
49 WTF_MAKE_NONCOPYABLE(AsyncCallStackTracker); | 50 WTF_MAKE_NONCOPYABLE(AsyncCallStackTracker); |
50 public: | 51 public: |
51 class AsyncCallStack : public RefCounted<AsyncCallStack> { | 52 class AsyncCallStack : public RefCounted<AsyncCallStack> { |
52 public: | 53 public: |
53 AsyncCallStack(const String&, const ScriptValue&); | 54 AsyncCallStack(const String&, const ScriptValue&); |
54 ~AsyncCallStack(); | 55 ~AsyncCallStack(); |
55 String description() const { return m_description; } | 56 String description() const { return m_description; } |
56 ScriptValue callFrames() const { return m_callFrames; } | 57 ScriptValue callFrames() const { return m_callFrames; } |
(...skipping 26 matching lines...) Expand all Loading... |
83 | 84 |
84 void didRequestAnimationFrame(ExecutionContext*, int callbackId, const Scrip
tValue& callFrames); | 85 void didRequestAnimationFrame(ExecutionContext*, int callbackId, const Scrip
tValue& callFrames); |
85 void didCancelAnimationFrame(ExecutionContext*, int callbackId); | 86 void didCancelAnimationFrame(ExecutionContext*, int callbackId); |
86 void willFireAnimationFrame(ExecutionContext*, int callbackId); | 87 void willFireAnimationFrame(ExecutionContext*, int callbackId); |
87 | 88 |
88 void didAddEventListener(EventTarget*, const AtomicString& eventType, EventL
istener*, bool useCapture, const ScriptValue& callFrames); | 89 void didAddEventListener(EventTarget*, const AtomicString& eventType, EventL
istener*, bool useCapture, const ScriptValue& callFrames); |
89 void didRemoveEventListener(EventTarget*, const AtomicString& eventType, Eve
ntListener*, bool useCapture); | 90 void didRemoveEventListener(EventTarget*, const AtomicString& eventType, Eve
ntListener*, bool useCapture); |
90 void didRemoveAllEventListeners(EventTarget*); | 91 void didRemoveAllEventListeners(EventTarget*); |
91 void willHandleEvent(EventTarget*, const AtomicString& eventType, EventListe
ner*, bool useCapture); | 92 void willHandleEvent(EventTarget*, const AtomicString& eventType, EventListe
ner*, bool useCapture); |
92 | 93 |
| 94 void willLoadXHR(XMLHttpRequest*, const ScriptValue& callFrames); |
| 95 |
93 void didFireAsyncCall(); | 96 void didFireAsyncCall(); |
94 void clear(); | 97 void clear(); |
95 | 98 |
96 private: | 99 private: |
| 100 void willHandleXHREvent(XMLHttpRequest*, EventTarget*, const AtomicString& e
ventType); |
| 101 |
97 PassRefPtr<AsyncCallChain> createAsyncCallChain(const String& description, c
onst ScriptValue& callFrames); | 102 PassRefPtr<AsyncCallChain> createAsyncCallChain(const String& description, c
onst ScriptValue& callFrames); |
98 void setCurrentAsyncCallChain(PassRefPtr<AsyncCallChain>); | 103 void setCurrentAsyncCallChain(PassRefPtr<AsyncCallChain>); |
| 104 void clearCurrentAsyncCallChain(); |
99 static void ensureMaxAsyncCallChainDepth(AsyncCallChain*, unsigned); | 105 static void ensureMaxAsyncCallChainDepth(AsyncCallChain*, unsigned); |
100 static bool validateCallFrames(const ScriptValue& callFrames); | 106 static bool validateCallFrames(const ScriptValue& callFrames); |
101 | 107 |
102 class ExecutionContextData; | 108 class ExecutionContextData; |
103 ExecutionContextData* createContextDataIfNeeded(ExecutionContext*); | 109 ExecutionContextData* createContextDataIfNeeded(ExecutionContext*); |
104 | 110 |
105 unsigned m_maxAsyncCallStackDepth; | 111 unsigned m_maxAsyncCallStackDepth; |
106 RefPtr<AsyncCallChain> m_currentAsyncCallChain; | 112 RefPtr<AsyncCallChain> m_currentAsyncCallChain; |
107 unsigned m_nestedAsyncCallCount; | 113 unsigned m_nestedAsyncCallCount; |
108 typedef HashMap<ExecutionContext*, ExecutionContextData*> ExecutionContextDa
taMap; | 114 typedef HashMap<ExecutionContext*, ExecutionContextData*> ExecutionContextDa
taMap; |
109 ExecutionContextDataMap m_executionContextDataMap; | 115 ExecutionContextDataMap m_executionContextDataMap; |
110 }; | 116 }; |
111 | 117 |
112 } // namespace WebCore | 118 } // namespace WebCore |
113 | 119 |
114 #endif // !defined(AsyncCallStackTracker_h) | 120 #endif // !defined(AsyncCallStackTracker_h) |
OLD | NEW |