OLD | NEW |
---|---|
(Empty) | |
1 /* | |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | |
3 * | |
4 * Redistribution and use in source and binary forms, with or without | |
5 * modification, are permitted provided that the following conditions are | |
6 * met: | |
7 * | |
8 * * Redistributions of source code must retain the above copyright | |
9 * notice, this list of conditions and the following disclaimer. | |
10 * * Redistributions in binary form must reproduce the above | |
11 * copyright notice, this list of conditions and the following disclaimer | |
12 * in the documentation and/or other materials provided with the | |
13 * distribution. | |
14 * * Neither the name of Google Inc. nor the names of its | |
15 * contributors may be used to endorse or promote products derived from | |
16 * this software without specific prior written permission. | |
17 * | |
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | |
22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
29 */ | |
30 | |
31 #ifndef AsyncCallStackTracker_h | |
32 #define AsyncCallStackTracker_h | |
33 | |
34 #include "bindings/v8/ScriptValue.h" | |
35 #include "wtf/Deque.h" | |
36 #include "wtf/FastAllocBase.h" | |
37 #include "wtf/HashMap.h" | |
38 #include "wtf/HashSet.h" | |
39 #include "wtf/Noncopyable.h" | |
40 #include "wtf/PassRefPtr.h" | |
41 #include "wtf/RefPtr.h" | |
42 | |
43 namespace WebCore { | |
44 | |
45 class AsyncCallStackTracker { | |
46 WTF_MAKE_NONCOPYABLE(AsyncCallStackTracker); WTF_MAKE_FAST_ALLOCATED; | |
yurys
2013/12/03 13:41:08
Why does it need to be marked as WTF_MAKE_FAST_ALL
aandrey
2013/12/04 12:45:47
removed
| |
47 private: | |
48 struct AsyncCallStack : public RefCounted<AsyncCallStack> { | |
yurys
2013/12/03 13:41:08
You can leave only forward declaration of the stru
aandrey
2013/12/04 12:45:47
its became part of public API
| |
49 AsyncCallStack(); | |
50 ~AsyncCallStack(); | |
51 ScriptValue m_callFrames; | |
52 }; | |
53 | |
54 typedef Deque<RefPtr<AsyncCallStack>, 4> AsyncCallStackVector; | |
55 | |
56 struct AsyncCallTrace : public RefCounted<AsyncCallTrace> { | |
yurys
2013/12/03 13:41:08
Maybe AsyncCallStackChain or AsyncCallChain?
aandrey
2013/12/04 12:45:47
renamed to AsyncCallChain
| |
57 AsyncCallTrace() { } | |
58 AsyncCallTrace(const AsyncCallTrace& t) : m_callStacks(t.m_callStacks) { } | |
59 AsyncCallStackVector m_callStacks; | |
60 }; | |
61 | |
62 public: | |
63 class AsyncCallTraceIterator { | |
64 public: | |
65 bool hasNext() const; | |
66 ScriptValue next(); | |
67 | |
68 private: | |
69 friend class AsyncCallStackTracker; | |
70 AsyncCallTraceIterator() { } | |
71 AsyncCallTraceIterator(const AsyncCallTrace& t) : m_callStacks(t.m_callS tacks) { } | |
yurys
2013/12/03 13:41:08
How is this iterator going to be used? Wouldn't it
aandrey
2013/12/04 12:45:47
Done.
| |
72 AsyncCallStackVector m_callStacks; | |
73 }; | |
74 | |
75 AsyncCallStackTracker(); | |
76 | |
77 inline bool isEnabled() const { return m_maxAsyncCallStackDepth; } | |
yurys
2013/12/03 13:41:08
Please remove 'inline' as it doesn't add anything.
aandrey
2013/12/04 12:45:47
Done.
| |
78 void setAsyncCallStackDepth(int); | |
79 AsyncCallTraceIterator currentAsyncCallStack(); | |
80 | |
81 void didInstallTimer(int timerId, bool singleShot); | |
82 void didRemoveTimer(int timerId); | |
83 void willFireTimer(int timerId); | |
84 | |
85 void didRequestAnimationFrame(int callbackId); | |
86 void didCancelAnimationFrame(int callbackId); | |
87 void willFireAnimationFrame(int callbackId); | |
88 | |
89 void didAsyncCall(); | |
90 void didRequestAsyncCallFrames(ScriptValue callFrames); | |
yurys
2013/12/03 13:41:08
setCurrentCallStack ?
| |
91 | |
92 void clear(); | |
93 | |
94 private: | |
95 PassRefPtr<AsyncCallTrace> createAsyncCallTrace(); | |
96 static void ensureMaxAsyncCallTraceDepth(AsyncCallTrace*, unsigned); | |
97 | |
98 unsigned m_maxAsyncCallStackDepth; | |
99 RefPtr<AsyncCallStack> m_requestedAsyncCallStack; | |
100 RefPtr<AsyncCallTrace> m_currentAsyncCallTrace; | |
101 HashSet<int> m_intervalTimerIds; | |
102 HashMap<int, RefPtr<AsyncCallTrace> > m_timerCallTraces; | |
103 HashMap<int, RefPtr<AsyncCallTrace> > m_animationFrameCallTraces; | |
104 }; | |
105 | |
106 } // namespace WebCore | |
107 | |
108 #endif // !defined(AsyncCallStackTracker_h) | |
OLD | NEW |