Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(52)

Side by Side Diff: Source/core/inspector/AsyncCallStackTracker.cpp

Issue 413113003: Oilpan: Prepare moving AsyncCallChain to Oilpan (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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 HashMap<int, RefPtr<AsyncCallChain> > m_timerCallChains; 92 WillBePersistentHeapHashMap<int, RefPtrWillBeMember<AsyncCallChain> > m_time rCallChains;
93 HashMap<int, RefPtr<AsyncCallChain> > m_animationFrameCallChains; 93 WillBePersistentHeapHashMap<int, RefPtrWillBeMember<AsyncCallChain> > m_anim ationFrameCallChains;
94 HashMap<Event*, RefPtr<AsyncCallChain> > m_eventCallChains; 94 WillBePersistentHeapHashMap<RawPtrWillBeMember<Event>, RefPtrWillBeMember<As yncCallChain> > m_eventCallChains;
95 HashMap<EventTarget*, RefPtr<AsyncCallChain> > m_xhrCallChains; 95 WillBePersistentHeapHashMap<RawPtrWillBeMember<EventTarget>, RefPtrWillBeMem ber<AsyncCallChain> > m_xhrCallChains;
96 HashMap<MutationObserver*, RefPtr<AsyncCallChain> > m_mutationObserverCallCh ains; 96 WillBePersistentHeapHashMap<RawPtrWillBeMember<MutationObserver>, RefPtrWill BeMember<AsyncCallChain> > m_mutationObserverCallChains;
97 HashMap<ExecutionContextTask*, RefPtr<AsyncCallChain> > m_executionContextTa skCallChains; 97 WillBePersistentHeapHashMap<ExecutionContextTask*, RefPtrWillBeMember<AsyncC allChain> > m_executionContextTaskCallChains;
98 HashMap<String, RefPtr<AsyncCallChain> > m_v8AsyncTaskCallChains; 98 WillBePersistentHeapHashMap<String, RefPtrWillBeMember<AsyncCallChain> > m_v 8AsyncTaskCallChains;
99 HashMap<int, RefPtr<AsyncCallChain> > m_asyncOperationCallChains; 99 WillBePersistentHeapHashMap<int, RefPtrWillBeMember<AsyncCallChain> > m_asyn cOperationCallChains;
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
112 AsyncCallStackTracker::AsyncCallStack::AsyncCallStack(const String& description, const ScriptValue& callFrames) 117 AsyncCallStackTracker::AsyncCallStack::AsyncCallStack(const String& description, const ScriptValue& callFrames)
113 : m_description(description) 118 : m_description(description)
114 , m_callFrames(callFrames) 119 , m_callFrames(callFrames)
115 { 120 {
116 } 121 }
117 122
118 AsyncCallStackTracker::AsyncCallStack::~AsyncCallStack() 123 AsyncCallStackTracker::AsyncCallStack::~AsyncCallStack()
119 { 124 {
120 } 125 }
121 126
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 setCurrentAsyncCallChain(context, operationId > 0 ? data->m_asyncOperati onCallChains.get(operationId) : nullptr); 409 setCurrentAsyncCallChain(context, operationId > 0 ? data->m_asyncOperati onCallChains.get(operationId) : nullptr);
405 else 410 else
406 setCurrentAsyncCallChain(context, nullptr); 411 setCurrentAsyncCallChain(context, nullptr);
407 } 412 }
408 413
409 void AsyncCallStackTracker::didFireAsyncCall() 414 void AsyncCallStackTracker::didFireAsyncCall()
410 { 415 {
411 clearCurrentAsyncCallChain(); 416 clearCurrentAsyncCallChain();
412 } 417 }
413 418
414 PassRefPtr<AsyncCallStackTracker::AsyncCallChain> AsyncCallStackTracker::createA syncCallChain(const String& description, const ScriptValue& callFrames) 419 PassRefPtrWillBeRawPtr<AsyncCallStackTracker::AsyncCallChain> AsyncCallStackTrac ker::createAsyncCallChain(const String& description, const ScriptValue& callFram es)
415 { 420 {
416 if (callFrames.isEmpty()) { 421 if (callFrames.isEmpty()) {
417 ASSERT(m_currentAsyncCallChain); 422 ASSERT(m_currentAsyncCallChain);
418 return m_currentAsyncCallChain; // Propogate async call stack chain. 423 return m_currentAsyncCallChain; // Propogate async call stack chain.
419 } 424 }
420 RefPtr<AsyncCallChain> chain = adoptRef(m_currentAsyncCallChain ? new AsyncC allStackTracker::AsyncCallChain(*m_currentAsyncCallChain) : new AsyncCallStackTr acker::AsyncCallChain()); 425 RefPtrWillBeRawPtr<AsyncCallChain> chain = adoptRefWillBeNoop(m_currentAsync CallChain ? new AsyncCallStackTracker::AsyncCallChain(*m_currentAsyncCallChain) : new AsyncCallStackTracker::AsyncCallChain());
421 ensureMaxAsyncCallChainDepth(chain.get(), m_maxAsyncCallStackDepth - 1); 426 ensureMaxAsyncCallChainDepth(chain.get(), m_maxAsyncCallStackDepth - 1);
422 chain->m_callStacks.prepend(adoptRef(new AsyncCallStackTracker::AsyncCallSta ck(description, callFrames))); 427 chain->m_callStacks.prepend(adoptRefWillBeNoop(new AsyncCallStackTracker::As yncCallStack(description, callFrames)));
423 return chain.release(); 428 return chain.release();
424 } 429 }
425 430
426 void AsyncCallStackTracker::setCurrentAsyncCallChain(ExecutionContext* context, PassRefPtr<AsyncCallChain> chain) 431 void AsyncCallStackTracker::setCurrentAsyncCallChain(ExecutionContext* context, PassRefPtrWillBeRawPtr<AsyncCallChain> chain)
427 { 432 {
428 if (chain && !V8RecursionScope::recursionLevel(toIsolate(context))) { 433 if (chain && !V8RecursionScope::recursionLevel(toIsolate(context))) {
429 // Current AsyncCallChain corresponds to the bottommost JS call frame. 434 // Current AsyncCallChain corresponds to the bottommost JS call frame.
430 m_currentAsyncCallChain = chain; 435 m_currentAsyncCallChain = chain;
431 m_nestedAsyncCallCount = 1; 436 m_nestedAsyncCallCount = 1;
432 } else { 437 } else {
433 if (m_currentAsyncCallChain) 438 if (m_currentAsyncCallChain)
434 ++m_nestedAsyncCallCount; 439 ++m_nestedAsyncCallCount;
435 } 440 }
436 } 441 }
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
469 { 474 {
470 m_currentAsyncCallChain.clear(); 475 m_currentAsyncCallChain.clear();
471 m_nestedAsyncCallCount = 0; 476 m_nestedAsyncCallCount = 0;
472 ExecutionContextDataMap copy; 477 ExecutionContextDataMap copy;
473 m_executionContextDataMap.swap(copy); 478 m_executionContextDataMap.swap(copy);
474 for (ExecutionContextDataMap::const_iterator it = copy.begin(); it != copy.e nd(); ++it) 479 for (ExecutionContextDataMap::const_iterator it = copy.begin(); it != copy.e nd(); ++it)
475 delete it->value; 480 delete it->value;
476 } 481 }
477 482
478 } // namespace blink 483 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698