| 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 EventListener; |
| 45 class EventTarget; |
| 44 class ExecutionContext; | 46 class ExecutionContext; |
| 45 | 47 |
| 46 class AsyncCallStackTracker { | 48 class AsyncCallStackTracker { |
| 47 WTF_MAKE_NONCOPYABLE(AsyncCallStackTracker); | 49 WTF_MAKE_NONCOPYABLE(AsyncCallStackTracker); |
| 48 public: | 50 public: |
| 49 class AsyncCallStack : public RefCounted<AsyncCallStack> { | 51 class AsyncCallStack : public RefCounted<AsyncCallStack> { |
| 50 public: | 52 public: |
| 51 AsyncCallStack(const String&, const ScriptValue&); | 53 AsyncCallStack(const String&, const ScriptValue&); |
| 52 ~AsyncCallStack(); | 54 ~AsyncCallStack(); |
| 53 String description() const { return m_description; } | 55 String description() const { return m_description; } |
| (...skipping 22 matching lines...) Expand all Loading... |
| 76 const AsyncCallChain* currentAsyncCallChain() const; | 78 const AsyncCallChain* currentAsyncCallChain() const; |
| 77 | 79 |
| 78 void didInstallTimer(ExecutionContext*, int timerId, bool singleShot, const
ScriptValue& callFrames); | 80 void didInstallTimer(ExecutionContext*, int timerId, bool singleShot, const
ScriptValue& callFrames); |
| 79 void didRemoveTimer(ExecutionContext*, int timerId); | 81 void didRemoveTimer(ExecutionContext*, int timerId); |
| 80 void willFireTimer(ExecutionContext*, int timerId); | 82 void willFireTimer(ExecutionContext*, int timerId); |
| 81 | 83 |
| 82 void didRequestAnimationFrame(ExecutionContext*, int callbackId, const Scrip
tValue& callFrames); | 84 void didRequestAnimationFrame(ExecutionContext*, int callbackId, const Scrip
tValue& callFrames); |
| 83 void didCancelAnimationFrame(ExecutionContext*, int callbackId); | 85 void didCancelAnimationFrame(ExecutionContext*, int callbackId); |
| 84 void willFireAnimationFrame(ExecutionContext*, int callbackId); | 86 void willFireAnimationFrame(ExecutionContext*, int callbackId); |
| 85 | 87 |
| 88 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 didRemoveAllEventListeners(EventTarget*); |
| 91 void willHandleEvent(EventTarget*, const AtomicString& eventType, EventListe
ner*, bool useCapture); |
| 92 |
| 86 void didFireAsyncCall(); | 93 void didFireAsyncCall(); |
| 87 void clear(); | 94 void clear(); |
| 88 | 95 |
| 89 private: | 96 private: |
| 90 PassRefPtr<AsyncCallChain> createAsyncCallChain(const String& description, c
onst ScriptValue& callFrames); | 97 PassRefPtr<AsyncCallChain> createAsyncCallChain(const String& description, c
onst ScriptValue& callFrames); |
| 98 void setCurrentAsyncCallChain(PassRefPtr<AsyncCallChain>); |
| 91 static void ensureMaxAsyncCallChainDepth(AsyncCallChain*, unsigned); | 99 static void ensureMaxAsyncCallChainDepth(AsyncCallChain*, unsigned); |
| 92 static bool validateCallFrames(const ScriptValue& callFrames); | 100 static bool validateCallFrames(const ScriptValue& callFrames); |
| 93 | 101 |
| 94 class ExecutionContextData; | 102 class ExecutionContextData; |
| 95 ExecutionContextData* createContextDataIfNeeded(ExecutionContext*); | 103 ExecutionContextData* createContextDataIfNeeded(ExecutionContext*); |
| 96 | 104 |
| 97 unsigned m_maxAsyncCallStackDepth; | 105 unsigned m_maxAsyncCallStackDepth; |
| 98 RefPtr<AsyncCallChain> m_currentAsyncCallChain; | 106 RefPtr<AsyncCallChain> m_currentAsyncCallChain; |
| 107 unsigned m_nestedAsyncCallCount; |
| 99 typedef HashMap<ExecutionContext*, ExecutionContextData*> ExecutionContextDa
taMap; | 108 typedef HashMap<ExecutionContext*, ExecutionContextData*> ExecutionContextDa
taMap; |
| 100 ExecutionContextDataMap m_executionContextDataMap; | 109 ExecutionContextDataMap m_executionContextDataMap; |
| 101 }; | 110 }; |
| 102 | 111 |
| 103 } // namespace WebCore | 112 } // namespace WebCore |
| 104 | 113 |
| 105 #endif // !defined(AsyncCallStackTracker_h) | 114 #endif // !defined(AsyncCallStackTracker_h) |
| OLD | NEW |