OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights
reserved. | 2 * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple 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 | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 // URL protocol used to signal that the media source API is being used. | 119 // URL protocol used to signal that the media source API is being used. |
120 static const char mediaSourceBlobProtocol[] = "blob"; | 120 static const char mediaSourceBlobProtocol[] = "blob"; |
121 | 121 |
122 using namespace HTMLNames; | 122 using namespace HTMLNames; |
123 using namespace std; | 123 using namespace std; |
124 | 124 |
125 typedef WillBeHeapHashSet<RawPtrWillBeWeakMember<HTMLMediaElement> > WeakMediaEl
ementSet; | 125 typedef WillBeHeapHashSet<RawPtrWillBeWeakMember<HTMLMediaElement> > WeakMediaEl
ementSet; |
126 typedef WillBeHeapHashMap<RawPtrWillBeWeakMember<Document>, WeakMediaElementSet>
DocumentElementSetMap; | 126 typedef WillBeHeapHashMap<RawPtrWillBeWeakMember<Document>, WeakMediaElementSet>
DocumentElementSetMap; |
127 static DocumentElementSetMap& documentToElementSetMap() | 127 static DocumentElementSetMap& documentToElementSetMap() |
128 { | 128 { |
129 #if ENABLE(OILPAN) | 129 DEFINE_STATIC_LOCAL(OwnPtrWillBePersistent<DocumentElementSetMap>, map, (ado
ptPtrWillBeNoop(new DocumentElementSetMap()))); |
130 DEFINE_STATIC_LOCAL(Persistent<DocumentElementSetMap>, map, (new DocumentEle
mentSetMap())); | |
131 return *map; | 130 return *map; |
132 #else | |
133 DEFINE_STATIC_LOCAL(DocumentElementSetMap, map, ()); | |
134 return map; | |
135 #endif | |
136 } | 131 } |
137 | 132 |
138 static void addElementToDocumentMap(HTMLMediaElement* element, Document* documen
t) | 133 static void addElementToDocumentMap(HTMLMediaElement* element, Document* documen
t) |
139 { | 134 { |
140 DocumentElementSetMap& map = documentToElementSetMap(); | 135 DocumentElementSetMap& map = documentToElementSetMap(); |
141 WeakMediaElementSet set = map.take(document); | 136 WeakMediaElementSet set = map.take(document); |
142 set.add(element); | 137 set.add(element); |
143 map.add(document, set); | 138 map.add(document, set); |
144 } | 139 } |
145 | 140 |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 m_asyncEventQueue->close(); | 306 m_asyncEventQueue->close(); |
312 | 307 |
313 #if ENABLE(OILPAN) | 308 #if ENABLE(OILPAN) |
314 // If the HTMLMediaElement dies with the document we are not | 309 // If the HTMLMediaElement dies with the document we are not |
315 // allowed to touch the document to adjust delay load event counts | 310 // allowed to touch the document to adjust delay load event counts |
316 // because the document could have been already | 311 // because the document could have been already |
317 // destructed. However, if the HTMLMediaElement dies with the | 312 // destructed. However, if the HTMLMediaElement dies with the |
318 // document there is no need to change the delayed load counts | 313 // document there is no need to change the delayed load counts |
319 // because no load event will fire anyway. If the document is | 314 // because no load event will fire anyway. If the document is |
320 // still alive we do have to decrement the load delay counts. We | 315 // still alive we do have to decrement the load delay counts. We |
321 // determine if the document is alive by inspecting the weak | 316 // determine if the document is alive via the ActiveDOMObject |
322 // documentToElementSetMap. If the document is dead it has been | 317 // which is a context lifecycle observer. If the Document has been |
323 // removed from the map during weak processing. | 318 // destructed ActiveDOMObject::executionContext() returns 0. |
324 if (documentToElementSetMap().contains(&document())) | 319 if (ActiveDOMObject::executionContext()) |
325 setShouldDelayLoadEvent(false); | 320 setShouldDelayLoadEvent(false); |
326 #else | 321 #else |
327 setShouldDelayLoadEvent(false); | 322 setShouldDelayLoadEvent(false); |
328 #endif | 323 #endif |
329 | 324 |
330 #if !ENABLE(OILPAN) | 325 #if !ENABLE(OILPAN) |
331 if (m_textTracks) | 326 if (m_textTracks) |
332 m_textTracks->clearOwner(); | 327 m_textTracks->clearOwner(); |
333 #endif | 328 #endif |
334 | 329 |
(...skipping 3322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3657 visitor->trace(m_error); | 3652 visitor->trace(m_error); |
3658 visitor->trace(m_currentSourceNode); | 3653 visitor->trace(m_currentSourceNode); |
3659 visitor->trace(m_nextChildNodeToConsider); | 3654 visitor->trace(m_nextChildNodeToConsider); |
3660 visitor->trace(m_textTracks); | 3655 visitor->trace(m_textTracks); |
3661 visitor->trace(m_textTracksWhenResourceSelectionBegan); | 3656 visitor->trace(m_textTracksWhenResourceSelectionBegan); |
3662 WillBeHeapSupplementable<HTMLMediaElement>::trace(visitor); | 3657 WillBeHeapSupplementable<HTMLMediaElement>::trace(visitor); |
3663 HTMLElement::trace(visitor); | 3658 HTMLElement::trace(visitor); |
3664 } | 3659 } |
3665 | 3660 |
3666 } | 3661 } |
OLD | NEW |