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 23 matching lines...) Expand all Loading... | |
34 #include "bindings/v8/ScriptValue.h" | 34 #include "bindings/v8/ScriptValue.h" |
35 #include "wtf/Deque.h" | 35 #include "wtf/Deque.h" |
36 #include "wtf/HashMap.h" | 36 #include "wtf/HashMap.h" |
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 ExecutionContext; | |
45 | |
44 class AsyncCallStackTracker { | 46 class AsyncCallStackTracker { |
45 WTF_MAKE_NONCOPYABLE(AsyncCallStackTracker); | 47 WTF_MAKE_NONCOPYABLE(AsyncCallStackTracker); |
46 public: | 48 public: |
47 class AsyncCallStack : public RefCounted<AsyncCallStack> { | 49 class AsyncCallStack : public RefCounted<AsyncCallStack> { |
48 public: | 50 public: |
49 AsyncCallStack(const ScriptValue&); | 51 AsyncCallStack(const ScriptValue&); |
50 ~AsyncCallStack(); | 52 ~AsyncCallStack(); |
51 ScriptValue callFrames() const { return m_callFrames; } | 53 ScriptValue callFrames() const { return m_callFrames; } |
52 private: | 54 private: |
53 ScriptValue m_callFrames; | 55 ScriptValue m_callFrames; |
(...skipping 10 matching lines...) Expand all Loading... | |
64 friend class AsyncCallStackTracker; | 66 friend class AsyncCallStackTracker; |
65 AsyncCallStackVector m_callStacks; | 67 AsyncCallStackVector m_callStacks; |
66 }; | 68 }; |
67 | 69 |
68 AsyncCallStackTracker(); | 70 AsyncCallStackTracker(); |
69 | 71 |
70 bool isEnabled() const { return m_maxAsyncCallStackDepth; } | 72 bool isEnabled() const { return m_maxAsyncCallStackDepth; } |
71 void setAsyncCallStackDepth(int); | 73 void setAsyncCallStackDepth(int); |
72 const AsyncCallChain* currentAsyncCallChain() const; | 74 const AsyncCallChain* currentAsyncCallChain() const; |
73 | 75 |
74 void didInstallTimer(int timerId, bool singleShot, const ScriptValue& callFr ames); | 76 void didInstallTimer(ExecutionContext*, int timerId, bool singleShot, const ScriptValue& callFrames); |
pfeldman
2013/12/10 15:31:34
Glancing at this suggests that there should be sta
| |
75 void didRemoveTimer(int timerId); | 77 void didRemoveTimer(ExecutionContext*, int timerId); |
76 void willFireTimer(int timerId); | 78 void willFireTimer(ExecutionContext*, int timerId); |
77 | 79 |
78 void didRequestAnimationFrame(int callbackId, const ScriptValue& callFrames) ; | 80 void didRequestAnimationFrame(ExecutionContext*, int callbackId, const Scrip tValue& callFrames); |
79 void didCancelAnimationFrame(int callbackId); | 81 void didCancelAnimationFrame(ExecutionContext*, int callbackId); |
80 void willFireAnimationFrame(int callbackId); | 82 void willFireAnimationFrame(ExecutionContext*, int callbackId); |
81 | 83 |
82 void didFireAsyncCall(); | 84 void didFireAsyncCall(); |
83 void clear(); | 85 void clear(); |
84 | 86 |
85 private: | 87 private: |
86 PassRefPtr<AsyncCallChain> createAsyncCallChain(const ScriptValue& callFrame s); | 88 PassRefPtr<AsyncCallChain> createAsyncCallChain(const ScriptValue& callFrame s); |
87 static void ensureMaxAsyncCallChainDepth(AsyncCallChain*, unsigned); | 89 static void ensureMaxAsyncCallChainDepth(AsyncCallChain*, unsigned); |
88 static bool validateCallFrames(const ScriptValue& callFrames); | 90 static bool validateCallFrames(const ScriptValue& callFrames); |
89 | 91 |
92 class ExecutionContextData; | |
93 void contextDestroyed(ExecutionContext*); | |
94 ExecutionContextData* createContextDataIfNeeded(ExecutionContext*); | |
95 | |
90 unsigned m_maxAsyncCallStackDepth; | 96 unsigned m_maxAsyncCallStackDepth; |
91 RefPtr<AsyncCallChain> m_currentAsyncCallChain; | 97 RefPtr<AsyncCallChain> m_currentAsyncCallChain; |
92 HashSet<int> m_intervalTimerIds; | 98 HashMap<ExecutionContext*, ExecutionContextData*> m_executionContextDataMap; |
93 HashMap<int, RefPtr<AsyncCallChain> > m_timerCallChains; | |
94 HashMap<int, RefPtr<AsyncCallChain> > m_animationFrameCallChains; | |
95 }; | 99 }; |
96 | 100 |
97 } // namespace WebCore | 101 } // namespace WebCore |
98 | 102 |
99 #endif // !defined(AsyncCallStackTracker_h) | 103 #endif // !defined(AsyncCallStackTracker_h) |
OLD | NEW |