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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
49 static const char setTimeoutName[] = "setTimeout"; | 49 static const char setTimeoutName[] = "setTimeout"; |
50 static const char setIntervalName[] = "setInterval"; | 50 static const char setIntervalName[] = "setInterval"; |
51 static const char requestAnimationFrameName[] = "requestAnimationFrame"; | 51 static const char requestAnimationFrameName[] = "requestAnimationFrame"; |
52 static const char xhrSendName[] = "XMLHttpRequest.send"; | 52 static const char xhrSendName[] = "XMLHttpRequest.send"; |
53 static const char enqueueMutationRecordName[] = "Mutation"; | 53 static const char enqueueMutationRecordName[] = "Mutation"; |
54 | 54 |
55 } | 55 } |
56 | 56 |
57 namespace blink { | 57 namespace blink { |
58 | 58 |
59 class AsyncCallStackTracker::ExecutionContextData FINAL : public ContextLifecycl eObserver { | 59 class AsyncCallStackTracker::ExecutionContextData FINAL : public ContextLifecycl eObserver { |
haraken
2014/07/29 03:43:38
Consider moving ExecutionContextData in a follow-u
| |
60 WTF_MAKE_FAST_ALLOCATED; | 60 WTF_MAKE_FAST_ALLOCATED; |
61 public: | 61 public: |
62 ExecutionContextData(AsyncCallStackTracker* tracker, ExecutionContext* execu tionContext) | 62 ExecutionContextData(AsyncCallStackTracker* tracker, ExecutionContext* execu tionContext) |
63 : ContextLifecycleObserver(executionContext) | 63 : ContextLifecycleObserver(executionContext) |
64 , m_circularSequentialID(0) | 64 , m_circularSequentialID(0) |
65 , m_tracker(tracker) | 65 , m_tracker(tracker) |
66 { | 66 { |
67 } | 67 } |
68 | 68 |
69 virtual void contextDestroyed() OVERRIDE | 69 virtual void contextDestroyed() OVERRIDE |
(...skipping 12 matching lines...) Expand all 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 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<Event*, RefPtrWillBeMember<AsyncCallChain> > m_e ventCallChains; |
tkent
2014/07/29 02:33:54
Event* should be WeakMember<Event> or Member<Event
keishi
2014/07/29 07:56:36
Done.
| |
95 HashMap<EventTarget*, RefPtr<AsyncCallChain> > m_xhrCallChains; | 95 WillBePersistentHeapHashMap<EventTarget*, RefPtrWillBeMember<AsyncCallChain> > m_xhrCallChains; |
haraken
2014/07/29 03:43:39
EventTarget is on-heap as well.
keishi
2014/07/29 07:56:36
Done.
| |
96 HashMap<MutationObserver*, RefPtr<AsyncCallChain> > m_mutationObserverCallCh ains; | 96 WillBePersistentHeapHashMap<MutationObserver*, RefPtrWillBeMember<AsyncCallC hain> > m_mutationObserverCallChains; |
haraken
2014/07/29 03:43:39
MutationObserver is on-heap as well.
keishi
2014/07/29 07:56:36
Done.
| |
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 Loading... | |
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 Loading... | |
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 |
OLD | NEW |