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

Side by Side Diff: Source/modules/mediasource/MediaSource.cpp

Issue 1193383002: Oilpan: have media element prefinalizer handle all finalization. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: move conditional closing of MediaSource to media elt prefinalizer Created 5 years, 6 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
« no previous file with comments | « Source/modules/mediasource/MediaSource.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 const AtomicString& MediaSource::interfaceName() const 256 const AtomicString& MediaSource::interfaceName() const
257 { 257 {
258 return EventTargetNames::MediaSource; 258 return EventTargetNames::MediaSource;
259 } 259 }
260 260
261 ExecutionContext* MediaSource::executionContext() const 261 ExecutionContext* MediaSource::executionContext() const
262 { 262 {
263 return ActiveDOMObject::executionContext(); 263 return ActiveDOMObject::executionContext();
264 } 264 }
265 265
266 void MediaSource::clearWeakMembers(Visitor* visitor)
267 {
268 #if ENABLE(OILPAN)
269 // Oilpan: If the MediaSource survived, but its attached media
270 // element did not, signal the element that it can safely
271 // notify its MediaSource during finalization by calling close().
272 if (m_attachedElement && !Heap::isHeapObjectAlive(m_attachedElement)) {
273 m_attachedElement->setCloseMediaSourceWhenFinalizing();
274 m_attachedElement.clear();
275 }
276 #endif
277 }
278
279 DEFINE_TRACE(MediaSource) 266 DEFINE_TRACE(MediaSource)
280 { 267 {
281 #if ENABLE(OILPAN) 268 #if ENABLE(OILPAN)
282 visitor->trace(m_asyncEventQueue); 269 visitor->trace(m_asyncEventQueue);
283 #endif 270 #endif
271 visitor->trace(m_attachedElement);
284 visitor->trace(m_sourceBuffers); 272 visitor->trace(m_sourceBuffers);
285 visitor->trace(m_activeSourceBuffers); 273 visitor->trace(m_activeSourceBuffers);
286 visitor->template registerWeakMembers<MediaSource, &MediaSource::clearWeakMe mbers>(this);
287 RefCountedGarbageCollectedEventTargetWithInlineData<MediaSource>::trace(visi tor); 274 RefCountedGarbageCollectedEventTargetWithInlineData<MediaSource>::trace(visi tor);
288 ActiveDOMObject::trace(visitor); 275 ActiveDOMObject::trace(visitor);
289 } 276 }
290 277
291 void MediaSource::setWebMediaSourceAndOpen(PassOwnPtr<WebMediaSource> webMediaSo urce) 278 void MediaSource::setWebMediaSourceAndOpen(PassOwnPtr<WebMediaSource> webMediaSo urce)
292 { 279 {
293 TRACE_EVENT_ASYNC_END0("media", "MediaSource::attachToElement", this); 280 TRACE_EVENT_ASYNC_END0("media", "MediaSource::attachToElement", this);
294 ASSERT(webMediaSource); 281 ASSERT(webMediaSource);
295 ASSERT(!m_webMediaSource); 282 ASSERT(!m_webMediaSource);
296 ASSERT(m_attachedElement); 283 ASSERT(m_attachedElement);
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
613 600
614 m_asyncEventQueue->enqueueEvent(event.release()); 601 m_asyncEventQueue->enqueueEvent(event.release());
615 } 602 }
616 603
617 URLRegistry& MediaSource::registry() const 604 URLRegistry& MediaSource::registry() const
618 { 605 {
619 return MediaSourceRegistry::registry(); 606 return MediaSourceRegistry::registry();
620 } 607 }
621 608
622 } // namespace blink 609 } // namespace blink
OLDNEW
« no previous file with comments | « Source/modules/mediasource/MediaSource.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698