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

Side by Side Diff: third_party/WebKit/Source/core/html/HTMLMediaElement.cpp

Issue 1686483002: Oilpan: Remove most WillBe types from the code base (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
OLDNEW
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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 #ifndef LOG_CACHED_TIME_WARNINGS 99 #ifndef LOG_CACHED_TIME_WARNINGS
100 // Default to not logging warnings about excessive drift in the cached media tim e because it adds a 100 // Default to not logging warnings about excessive drift in the cached media tim e because it adds a
101 // fair amount of overhead and logging. 101 // fair amount of overhead and logging.
102 #define LOG_CACHED_TIME_WARNINGS 0 102 #define LOG_CACHED_TIME_WARNINGS 0
103 #endif 103 #endif
104 104
105 namespace blink { 105 namespace blink {
106 106
107 using namespace HTMLNames; 107 using namespace HTMLNames;
108 108
109 using WeakMediaElementSet = WillBeHeapHashSet<RawPtrWillBeWeakMember<HTMLMediaEl ement>>; 109 using WeakMediaElementSet = HeapHashSet<WeakMember<HTMLMediaElement>>;
110 using DocumentElementSetMap = WillBeHeapHashMap<RawPtrWillBeWeakMember<Document> , WeakMediaElementSet>; 110 using DocumentElementSetMap = HeapHashMap<WeakMember<Document>, WeakMediaElement Set>;
111 111
112 namespace { 112 namespace {
113 113
114 // URL protocol used to signal that the media source API is being used. 114 // URL protocol used to signal that the media source API is being used.
115 const char mediaSourceBlobProtocol[] = "blob"; 115 const char mediaSourceBlobProtocol[] = "blob";
116 116
117 enum MediaControlsShow { 117 enum MediaControlsShow {
118 MediaControlsShowAttribute = 0, 118 MediaControlsShowAttribute = 0,
119 MediaControlsShowFullscreen, 119 MediaControlsShowFullscreen,
120 MediaControlsShowNoScript, 120 MediaControlsShowNoScript,
(...skipping 12 matching lines...) Expand all
133 } 133 }
134 134
135 const char* boolString(bool val) 135 const char* boolString(bool val)
136 { 136 {
137 return val ? "true" : "false"; 137 return val ? "true" : "false";
138 } 138 }
139 #endif 139 #endif
140 140
141 DocumentElementSetMap& documentToElementSetMap() 141 DocumentElementSetMap& documentToElementSetMap()
142 { 142 {
143 DEFINE_STATIC_LOCAL(OwnPtrWillBePersistent<DocumentElementSetMap>, map, (ado ptPtrWillBeNoop(new DocumentElementSetMap()))); 143 DEFINE_STATIC_LOCAL(Persistent<DocumentElementSetMap>, map, (new DocumentEle mentSetMap()));
144 return *map; 144 return *map;
145 } 145 }
146 146
147 void addElementToDocumentMap(HTMLMediaElement* element, Document* document) 147 void addElementToDocumentMap(HTMLMediaElement* element, Document* document)
148 { 148 {
149 DocumentElementSetMap& map = documentToElementSetMap(); 149 DocumentElementSetMap& map = documentToElementSetMap();
150 WeakMediaElementSet set = map.take(document); 150 WeakMediaElementSet set = map.take(document);
151 set.add(element); 151 set.add(element);
152 map.add(document, set); 152 map.add(document, set);
153 } 153 }
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 ASSERT_NOT_REACHED(); 268 ASSERT_NOT_REACHED();
269 return String(); 269 return String();
270 } 270 }
271 271
272 } // anonymous namespace 272 } // anonymous namespace
273 273
274 class HTMLMediaElement::AutoplayHelperClientImpl : 274 class HTMLMediaElement::AutoplayHelperClientImpl :
275 public AutoplayExperimentHelper::Client { 275 public AutoplayExperimentHelper::Client {
276 276
277 public: 277 public:
278 static PassOwnPtrWillBeRawPtr<AutoplayHelperClientImpl> create(HTMLMediaElem ent* element) 278 static RawPtr<AutoplayHelperClientImpl> create(HTMLMediaElement* element)
279 { 279 {
280 return adoptPtrWillBeNoop(new AutoplayHelperClientImpl(element)); 280 return new AutoplayHelperClientImpl(element);
281 } 281 }
282 282
283 virtual ~AutoplayHelperClientImpl(); 283 virtual ~AutoplayHelperClientImpl();
284 284
285 using RecordMetricsBehavior = HTMLMediaElement::RecordMetricsBehavior; 285 using RecordMetricsBehavior = HTMLMediaElement::RecordMetricsBehavior;
286 286
287 double currentTime() const override { return m_element->currentTime(); } 287 double currentTime() const override { return m_element->currentTime(); }
288 double duration() const override { return m_element->duration(); } 288 double duration() const override { return m_element->duration(); }
289 bool ended() const override { return m_element->ended(); } 289 bool ended() const override { return m_element->ended(); }
290 bool muted() const override { return m_element->muted(); } 290 bool muted() const override { return m_element->muted(); }
(...skipping 20 matching lines...) Expand all
311 311
312 DEFINE_INLINE_VIRTUAL_TRACE() 312 DEFINE_INLINE_VIRTUAL_TRACE()
313 { 313 {
314 visitor->trace(m_element); 314 visitor->trace(m_element);
315 Client::trace(visitor); 315 Client::trace(visitor);
316 } 316 }
317 317
318 private: 318 private:
319 AutoplayHelperClientImpl(HTMLMediaElement* element) : m_element(element) {} 319 AutoplayHelperClientImpl(HTMLMediaElement* element) : m_element(element) {}
320 320
321 RawPtrWillBeMember<HTMLMediaElement> m_element; 321 Member<HTMLMediaElement> m_element;
322 }; 322 };
323 323
324 324
325 void HTMLMediaElement::recordAutoplayMetric(AutoplayMetrics metric) 325 void HTMLMediaElement::recordAutoplayMetric(AutoplayMetrics metric)
326 { 326 {
327 DEFINE_STATIC_LOCAL(EnumerationHistogram, autoplayHistogram, ("Blink.MediaEl ement.Autoplay", NumberOfAutoplayMetrics)); 327 DEFINE_STATIC_LOCAL(EnumerationHistogram, autoplayHistogram, ("Blink.MediaEl ement.Autoplay", NumberOfAutoplayMetrics));
328 autoplayHistogram.count(metric); 328 autoplayHistogram.count(metric);
329 } 329 }
330 330
331 WebMimeRegistry::SupportsType HTMLMediaElement::supportsType(const ContentType& contentType) 331 WebMimeRegistry::SupportsType HTMLMediaElement::supportsType(const ContentType& contentType)
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
675 // Schedule the timer to try the next <source> element WITHOUT resetting sta te ala invokeLoadAlgorithm. 675 // Schedule the timer to try the next <source> element WITHOUT resetting sta te ala invokeLoadAlgorithm.
676 m_pendingActionFlags |= LoadMediaResource; 676 m_pendingActionFlags |= LoadMediaResource;
677 m_loadTimer.startOneShot(0, BLINK_FROM_HERE); 677 m_loadTimer.startOneShot(0, BLINK_FROM_HERE);
678 } 678 }
679 679
680 void HTMLMediaElement::scheduleEvent(const AtomicString& eventName) 680 void HTMLMediaElement::scheduleEvent(const AtomicString& eventName)
681 { 681 {
682 scheduleEvent(Event::createCancelable(eventName)); 682 scheduleEvent(Event::createCancelable(eventName));
683 } 683 }
684 684
685 void HTMLMediaElement::scheduleEvent(PassRefPtrWillBeRawPtr<Event> event) 685 void HTMLMediaElement::scheduleEvent(RawPtr<Event> event)
686 { 686 {
687 #if LOG_MEDIA_EVENTS 687 #if LOG_MEDIA_EVENTS
688 WTF_LOG(Media, "HTMLMediaElement::scheduleEvent(%p) - scheduling '%s'", this , event->type().ascii().data()); 688 WTF_LOG(Media, "HTMLMediaElement::scheduleEvent(%p) - scheduling '%s'", this , event->type().ascii().data());
689 #endif 689 #endif
690 m_asyncEventQueue->enqueueEvent(event); 690 m_asyncEventQueue->enqueueEvent(event);
691 } 691 }
692 692
693 void HTMLMediaElement::loadTimerFired(Timer<HTMLMediaElement>*) 693 void HTMLMediaElement::loadTimerFired(Timer<HTMLMediaElement>*)
694 { 694 {
695 if (m_pendingActionFlags & LoadTextTrackResource) 695 if (m_pendingActionFlags & LoadTextTrackResource)
(...skipping 1913 matching lines...) Expand 10 before | Expand all | Expand 10 after
2609 AutomaticTrackSelection trackSelection(configuration); 2609 AutomaticTrackSelection trackSelection(configuration);
2610 trackSelection.perform(*m_textTracks); 2610 trackSelection.perform(*m_textTracks);
2611 2611
2612 textTracksChanged(); 2612 textTracksChanged();
2613 } 2613 }
2614 2614
2615 bool HTMLMediaElement::havePotentialSourceChild() 2615 bool HTMLMediaElement::havePotentialSourceChild()
2616 { 2616 {
2617 // Stash the current <source> node and next nodes so we can restore them aft er checking 2617 // Stash the current <source> node and next nodes so we can restore them aft er checking
2618 // to see there is another potential. 2618 // to see there is another potential.
2619 RefPtrWillBeRawPtr<HTMLSourceElement> currentSourceNode = m_currentSourceNod e; 2619 RawPtr<HTMLSourceElement> currentSourceNode = m_currentSourceNode;
2620 RefPtrWillBeRawPtr<Node> nextNode = m_nextChildNodeToConsider; 2620 RawPtr<Node> nextNode = m_nextChildNodeToConsider;
2621 2621
2622 KURL nextURL = selectNextSourceChild(0, DoNothing); 2622 KURL nextURL = selectNextSourceChild(0, DoNothing);
2623 2623
2624 m_currentSourceNode = currentSourceNode; 2624 m_currentSourceNode = currentSourceNode;
2625 m_nextChildNodeToConsider = nextNode; 2625 m_nextChildNodeToConsider = nextNode;
2626 2626
2627 return nextURL.isValid(); 2627 return nextURL.isValid();
2628 } 2628 }
2629 2629
2630 KURL HTMLMediaElement::selectNextSourceChild(ContentType* contentType, InvalidUR LAction actionIfInvalid) 2630 KURL HTMLMediaElement::selectNextSourceChild(ContentType* contentType, InvalidUR LAction actionIfInvalid)
(...skipping 658 matching lines...) Expand 10 before | Expand all | Expand 10 after
3289 3289
3290 TextTrackContainer& HTMLMediaElement::ensureTextTrackContainer() 3290 TextTrackContainer& HTMLMediaElement::ensureTextTrackContainer()
3291 { 3291 {
3292 ShadowRoot& shadowRoot = ensureUserAgentShadowRoot(); 3292 ShadowRoot& shadowRoot = ensureUserAgentShadowRoot();
3293 assertShadowRootChildren(shadowRoot); 3293 assertShadowRootChildren(shadowRoot);
3294 3294
3295 Node* firstChild = shadowRoot.firstChild(); 3295 Node* firstChild = shadowRoot.firstChild();
3296 if (firstChild && firstChild->isTextTrackContainer()) 3296 if (firstChild && firstChild->isTextTrackContainer())
3297 return toTextTrackContainer(*firstChild); 3297 return toTextTrackContainer(*firstChild);
3298 3298
3299 RefPtrWillBeRawPtr<TextTrackContainer> textTrackContainer = TextTrackContain er::create(document()); 3299 RawPtr<TextTrackContainer> textTrackContainer = TextTrackContainer::create(d ocument());
3300 3300
3301 // The text track container should be inserted before the media controls, 3301 // The text track container should be inserted before the media controls,
3302 // so that they are rendered behind them. 3302 // so that they are rendered behind them.
3303 shadowRoot.insertBefore(textTrackContainer, firstChild); 3303 shadowRoot.insertBefore(textTrackContainer, firstChild);
3304 3304
3305 assertShadowRootChildren(shadowRoot); 3305 assertShadowRootChildren(shadowRoot);
3306 3306
3307 return *textTrackContainer; 3307 return *textTrackContainer;
3308 } 3308 }
3309 3309
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
3431 } 3431 }
3432 3432
3433 return nullptr; 3433 return nullptr;
3434 } 3434 }
3435 3435
3436 void HTMLMediaElement::ensureMediaControls() 3436 void HTMLMediaElement::ensureMediaControls()
3437 { 3437 {
3438 if (mediaControls()) 3438 if (mediaControls())
3439 return; 3439 return;
3440 3440
3441 RefPtrWillBeRawPtr<MediaControls> mediaControls = MediaControls::create(*thi s); 3441 RawPtr<MediaControls> mediaControls = MediaControls::create(*this);
3442 3442
3443 mediaControls->reset(); 3443 mediaControls->reset();
3444 if (isFullscreen()) 3444 if (isFullscreen())
3445 mediaControls->enteredFullscreen(); 3445 mediaControls->enteredFullscreen();
3446 3446
3447 ShadowRoot& shadowRoot = ensureUserAgentShadowRoot(); 3447 ShadowRoot& shadowRoot = ensureUserAgentShadowRoot();
3448 assertShadowRootChildren(shadowRoot); 3448 assertShadowRootChildren(shadowRoot);
3449 3449
3450 // The media controls should be inserted after the text track container, 3450 // The media controls should be inserted after the text track container,
3451 // so that they are rendered in front of captions and subtitles. 3451 // so that they are rendered in front of captions and subtitles.
(...skipping 18 matching lines...) Expand all
3470 3470
3471 if (shouldShowControls(RecordMetricsBehavior::DoRecord)) 3471 if (shouldShowControls(RecordMetricsBehavior::DoRecord))
3472 mediaControls()->show(); 3472 mediaControls()->show();
3473 else 3473 else
3474 mediaControls()->hide(); 3474 mediaControls()->hide();
3475 } 3475 }
3476 3476
3477 CueTimeline& HTMLMediaElement::cueTimeline() 3477 CueTimeline& HTMLMediaElement::cueTimeline()
3478 { 3478 {
3479 if (!m_cueTimeline) 3479 if (!m_cueTimeline)
3480 m_cueTimeline = adoptPtrWillBeNoop(new CueTimeline(*this)); 3480 m_cueTimeline = new CueTimeline(*this);
3481 return *m_cueTimeline; 3481 return *m_cueTimeline;
3482 } 3482 }
3483 3483
3484 void HTMLMediaElement::configureTextTrackDisplay() 3484 void HTMLMediaElement::configureTextTrackDisplay()
3485 { 3485 {
3486 ASSERT(m_textTracks); 3486 ASSERT(m_textTracks);
3487 WTF_LOG(Media, "HTMLMediaElement::configureTextTrackDisplay(%p)", this); 3487 WTF_LOG(Media, "HTMLMediaElement::configureTextTrackDisplay(%p)", this);
3488 3488
3489 if (m_processingPreferenceChange) 3489 if (m_processingPreferenceChange)
3490 return; 3490 return;
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
3856 3856
3857 IntRect HTMLMediaElement::AutoplayHelperClientImpl::absoluteBoundingBoxRect() co nst 3857 IntRect HTMLMediaElement::AutoplayHelperClientImpl::absoluteBoundingBoxRect() co nst
3858 { 3858 {
3859 IntRect result; 3859 IntRect result;
3860 if (LayoutObject* object = m_element->layoutObject()) 3860 if (LayoutObject* object = m_element->layoutObject())
3861 result = object->absoluteBoundingBoxRect(); 3861 result = object->absoluteBoundingBoxRect();
3862 return result; 3862 return result;
3863 } 3863 }
3864 3864
3865 } // namespace blink 3865 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLMediaElement.h ('k') | third_party/WebKit/Source/core/html/HTMLMediaSource.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698