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 NoBaseWillBeGar bageCollectedFinalized<AsyncCallStackTracker::ExecutionContextData>, public Cont extLifecycleObserver { |
60 WTF_MAKE_FAST_ALLOCATED; | 60 WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED; |
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 |
70 { | 70 { |
71 ASSERT(executionContext()); | 71 ASSERT(executionContext()); |
72 ExecutionContextData* self = m_tracker->m_executionContextDataMap.take(e xecutionContext()); | 72 ExecutionContextData* self = m_tracker->m_executionContextDataMap.take(e xecutionContext()); |
aandrey
2014/08/11 11:11:04
this should have been: OwnPtr<ExecutionContextData
keishi
2014/08/11 13:01:44
Done.
| |
73 ASSERT(self == this); | 73 ASSERT(self == this); |
74 ContextLifecycleObserver::contextDestroyed(); | 74 ContextLifecycleObserver::contextDestroyed(); |
75 delete self; | 75 delete self; |
haraken
2014/08/11 10:59:59
This would be wrong. We cannot explicitly destroy
keishi
2014/08/11 13:01:44
Done.
| |
76 } | 76 } |
77 | 77 |
78 int circularSequentialID() | 78 int circularSequentialID() |
79 { | 79 { |
80 ++m_circularSequentialID; | 80 ++m_circularSequentialID; |
81 if (m_circularSequentialID <= 0) | 81 if (m_circularSequentialID <= 0) |
82 m_circularSequentialID = 1; | 82 m_circularSequentialID = 1; |
83 return m_circularSequentialID; | 83 return m_circularSequentialID; |
84 } | 84 } |
85 | 85 |
86 void trace(Visitor* visitor) | |
87 { | |
88 visitor->trace(m_tracker); | |
89 visitor->trace(m_timerCallChains); | |
90 visitor->trace(m_animationFrameCallChains); | |
91 visitor->trace(m_eventCallChains); | |
92 visitor->trace(m_xhrCallChains); | |
93 visitor->trace(m_mutationObserverCallChains); | |
94 visitor->trace(m_executionContextTaskCallChains); | |
95 visitor->trace(m_v8AsyncTaskCallChains); | |
96 visitor->trace(m_asyncOperationCallChains); | |
97 } | |
98 | |
86 private: | 99 private: |
87 int m_circularSequentialID; | 100 int m_circularSequentialID; |
88 | 101 |
89 public: | 102 public: |
90 AsyncCallStackTracker* m_tracker; | 103 RawPtrWillBeMember<AsyncCallStackTracker> m_tracker; |
91 HashSet<int> m_intervalTimerIds; | 104 HashSet<int> m_intervalTimerIds; |
92 WillBePersistentHeapHashMap<int, RefPtrWillBeMember<AsyncCallChain> > m_time rCallChains; | 105 WillBeHeapHashMap<int, RefPtrWillBeMember<AsyncCallChain> > m_timerCallChain s; |
93 WillBePersistentHeapHashMap<int, RefPtrWillBeMember<AsyncCallChain> > m_anim ationFrameCallChains; | 106 WillBeHeapHashMap<int, RefPtrWillBeMember<AsyncCallChain> > m_animationFrame CallChains; |
94 WillBePersistentHeapHashMap<RawPtrWillBeMember<Event>, RefPtrWillBeMember<As yncCallChain> > m_eventCallChains; | 107 WillBeHeapHashMap<RawPtrWillBeMember<Event>, RefPtrWillBeMember<AsyncCallCha in> > m_eventCallChains; |
95 WillBePersistentHeapHashMap<RawPtrWillBeMember<EventTarget>, RefPtrWillBeMem ber<AsyncCallChain> > m_xhrCallChains; | 108 WillBeHeapHashMap<RawPtrWillBeMember<EventTarget>, RefPtrWillBeMember<AsyncC allChain> > m_xhrCallChains; |
96 WillBePersistentHeapHashMap<RawPtrWillBeMember<MutationObserver>, RefPtrWill BeMember<AsyncCallChain> > m_mutationObserverCallChains; | 109 WillBeHeapHashMap<RawPtrWillBeMember<MutationObserver>, RefPtrWillBeMember<A syncCallChain> > m_mutationObserverCallChains; |
97 WillBePersistentHeapHashMap<ExecutionContextTask*, RefPtrWillBeMember<AsyncC allChain> > m_executionContextTaskCallChains; | 110 WillBeHeapHashMap<ExecutionContextTask*, RefPtrWillBeMember<AsyncCallChain> > m_executionContextTaskCallChains; |
98 WillBePersistentHeapHashMap<String, RefPtrWillBeMember<AsyncCallChain> > m_v 8AsyncTaskCallChains; | 111 WillBeHeapHashMap<String, RefPtrWillBeMember<AsyncCallChain> > m_v8AsyncTask CallChains; |
99 WillBePersistentHeapHashMap<int, RefPtrWillBeMember<AsyncCallChain> > m_asyn cOperationCallChains; | 112 WillBeHeapHashMap<int, RefPtrWillBeMember<AsyncCallChain> > m_asyncOperation CallChains; |
100 }; | 113 }; |
101 | 114 |
102 static XMLHttpRequest* toXmlHttpRequest(EventTarget* eventTarget) | 115 static XMLHttpRequest* toXmlHttpRequest(EventTarget* eventTarget) |
103 { | 116 { |
104 const AtomicString& interfaceName = eventTarget->interfaceName(); | 117 const AtomicString& interfaceName = eventTarget->interfaceName(); |
105 if (interfaceName == EventTargetNames::XMLHttpRequest) | 118 if (interfaceName == EventTargetNames::XMLHttpRequest) |
106 return static_cast<XMLHttpRequest*>(eventTarget); | 119 return static_cast<XMLHttpRequest*>(eventTarget); |
107 if (interfaceName == EventTargetNames::XMLHttpRequestUpload) | 120 if (interfaceName == EventTargetNames::XMLHttpRequestUpload) |
108 return static_cast<XMLHttpRequestUpload*>(eventTarget)->xmlHttpRequest() ; | 121 return static_cast<XMLHttpRequestUpload*>(eventTarget)->xmlHttpRequest() ; |
109 return 0; | 122 return 0; |
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
473 void AsyncCallStackTracker::clear() | 486 void AsyncCallStackTracker::clear() |
474 { | 487 { |
475 m_currentAsyncCallChain.clear(); | 488 m_currentAsyncCallChain.clear(); |
476 m_nestedAsyncCallCount = 0; | 489 m_nestedAsyncCallCount = 0; |
477 ExecutionContextDataMap copy; | 490 ExecutionContextDataMap copy; |
478 m_executionContextDataMap.swap(copy); | 491 m_executionContextDataMap.swap(copy); |
479 for (ExecutionContextDataMap::const_iterator it = copy.begin(); it != copy.e nd(); ++it) | 492 for (ExecutionContextDataMap::const_iterator it = copy.begin(); it != copy.e nd(); ++it) |
480 delete it->value; | 493 delete it->value; |
481 } | 494 } |
482 | 495 |
496 void AsyncCallStackTracker::trace(Visitor* visitor) | |
497 { | |
498 visitor->trace(m_currentAsyncCallChain); | |
499 visitor->trace(m_executionContextDataMap); | |
500 } | |
501 | |
483 } // namespace blink | 502 } // namespace blink |
OLD | NEW |