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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 m_circularSequentialID = 1; | 82 m_circularSequentialID = 1; |
83 return m_circularSequentialID; | 83 return m_circularSequentialID; |
84 } | 84 } |
85 | 85 |
86 private: | 86 private: |
87 int m_circularSequentialID; | 87 int m_circularSequentialID; |
88 | 88 |
89 public: | 89 public: |
90 AsyncCallStackTracker* m_tracker; | 90 AsyncCallStackTracker* m_tracker; |
91 HashSet<int> m_intervalTimerIds; | 91 HashSet<int> m_intervalTimerIds; |
92 WillBePersistentHeapHashMap<int, RefPtrWillBeMember<AsyncCallChain> > m_time
rCallChains; | 92 HashMap<int, RefPtr<AsyncCallChain> > m_timerCallChains; |
93 WillBePersistentHeapHashMap<int, RefPtrWillBeMember<AsyncCallChain> > m_anim
ationFrameCallChains; | 93 HashMap<int, RefPtr<AsyncCallChain> > m_animationFrameCallChains; |
94 WillBePersistentHeapHashMap<RawPtrWillBeMember<Event>, RefPtrWillBeMember<As
yncCallChain> > m_eventCallChains; | 94 HashMap<Event*, RefPtr<AsyncCallChain> > m_eventCallChains; |
95 WillBePersistentHeapHashMap<RawPtrWillBeMember<EventTarget>, RefPtrWillBeMem
ber<AsyncCallChain> > m_xhrCallChains; | 95 HashMap<EventTarget*, RefPtr<AsyncCallChain> > m_xhrCallChains; |
96 WillBePersistentHeapHashMap<RawPtrWillBeMember<MutationObserver>, RefPtrWill
BeMember<AsyncCallChain> > m_mutationObserverCallChains; | 96 HashMap<MutationObserver*, RefPtr<AsyncCallChain> > m_mutationObserverCallCh
ains; |
97 WillBePersistentHeapHashMap<ExecutionContextTask*, RefPtrWillBeMember<AsyncC
allChain> > m_executionContextTaskCallChains; | 97 HashMap<ExecutionContextTask*, RefPtr<AsyncCallChain> > m_executionContextTa
skCallChains; |
98 WillBePersistentHeapHashMap<String, RefPtrWillBeMember<AsyncCallChain> > m_v
8AsyncTaskCallChains; | 98 HashMap<String, RefPtr<AsyncCallChain> > m_v8AsyncTaskCallChains; |
99 WillBePersistentHeapHashMap<int, RefPtrWillBeMember<AsyncCallChain> > m_asyn
cOperationCallChains; | 99 HashMap<int, RefPtr<AsyncCallChain> > m_asyncOperationCallChains; |
100 }; | 100 }; |
101 | 101 |
102 static XMLHttpRequest* toXmlHttpRequest(EventTarget* eventTarget) | 102 static XMLHttpRequest* toXmlHttpRequest(EventTarget* eventTarget) |
103 { | 103 { |
104 const AtomicString& interfaceName = eventTarget->interfaceName(); | 104 const AtomicString& interfaceName = eventTarget->interfaceName(); |
105 if (interfaceName == EventTargetNames::XMLHttpRequest) | 105 if (interfaceName == EventTargetNames::XMLHttpRequest) |
106 return static_cast<XMLHttpRequest*>(eventTarget); | 106 return static_cast<XMLHttpRequest*>(eventTarget); |
107 if (interfaceName == EventTargetNames::XMLHttpRequestUpload) | 107 if (interfaceName == EventTargetNames::XMLHttpRequestUpload) |
108 return static_cast<XMLHttpRequestUpload*>(eventTarget)->xmlHttpRequest()
; | 108 return static_cast<XMLHttpRequestUpload*>(eventTarget)->xmlHttpRequest()
; |
109 return 0; | 109 return 0; |
110 } | 110 } |
111 | 111 |
112 void AsyncCallStackTracker::AsyncCallChain::trace(Visitor* visitor) | |
113 { | |
114 visitor->trace(m_callStacks); | |
115 } | |
116 | |
117 AsyncCallStackTracker::AsyncCallStack::AsyncCallStack(const String& description,
const ScriptValue& callFrames) | 112 AsyncCallStackTracker::AsyncCallStack::AsyncCallStack(const String& description,
const ScriptValue& callFrames) |
118 : m_description(description) | 113 : m_description(description) |
119 , m_callFrames(callFrames) | 114 , m_callFrames(callFrames) |
120 { | 115 { |
121 } | 116 } |
122 | 117 |
123 AsyncCallStackTracker::AsyncCallStack::~AsyncCallStack() | 118 AsyncCallStackTracker::AsyncCallStack::~AsyncCallStack() |
124 { | 119 { |
125 } | 120 } |
126 | 121 |
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
409 setCurrentAsyncCallChain(context, operationId > 0 ? data->m_asyncOperati
onCallChains.get(operationId) : nullptr); | 404 setCurrentAsyncCallChain(context, operationId > 0 ? data->m_asyncOperati
onCallChains.get(operationId) : nullptr); |
410 else | 405 else |
411 setCurrentAsyncCallChain(context, nullptr); | 406 setCurrentAsyncCallChain(context, nullptr); |
412 } | 407 } |
413 | 408 |
414 void AsyncCallStackTracker::didFireAsyncCall() | 409 void AsyncCallStackTracker::didFireAsyncCall() |
415 { | 410 { |
416 clearCurrentAsyncCallChain(); | 411 clearCurrentAsyncCallChain(); |
417 } | 412 } |
418 | 413 |
419 PassRefPtrWillBeRawPtr<AsyncCallStackTracker::AsyncCallChain> AsyncCallStackTrac
ker::createAsyncCallChain(const String& description, const ScriptValue& callFram
es) | 414 PassRefPtr<AsyncCallStackTracker::AsyncCallChain> AsyncCallStackTracker::createA
syncCallChain(const String& description, const ScriptValue& callFrames) |
420 { | 415 { |
421 if (callFrames.isEmpty()) { | 416 if (callFrames.isEmpty()) { |
422 ASSERT(m_currentAsyncCallChain); | 417 ASSERT(m_currentAsyncCallChain); |
423 return m_currentAsyncCallChain; // Propogate async call stack chain. | 418 return m_currentAsyncCallChain; // Propogate async call stack chain. |
424 } | 419 } |
425 RefPtrWillBeRawPtr<AsyncCallChain> chain = adoptRefWillBeNoop(m_currentAsync
CallChain ? new AsyncCallStackTracker::AsyncCallChain(*m_currentAsyncCallChain)
: new AsyncCallStackTracker::AsyncCallChain()); | 420 RefPtr<AsyncCallChain> chain = adoptRef(m_currentAsyncCallChain ? new AsyncC
allStackTracker::AsyncCallChain(*m_currentAsyncCallChain) : new AsyncCallStackTr
acker::AsyncCallChain()); |
426 ensureMaxAsyncCallChainDepth(chain.get(), m_maxAsyncCallStackDepth - 1); | 421 ensureMaxAsyncCallChainDepth(chain.get(), m_maxAsyncCallStackDepth - 1); |
427 chain->m_callStacks.prepend(adoptRefWillBeNoop(new AsyncCallStackTracker::As
yncCallStack(description, callFrames))); | 422 chain->m_callStacks.prepend(adoptRef(new AsyncCallStackTracker::AsyncCallSta
ck(description, callFrames))); |
428 return chain.release(); | 423 return chain.release(); |
429 } | 424 } |
430 | 425 |
431 void AsyncCallStackTracker::setCurrentAsyncCallChain(ExecutionContext* context,
PassRefPtrWillBeRawPtr<AsyncCallChain> chain) | 426 void AsyncCallStackTracker::setCurrentAsyncCallChain(ExecutionContext* context,
PassRefPtr<AsyncCallChain> chain) |
432 { | 427 { |
433 if (chain && !V8RecursionScope::recursionLevel(toIsolate(context))) { | 428 if (chain && !V8RecursionScope::recursionLevel(toIsolate(context))) { |
434 // Current AsyncCallChain corresponds to the bottommost JS call frame. | 429 // Current AsyncCallChain corresponds to the bottommost JS call frame. |
435 m_currentAsyncCallChain = chain; | 430 m_currentAsyncCallChain = chain; |
436 m_nestedAsyncCallCount = 1; | 431 m_nestedAsyncCallCount = 1; |
437 } else { | 432 } else { |
438 if (m_currentAsyncCallChain) | 433 if (m_currentAsyncCallChain) |
439 ++m_nestedAsyncCallCount; | 434 ++m_nestedAsyncCallCount; |
440 } | 435 } |
441 } | 436 } |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
474 { | 469 { |
475 m_currentAsyncCallChain.clear(); | 470 m_currentAsyncCallChain.clear(); |
476 m_nestedAsyncCallCount = 0; | 471 m_nestedAsyncCallCount = 0; |
477 ExecutionContextDataMap copy; | 472 ExecutionContextDataMap copy; |
478 m_executionContextDataMap.swap(copy); | 473 m_executionContextDataMap.swap(copy); |
479 for (ExecutionContextDataMap::const_iterator it = copy.begin(); it != copy.e
nd(); ++it) | 474 for (ExecutionContextDataMap::const_iterator it = copy.begin(); it != copy.e
nd(); ++it) |
480 delete it->value; | 475 delete it->value; |
481 } | 476 } |
482 | 477 |
483 } // namespace blink | 478 } // namespace blink |
OLD | NEW |