| 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 ExecutionContextTask; | |
| 48 class MutationObserver; | 47 class MutationObserver; |
| 49 class XMLHttpRequest; | 48 class XMLHttpRequest; |
| 50 | 49 |
| 51 class AsyncCallStackTracker { | 50 class AsyncCallStackTracker { |
| 52 WTF_MAKE_NONCOPYABLE(AsyncCallStackTracker); | 51 WTF_MAKE_NONCOPYABLE(AsyncCallStackTracker); |
| 53 public: | 52 public: |
| 54 class AsyncCallStack : public RefCounted<AsyncCallStack> { | 53 class AsyncCallStack : public RefCounted<AsyncCallStack> { |
| 55 public: | 54 public: |
| 56 AsyncCallStack(const String&, const ScriptValue&); | 55 AsyncCallStack(const String&, const ScriptValue&); |
| 57 ~AsyncCallStack(); | 56 ~AsyncCallStack(); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 void didRemoveAllEventListeners(EventTarget*); | 92 void didRemoveAllEventListeners(EventTarget*); |
| 94 void willHandleEvent(EventTarget*, const AtomicString& eventType, EventListe
ner*, bool useCapture); | 93 void willHandleEvent(EventTarget*, const AtomicString& eventType, EventListe
ner*, bool useCapture); |
| 95 | 94 |
| 96 void willLoadXHR(XMLHttpRequest*, const ScriptValue& callFrames); | 95 void willLoadXHR(XMLHttpRequest*, const ScriptValue& callFrames); |
| 97 | 96 |
| 98 void didEnqueueMutationRecord(ExecutionContext*, MutationObserver*, const Sc
riptValue& callFrames); | 97 void didEnqueueMutationRecord(ExecutionContext*, MutationObserver*, const Sc
riptValue& callFrames); |
| 99 bool hasEnqueuedMutationRecord(ExecutionContext*, MutationObserver*); | 98 bool hasEnqueuedMutationRecord(ExecutionContext*, MutationObserver*); |
| 100 void didClearAllMutationRecords(ExecutionContext*, MutationObserver*); | 99 void didClearAllMutationRecords(ExecutionContext*, MutationObserver*); |
| 101 void willDeliverMutationRecords(ExecutionContext*, MutationObserver*); | 100 void willDeliverMutationRecords(ExecutionContext*, MutationObserver*); |
| 102 | 101 |
| 103 void didPostPromiseTask(ExecutionContext*, ExecutionContextTask*, bool isRes
olved, const ScriptValue& callFrames); | |
| 104 void willPerformPromiseTask(ExecutionContext*, ExecutionContextTask*); | |
| 105 | |
| 106 void didFireAsyncCall(); | 102 void didFireAsyncCall(); |
| 107 void clear(); | 103 void clear(); |
| 108 | 104 |
| 109 private: | 105 private: |
| 110 void willHandleXHREvent(XMLHttpRequest*, EventTarget*, const AtomicString& e
ventType); | 106 void willHandleXHREvent(XMLHttpRequest*, EventTarget*, const AtomicString& e
ventType); |
| 111 | 107 |
| 112 PassRefPtr<AsyncCallChain> createAsyncCallChain(const String& description, c
onst ScriptValue& callFrames); | 108 PassRefPtr<AsyncCallChain> createAsyncCallChain(const String& description, c
onst ScriptValue& callFrames); |
| 113 void setCurrentAsyncCallChain(PassRefPtr<AsyncCallChain>); | 109 void setCurrentAsyncCallChain(PassRefPtr<AsyncCallChain>); |
| 114 void clearCurrentAsyncCallChain(); | 110 void clearCurrentAsyncCallChain(); |
| 115 static void ensureMaxAsyncCallChainDepth(AsyncCallChain*, unsigned); | 111 static void ensureMaxAsyncCallChainDepth(AsyncCallChain*, unsigned); |
| 116 static bool validateCallFrames(const ScriptValue& callFrames); | 112 static bool validateCallFrames(const ScriptValue& callFrames); |
| 117 | 113 |
| 118 class ExecutionContextData; | 114 class ExecutionContextData; |
| 119 ExecutionContextData* createContextDataIfNeeded(ExecutionContext*); | 115 ExecutionContextData* createContextDataIfNeeded(ExecutionContext*); |
| 120 | 116 |
| 121 unsigned m_maxAsyncCallStackDepth; | 117 unsigned m_maxAsyncCallStackDepth; |
| 122 RefPtr<AsyncCallChain> m_currentAsyncCallChain; | 118 RefPtr<AsyncCallChain> m_currentAsyncCallChain; |
| 123 unsigned m_nestedAsyncCallCount; | 119 unsigned m_nestedAsyncCallCount; |
| 124 typedef HashMap<ExecutionContext*, ExecutionContextData*> ExecutionContextDa
taMap; | 120 typedef HashMap<ExecutionContext*, ExecutionContextData*> ExecutionContextDa
taMap; |
| 125 ExecutionContextDataMap m_executionContextDataMap; | 121 ExecutionContextDataMap m_executionContextDataMap; |
| 126 }; | 122 }; |
| 127 | 123 |
| 128 } // namespace WebCore | 124 } // namespace WebCore |
| 129 | 125 |
| 130 #endif // !defined(AsyncCallStackTracker_h) | 126 #endif // !defined(AsyncCallStackTracker_h) |
| OLD | NEW |