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

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

Issue 1254613003: Let the WebMediaPlayer decide whether to use overlay video. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: trchen@'s comments Created 5 years, 4 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 #include "core/html/track/TextTrackContainer.h" 58 #include "core/html/track/TextTrackContainer.h"
59 #include "core/html/track/TextTrackList.h" 59 #include "core/html/track/TextTrackList.h"
60 #include "core/html/track/VideoTrack.h" 60 #include "core/html/track/VideoTrack.h"
61 #include "core/html/track/VideoTrackList.h" 61 #include "core/html/track/VideoTrackList.h"
62 #include "core/inspector/ConsoleMessage.h" 62 #include "core/inspector/ConsoleMessage.h"
63 #include "core/layout/LayoutVideo.h" 63 #include "core/layout/LayoutVideo.h"
64 #include "core/layout/LayoutView.h" 64 #include "core/layout/LayoutView.h"
65 #include "core/layout/compositing/DeprecatedPaintLayerCompositor.h" 65 #include "core/layout/compositing/DeprecatedPaintLayerCompositor.h"
66 #include "core/loader/FrameLoader.h" 66 #include "core/loader/FrameLoader.h"
67 #include "core/loader/FrameLoaderClient.h" 67 #include "core/loader/FrameLoaderClient.h"
68 #include "core/page/ChromeClient.h"
68 #include "platform/ContentType.h" 69 #include "platform/ContentType.h"
69 #include "platform/Logging.h" 70 #include "platform/Logging.h"
70 #include "platform/MIMETypeFromURL.h" 71 #include "platform/MIMETypeFromURL.h"
71 #include "platform/MIMETypeRegistry.h" 72 #include "platform/MIMETypeRegistry.h"
72 #include "platform/RuntimeEnabledFeatures.h" 73 #include "platform/RuntimeEnabledFeatures.h"
73 #include "platform/UserGestureIndicator.h" 74 #include "platform/UserGestureIndicator.h"
74 #include "platform/audio/AudioBus.h" 75 #include "platform/audio/AudioBus.h"
75 #include "platform/audio/AudioSourceProviderClient.h" 76 #include "platform/audio/AudioSourceProviderClient.h"
76 #include "platform/graphics/GraphicsLayer.h" 77 #include "platform/graphics/GraphicsLayer.h"
77 #include "platform/weborigin/SecurityOrigin.h" 78 #include "platform/weborigin/SecurityOrigin.h"
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
356 , m_completelyLoaded(false) 357 , m_completelyLoaded(false)
357 , m_havePreparedToPlay(false) 358 , m_havePreparedToPlay(false)
358 , m_tracksAreReady(true) 359 , m_tracksAreReady(true)
359 , m_haveVisibleTextTrack(false) 360 , m_haveVisibleTextTrack(false)
360 , m_processingPreferenceChange(false) 361 , m_processingPreferenceChange(false)
361 , m_remoteRoutesAvailable(false) 362 , m_remoteRoutesAvailable(false)
362 , m_playingRemotely(false) 363 , m_playingRemotely(false)
363 , m_isFinalizing(false) 364 , m_isFinalizing(false)
364 , m_initialPlayWithoutUserGestures(false) 365 , m_initialPlayWithoutUserGestures(false)
365 , m_autoplayMediaCounted(false) 366 , m_autoplayMediaCounted(false)
367 , m_inOverlayFullscreenVideo(false)
366 , m_audioTracks(AudioTrackList::create(*this)) 368 , m_audioTracks(AudioTrackList::create(*this))
367 , m_videoTracks(VideoTrackList::create(*this)) 369 , m_videoTracks(VideoTrackList::create(*this))
368 , m_textTracks(nullptr) 370 , m_textTracks(nullptr)
369 #if ENABLE(WEB_AUDIO) 371 #if ENABLE(WEB_AUDIO)
370 , m_audioSourceNode(nullptr) 372 , m_audioSourceNode(nullptr)
371 #endif 373 #endif
372 { 374 {
373 #if ENABLE(OILPAN) 375 #if ENABLE(OILPAN)
374 ThreadState::current()->registerPreFinalizer(this); 376 ThreadState::current()->registerPreFinalizer(this);
375 #endif 377 #endif
(...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after
1044 m_audioSourceProvider.wrap(m_webMediaPlayer->audioSourceProvider()); 1046 m_audioSourceProvider.wrap(m_webMediaPlayer->audioSourceProvider());
1045 #endif 1047 #endif
1046 m_webMediaPlayer->setVolume(effectiveMediaVolume()); 1048 m_webMediaPlayer->setVolume(effectiveMediaVolume());
1047 1049
1048 m_webMediaPlayer->setPoster(posterImageURL()); 1050 m_webMediaPlayer->setPoster(posterImageURL());
1049 1051
1050 m_webMediaPlayer->setPreload(effectivePreloadType()); 1052 m_webMediaPlayer->setPreload(effectivePreloadType());
1051 1053
1052 m_webMediaPlayer->load(loadType(), kurl, corsMode()); 1054 m_webMediaPlayer->load(loadType(), kurl, corsMode());
1053 1055
1054 if (isFullscreen()) 1056 if (isFullscreen()) {
1055 m_webMediaPlayer->enterFullscreen(); 1057 // This handles any transition to or from fullscreen overlay mode.
1058 document().frame()->chromeClient().enterFullScreenForElement(this);
1059 }
1056 } 1060 }
1057 1061
1058 void HTMLMediaElement::setPlayerPreload() 1062 void HTMLMediaElement::setPlayerPreload()
1059 { 1063 {
1060 if (m_webMediaPlayer) 1064 if (m_webMediaPlayer)
1061 m_webMediaPlayer->setPreload(effectivePreloadType()); 1065 m_webMediaPlayer->setPreload(effectivePreloadType());
1062 1066
1063 if (loadIsDeferred() && preloadType() != WebMediaPlayer::PreloadNone) 1067 if (loadIsDeferred() && preloadType() != WebMediaPlayer::PreloadNone)
1064 startDeferredLoad(); 1068 startDeferredLoad();
1065 } 1069 }
(...skipping 2128 matching lines...) Expand 10 before | Expand all | Expand 10 after
3194 { 3198 {
3195 WTF_LOG(Media, "HTMLMediaElement::exitFullscreen(%p)", this); 3199 WTF_LOG(Media, "HTMLMediaElement::exitFullscreen(%p)", this);
3196 3200
3197 Fullscreen::from(document()).exitFullscreen(); 3201 Fullscreen::from(document()).exitFullscreen();
3198 } 3202 }
3199 3203
3200 void HTMLMediaElement::didBecomeFullscreenElement() 3204 void HTMLMediaElement::didBecomeFullscreenElement()
3201 { 3205 {
3202 if (mediaControls()) 3206 if (mediaControls())
3203 mediaControls()->enteredFullscreen(); 3207 mediaControls()->enteredFullscreen();
3204 if (RuntimeEnabledFeatures::overlayFullscreenVideoEnabled() && isHTMLVideoEl ement()) 3208 // Cache this in case the player is destroyed before leaving fullscreen.
3209 if ((m_inOverlayFullscreenVideo = useOverlayFullscreenVideo()))
Xianzhu 2015/08/03 22:39:02 Assignment in 'if' is error-prone. Please separate
watk 2015/08/03 23:36:48 Done.
3205 document().layoutView()->compositor()->setNeedsCompositingUpdate(Composi tingUpdateRebuildTree); 3210 document().layoutView()->compositor()->setNeedsCompositingUpdate(Composi tingUpdateRebuildTree);
3206 } 3211 }
3207 3212
3208 void HTMLMediaElement::willStopBeingFullscreenElement() 3213 void HTMLMediaElement::willStopBeingFullscreenElement()
3209 { 3214 {
3210 if (mediaControls()) 3215 if (mediaControls())
3211 mediaControls()->exitedFullscreen(); 3216 mediaControls()->exitedFullscreen();
3212 if (RuntimeEnabledFeatures::overlayFullscreenVideoEnabled() && isHTMLVideoEl ement()) 3217 if (m_inOverlayFullscreenVideo)
3213 document().layoutView()->compositor()->setNeedsCompositingUpdate(Composi tingUpdateRebuildTree); 3218 document().layoutView()->compositor()->setNeedsCompositingUpdate(Composi tingUpdateRebuildTree);
3219 m_inOverlayFullscreenVideo = false;
3214 } 3220 }
3215 3221
3216 WebLayer* HTMLMediaElement::platformLayer() const 3222 WebLayer* HTMLMediaElement::platformLayer() const
3217 { 3223 {
3218 return m_webLayer; 3224 return m_webLayer;
3219 } 3225 }
3220 3226
3221 bool HTMLMediaElement::hasClosedCaptions() const 3227 bool HTMLMediaElement::hasClosedCaptions() const
3222 { 3228 {
3223 if (m_textTracks) { 3229 if (m_textTracks) {
(...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after
3789 visitor->trace(m_client); 3795 visitor->trace(m_client);
3790 } 3796 }
3791 3797
3792 DEFINE_TRACE(HTMLMediaElement::AudioSourceProviderImpl) 3798 DEFINE_TRACE(HTMLMediaElement::AudioSourceProviderImpl)
3793 { 3799 {
3794 visitor->trace(m_client); 3800 visitor->trace(m_client);
3795 } 3801 }
3796 #endif 3802 #endif
3797 3803
3798 } 3804 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698