| 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 static const char setTimeoutName[] = "setTimeout"; | 47 static const char setTimeoutName[] = "setTimeout"; |
| 48 static const char setIntervalName[] = "setInterval"; | 48 static const char setIntervalName[] = "setInterval"; |
| 49 static const char requestAnimationFrameName[] = "requestAnimationFrame"; | 49 static const char requestAnimationFrameName[] = "requestAnimationFrame"; |
| 50 static const char xhrSendName[] = "XMLHttpRequest.send"; | 50 static const char xhrSendName[] = "XMLHttpRequest.send"; |
| 51 static const char enqueueMutationRecordName[] = "Mutation"; | 51 static const char enqueueMutationRecordName[] = "Mutation"; |
| 52 | 52 |
| 53 } | 53 } |
| 54 | 54 |
| 55 namespace blink { | 55 namespace blink { |
| 56 | 56 |
| 57 class AsyncCallTracker::ExecutionContextData final : public NoBaseWillBeGarbageC
ollectedFinalized<ExecutionContextData>, public ContextLifecycleObserver { | 57 class AsyncCallTracker::ExecutionContextData final : public GarbageCollectedFina
lized<ExecutionContextData>, public ContextLifecycleObserver { |
| 58 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(AsyncCallTracker::ExecutionContextData
); | 58 USING_GARBAGE_COLLECTED_MIXIN(AsyncCallTracker::ExecutionContextData); |
| 59 USING_FAST_MALLOC_WILL_BE_REMOVED(AsyncCallTracker::ExecutionContextData); | |
| 60 public: | 59 public: |
| 61 ExecutionContextData(AsyncCallTracker* tracker, ExecutionContext* executionC
ontext) | 60 ExecutionContextData(AsyncCallTracker* tracker, ExecutionContext* executionC
ontext) |
| 62 : ContextLifecycleObserver(executionContext) | 61 : ContextLifecycleObserver(executionContext) |
| 63 , m_tracker(tracker) | 62 , m_tracker(tracker) |
| 64 , m_timerCallChains(tracker->m_debuggerAgent) | 63 , m_timerCallChains(tracker->m_debuggerAgent) |
| 65 , m_animationFrameCallChains(tracker->m_debuggerAgent) | 64 , m_animationFrameCallChains(tracker->m_debuggerAgent) |
| 66 , m_eventCallChains(tracker->m_debuggerAgent) | 65 , m_eventCallChains(tracker->m_debuggerAgent) |
| 67 , m_xhrCallChains(tracker->m_debuggerAgent) | 66 , m_xhrCallChains(tracker->m_debuggerAgent) |
| 68 , m_mutationObserverCallChains(tracker->m_debuggerAgent) | 67 , m_mutationObserverCallChains(tracker->m_debuggerAgent) |
| 69 , m_executionContextTaskCallChains(tracker->m_debuggerAgent) | 68 , m_executionContextTaskCallChains(tracker->m_debuggerAgent) |
| 70 , m_asyncOperations(tracker->m_debuggerAgent) | 69 , m_asyncOperations(tracker->m_debuggerAgent) |
| 71 { | 70 { |
| 72 } | 71 } |
| 73 | 72 |
| 74 void contextDestroyed() override | 73 void contextDestroyed() override |
| 75 { | 74 { |
| 76 ASSERT(getExecutionContext()); | 75 ASSERT(getExecutionContext()); |
| 77 OwnPtrWillBeRawPtr<ExecutionContextData> self = m_tracker->m_executionCo
ntextDataMap.take(getExecutionContext()); | 76 RawPtr<ExecutionContextData> self = m_tracker->m_executionContextDataMap
.take(getExecutionContext()); |
| 78 ASSERT_UNUSED(self, self == this); | 77 ASSERT_UNUSED(self, self == this); |
| 79 ContextLifecycleObserver::contextDestroyed(); | 78 ContextLifecycleObserver::contextDestroyed(); |
| 80 disposeCallChains(); | 79 disposeCallChains(); |
| 81 } | 80 } |
| 82 | 81 |
| 83 void unobserve() | 82 void unobserve() |
| 84 { | 83 { |
| 85 disposeCallChains(); | 84 disposeCallChains(); |
| 86 ContextLifecycleObserver::clearContext(); | 85 ContextLifecycleObserver::clearContext(); |
| 87 } | 86 } |
| 88 | 87 |
| 89 DEFINE_INLINE_VIRTUAL_TRACE() | 88 DEFINE_INLINE_VIRTUAL_TRACE() |
| 90 { | 89 { |
| 91 visitor->trace(m_tracker); | 90 visitor->trace(m_tracker); |
| 92 #if ENABLE(OILPAN) | 91 #if ENABLE(OILPAN) |
| 93 visitor->trace(m_timerCallChains); | 92 visitor->trace(m_timerCallChains); |
| 94 visitor->trace(m_animationFrameCallChains); | 93 visitor->trace(m_animationFrameCallChains); |
| 95 visitor->trace(m_eventCallChains); | 94 visitor->trace(m_eventCallChains); |
| 96 visitor->trace(m_xhrCallChains); | 95 visitor->trace(m_xhrCallChains); |
| 97 visitor->trace(m_mutationObserverCallChains); | 96 visitor->trace(m_mutationObserverCallChains); |
| 98 visitor->trace(m_executionContextTaskCallChains); | 97 visitor->trace(m_executionContextTaskCallChains); |
| 99 visitor->trace(m_asyncOperations); | 98 visitor->trace(m_asyncOperations); |
| 100 #endif | 99 #endif |
| 101 ContextLifecycleObserver::trace(visitor); | 100 ContextLifecycleObserver::trace(visitor); |
| 102 } | 101 } |
| 103 | 102 |
| 104 RawPtrWillBeMember<AsyncCallTracker> m_tracker; | 103 Member<AsyncCallTracker> m_tracker; |
| 105 HashSet<int> m_intervalTimerIds; | 104 HashSet<int> m_intervalTimerIds; |
| 106 AsyncOperationMap<int> m_timerCallChains; | 105 AsyncOperationMap<int> m_timerCallChains; |
| 107 AsyncOperationMap<int> m_animationFrameCallChains; | 106 AsyncOperationMap<int> m_animationFrameCallChains; |
| 108 AsyncOperationMap<RawPtrWillBeMember<Event>> m_eventCallChains; | 107 AsyncOperationMap<Member<Event>> m_eventCallChains; |
| 109 AsyncOperationMap<RawPtrWillBeMember<EventTarget>> m_xhrCallChains; | 108 AsyncOperationMap<Member<EventTarget>> m_xhrCallChains; |
| 110 AsyncOperationMap<RawPtrWillBeMember<MutationObserver>> m_mutationObserverCa
llChains; | 109 AsyncOperationMap<Member<MutationObserver>> m_mutationObserverCallChains; |
| 111 AsyncOperationMap<ExecutionContextTask*> m_executionContextTaskCallChains; | 110 AsyncOperationMap<ExecutionContextTask*> m_executionContextTaskCallChains; |
| 112 AsyncOperationMap<int> m_asyncOperations; | 111 AsyncOperationMap<int> m_asyncOperations; |
| 113 | 112 |
| 114 private: | 113 private: |
| 115 void disposeCallChains() | 114 void disposeCallChains() |
| 116 { | 115 { |
| 117 m_timerCallChains.dispose(); | 116 m_timerCallChains.dispose(); |
| 118 m_animationFrameCallChains.dispose(); | 117 m_animationFrameCallChains.dispose(); |
| 119 m_eventCallChains.dispose(); | 118 m_eventCallChains.dispose(); |
| 120 m_xhrCallChains.dispose(); | 119 m_xhrCallChains.dispose(); |
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 409 | 408 |
| 410 void AsyncCallTracker::willFireAsyncCall(int operationId) | 409 void AsyncCallTracker::willFireAsyncCall(int operationId) |
| 411 { | 410 { |
| 412 m_debuggerAgent->traceAsyncCallbackStarting(operationId); | 411 m_debuggerAgent->traceAsyncCallbackStarting(operationId); |
| 413 } | 412 } |
| 414 | 413 |
| 415 AsyncCallTracker::ExecutionContextData* AsyncCallTracker::createContextDataIfNee
ded(ExecutionContext* context) | 414 AsyncCallTracker::ExecutionContextData* AsyncCallTracker::createContextDataIfNee
ded(ExecutionContext* context) |
| 416 { | 415 { |
| 417 ExecutionContextData* data = m_executionContextDataMap.get(context); | 416 ExecutionContextData* data = m_executionContextDataMap.get(context); |
| 418 if (!data) { | 417 if (!data) { |
| 419 data = m_executionContextDataMap.set(context, adoptPtrWillBeNoop(new Asy
ncCallTracker::ExecutionContextData(this, context))) | 418 data = m_executionContextDataMap.set(context, new AsyncCallTracker::Exec
utionContextData(this, context)) |
| 420 .storedValue->value.get(); | 419 .storedValue->value.get(); |
| 421 } | 420 } |
| 422 return data; | 421 return data; |
| 423 } | 422 } |
| 424 | 423 |
| 425 DEFINE_TRACE(AsyncCallTracker) | 424 DEFINE_TRACE(AsyncCallTracker) |
| 426 { | 425 { |
| 427 #if ENABLE(OILPAN) | 426 #if ENABLE(OILPAN) |
| 428 visitor->trace(m_executionContextDataMap); | 427 visitor->trace(m_executionContextDataMap); |
| 429 visitor->trace(m_instrumentingAgents); | 428 visitor->trace(m_instrumentingAgents); |
| 430 #endif | 429 #endif |
| 431 } | 430 } |
| 432 | 431 |
| 433 } // namespace blink | 432 } // namespace blink |
| OLD | NEW |