| 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(executionContext()); | 75 ASSERT(executionContext()); |
| 77 OwnPtrWillBeRawPtr<ExecutionContextData> self = m_tracker->m_executionCo
ntextDataMap.take(executionContext()); | 76 RawPtr<ExecutionContextData> self = m_tracker->m_executionContextDataMap
.take(executionContext()); |
| 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_mutationObserverC
allChains; | 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 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 408 | 407 |
| 409 void AsyncCallTracker::willFireAsyncCall(int operationId) | 408 void AsyncCallTracker::willFireAsyncCall(int operationId) |
| 410 { | 409 { |
| 411 m_debuggerAgent->traceAsyncCallbackStarting(operationId); | 410 m_debuggerAgent->traceAsyncCallbackStarting(operationId); |
| 412 } | 411 } |
| 413 | 412 |
| 414 AsyncCallTracker::ExecutionContextData* AsyncCallTracker::createContextDataIfNee
ded(ExecutionContext* context) | 413 AsyncCallTracker::ExecutionContextData* AsyncCallTracker::createContextDataIfNee
ded(ExecutionContext* context) |
| 415 { | 414 { |
| 416 ExecutionContextData* data = m_executionContextDataMap.get(context); | 415 ExecutionContextData* data = m_executionContextDataMap.get(context); |
| 417 if (!data) { | 416 if (!data) { |
| 418 data = m_executionContextDataMap.set(context, adoptPtrWillBeNoop(new Asy
ncCallTracker::ExecutionContextData(this, context))) | 417 data = m_executionContextDataMap.set(context, (new AsyncCallTracker::Exe
cutionContextData(this, context))) |
| 419 .storedValue->value.get(); | 418 .storedValue->value.get(); |
| 420 } | 419 } |
| 421 return data; | 420 return data; |
| 422 } | 421 } |
| 423 | 422 |
| 424 DEFINE_TRACE(AsyncCallTracker) | 423 DEFINE_TRACE(AsyncCallTracker) |
| 425 { | 424 { |
| 426 #if ENABLE(OILPAN) | 425 #if ENABLE(OILPAN) |
| 427 visitor->trace(m_executionContextDataMap); | 426 visitor->trace(m_executionContextDataMap); |
| 428 visitor->trace(m_instrumentingAgents); | 427 visitor->trace(m_instrumentingAgents); |
| 429 #endif | 428 #endif |
| 430 } | 429 } |
| 431 | 430 |
| 432 } // namespace blink | 431 } // namespace blink |
| OLD | NEW |