| 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 AsyncCallTracker_h | |
| 32 #define AsyncCallTracker_h | |
| 33 | |
| 34 #include "core/CoreExport.h" | |
| 35 #include "core/inspector/InstrumentingAgents.h" | |
| 36 #include "platform/heap/Handle.h" | |
| 37 #include "platform/v8_inspector/public/V8DebuggerAgent.h" | |
| 38 #include "wtf/Forward.h" | |
| 39 #include "wtf/HashMap.h" | |
| 40 #include "wtf/Noncopyable.h" | |
| 41 | |
| 42 namespace blink { | |
| 43 | |
| 44 class EncodedFormData; | |
| 45 class Event; | |
| 46 class EventListener; | |
| 47 class EventTarget; | |
| 48 class ExecutionContext; | |
| 49 class ExecutionContextTask; | |
| 50 class HTTPHeaderMap; | |
| 51 class KURL; | |
| 52 class MutationObserver; | |
| 53 class ThreadableLoaderClient; | |
| 54 class XMLHttpRequest; | |
| 55 | |
| 56 class CORE_EXPORT AsyncCallTracker final : public GarbageCollectedFinalized<Asyn
cCallTracker> { | |
| 57 WTF_MAKE_NONCOPYABLE(AsyncCallTracker); | |
| 58 public: | |
| 59 AsyncCallTracker(V8DebuggerAgent*, InstrumentingAgents*); | |
| 60 ~AsyncCallTracker(); | |
| 61 | |
| 62 void asyncCallTrackingStateChanged(bool tracking); | |
| 63 void resetAsyncOperations(); | |
| 64 | |
| 65 void didInstallTimer(ExecutionContext*, int timerId, int timeout, bool singl
eShot); | |
| 66 void didRemoveTimer(ExecutionContext*, int timerId); | |
| 67 bool willFireTimer(ExecutionContext*, int timerId); | |
| 68 void didFireTimer() { didFireAsyncCall(); } | |
| 69 | |
| 70 void didRequestAnimationFrame(ExecutionContext*, int callbackId); | |
| 71 void didCancelAnimationFrame(ExecutionContext*, int callbackId); | |
| 72 bool willFireAnimationFrame(ExecutionContext*, int callbackId); | |
| 73 void didFireAnimationFrame() { didFireAsyncCall(); } | |
| 74 | |
| 75 void didEnqueueEvent(EventTarget*, Event*); | |
| 76 void didRemoveEvent(EventTarget*, Event*); | |
| 77 void willHandleEvent(EventTarget*, Event*, EventListener*, bool useCapture); | |
| 78 void didHandleEvent() { didFireAsyncCall(); } | |
| 79 | |
| 80 void willLoadXHR(XMLHttpRequest*, ThreadableLoaderClient*, const AtomicStrin
g& method, const KURL&, bool async, PassRefPtr<EncodedFormData> body, const HTTP
HeaderMap& headers, bool includeCrendentials); | |
| 81 void didDispatchXHRLoadendEvent(XMLHttpRequest*); | |
| 82 | |
| 83 void didEnqueueMutationRecord(ExecutionContext*, MutationObserver*); | |
| 84 void didClearAllMutationRecords(ExecutionContext*, MutationObserver*); | |
| 85 void willDeliverMutationRecords(ExecutionContext*, MutationObserver*); | |
| 86 void didDeliverMutationRecords() { didFireAsyncCall(); } | |
| 87 | |
| 88 void didPostExecutionContextTask(ExecutionContext*, ExecutionContextTask*); | |
| 89 void didKillAllExecutionContextTasks(ExecutionContext*); | |
| 90 void willPerformExecutionContextTask(ExecutionContext*, ExecutionContextTask
*); | |
| 91 void didPerformExecutionContextTask() { didFireAsyncCall(); } | |
| 92 | |
| 93 int traceAsyncOperationStarting(ExecutionContext*, const String& operationNa
me, int prevOperationId = 0); | |
| 94 void traceAsyncOperationCompleted(ExecutionContext*, int operationId); | |
| 95 void traceAsyncOperationCompletedCallbackStarting(ExecutionContext*, int ope
rationId); | |
| 96 void traceAsyncCallbackStarting(ExecutionContext*, int operationId); | |
| 97 void traceAsyncCallbackCompleted() { didFireAsyncCall(); } | |
| 98 | |
| 99 DECLARE_VIRTUAL_TRACE(); | |
| 100 | |
| 101 class ExecutionContextData; | |
| 102 | |
| 103 private: | |
| 104 void willHandleXHREvent(XMLHttpRequest*, Event*); | |
| 105 | |
| 106 bool isKnownAsyncOperationId(ExecutionContext*, int operationId) const; | |
| 107 void willFireAsyncCall(int operationId); | |
| 108 void didFireAsyncCall(); | |
| 109 | |
| 110 ExecutionContextData* createContextDataIfNeeded(ExecutionContext*); | |
| 111 | |
| 112 using ExecutionContextDataMap = HeapHashMap<Member<ExecutionContext>, Member
<ExecutionContextData>>; | |
| 113 ExecutionContextDataMap m_executionContextDataMap; | |
| 114 V8DebuggerAgent* m_debuggerAgent; | |
| 115 Member<InstrumentingAgents> m_instrumentingAgents; | |
| 116 }; | |
| 117 | |
| 118 } // namespace blink | |
| 119 | |
| 120 #endif // AsyncCallTracker_h | |
| OLD | NEW |