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

Side by Side Diff: content/renderer/render_frame_impl.cc

Issue 1292433002: Defer media playback in background tabs. (Closed) Base URL: http://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
« no previous file with comments | « content/renderer/render_frame_impl.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 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/renderer/render_frame_impl.h" 5 #include "content/renderer/render_frame_impl.h"
6 6
7 #include <map> 7 #include <map>
8 #include <string> 8 #include <string>
9 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 658 matching lines...) Expand 10 before | Expand all | Expand 10 after
669 midi_dispatcher_(NULL), 669 midi_dispatcher_(NULL),
670 #if defined(OS_ANDROID) 670 #if defined(OS_ANDROID)
671 media_player_manager_(NULL), 671 media_player_manager_(NULL),
672 #endif 672 #endif
673 #if defined(ENABLE_BROWSER_CDMS) 673 #if defined(ENABLE_BROWSER_CDMS)
674 cdm_manager_(NULL), 674 cdm_manager_(NULL),
675 #endif 675 #endif
676 #if defined(VIDEO_HOLE) 676 #if defined(VIDEO_HOLE)
677 contains_media_player_(false), 677 contains_media_player_(false),
678 #endif 678 #endif
679 has_played_media_(false),
679 devtools_agent_(nullptr), 680 devtools_agent_(nullptr),
680 geolocation_dispatcher_(NULL), 681 geolocation_dispatcher_(NULL),
681 push_messaging_dispatcher_(NULL), 682 push_messaging_dispatcher_(NULL),
682 presentation_dispatcher_(NULL), 683 presentation_dispatcher_(NULL),
683 screen_orientation_dispatcher_(NULL), 684 screen_orientation_dispatcher_(NULL),
684 manifest_manager_(NULL), 685 manifest_manager_(NULL),
685 accessibility_mode_(AccessibilityModeOff), 686 accessibility_mode_(AccessibilityModeOff),
686 renderer_accessibility_(NULL), 687 renderer_accessibility_(NULL),
687 weak_factory_(this) { 688 weak_factory_(this) {
688 std::pair<RoutingIDFrameMap::iterator, bool> result = 689 std::pair<RoutingIDFrameMap::iterator, bool> result =
(...skipping 1345 matching lines...) Expand 10 before | Expand all | Expand 10 after
2034 #if defined(OS_ANDROID) && !defined(ENABLE_MEDIA_PIPELINE_ON_ANDROID) 2035 #if defined(OS_ANDROID) && !defined(ENABLE_MEDIA_PIPELINE_ON_ANDROID)
2035 return CreateAndroidWebMediaPlayer(client, encrypted_client, 2036 return CreateAndroidWebMediaPlayer(client, encrypted_client,
2036 GetMediaPermission(), initial_cdm); 2037 GetMediaPermission(), initial_cdm);
2037 #else 2038 #else
2038 scoped_refptr<media::MediaLog> media_log(new RenderMediaLog()); 2039 scoped_refptr<media::MediaLog> media_log(new RenderMediaLog());
2039 2040
2040 RenderThreadImpl* render_thread = RenderThreadImpl::current(); 2041 RenderThreadImpl* render_thread = RenderThreadImpl::current();
2041 media::WebMediaPlayerParams params( 2042 media::WebMediaPlayerParams params(
2042 base::Bind(&ContentRendererClient::DeferMediaLoad, 2043 base::Bind(&ContentRendererClient::DeferMediaLoad,
2043 base::Unretained(GetContentClient()->renderer()), 2044 base::Unretained(GetContentClient()->renderer()),
2044 static_cast<RenderFrame*>(this)), 2045 static_cast<RenderFrame*>(this), has_played_media_),
2045 render_thread->GetAudioRendererMixerManager()->CreateInput(routing_id_), 2046 render_thread->GetAudioRendererMixerManager()->CreateInput(routing_id_),
2046 media_log, render_thread->GetMediaThreadTaskRunner(), 2047 media_log, render_thread->GetMediaThreadTaskRunner(),
2047 render_thread->compositor_task_runner(), 2048 render_thread->compositor_task_runner(),
2048 base::Bind(&GetSharedMainThreadContext3D), GetMediaPermission(), 2049 base::Bind(&GetSharedMainThreadContext3D), GetMediaPermission(),
2049 initial_cdm); 2050 initial_cdm);
2050 2051
2051 #if defined(ENABLE_MOJO_MEDIA) 2052 #if defined(ENABLE_MOJO_MEDIA)
2052 scoped_ptr<media::RendererFactory> media_renderer_factory( 2053 scoped_ptr<media::RendererFactory> media_renderer_factory(
2053 new media::MojoRendererFactory(GetMediaServiceFactory())); 2054 new media::MojoRendererFactory(GetMediaServiceFactory()));
2054 #else 2055 #else
(...skipping 1765 matching lines...) Expand 10 before | Expand all | Expand 10 after
3820 #if defined(ENABLE_WEBVR) 3821 #if defined(ENABLE_WEBVR)
3821 blink::WebVRClient* RenderFrameImpl::webVRClient() { 3822 blink::WebVRClient* RenderFrameImpl::webVRClient() {
3822 if (!vr_dispatcher_) 3823 if (!vr_dispatcher_)
3823 vr_dispatcher_.reset(new VRDispatcher(GetServiceRegistry())); 3824 vr_dispatcher_.reset(new VRDispatcher(GetServiceRegistry()));
3824 3825
3825 return vr_dispatcher_.get(); 3826 return vr_dispatcher_.get();
3826 } 3827 }
3827 #endif 3828 #endif
3828 3829
3829 void RenderFrameImpl::DidPlay(WebMediaPlayer* player) { 3830 void RenderFrameImpl::DidPlay(WebMediaPlayer* player) {
3831 has_played_media_ = true;
3830 Send(new FrameHostMsg_MediaPlayingNotification( 3832 Send(new FrameHostMsg_MediaPlayingNotification(
3831 routing_id_, reinterpret_cast<int64>(player), player->hasVideo(), 3833 routing_id_, reinterpret_cast<int64>(player), player->hasVideo(),
3832 player->hasAudio(), player->isRemote())); 3834 player->hasAudio(), player->isRemote()));
3833 } 3835 }
3834 3836
3835 void RenderFrameImpl::DidPause(WebMediaPlayer* player) { 3837 void RenderFrameImpl::DidPause(WebMediaPlayer* player) {
3836 Send(new FrameHostMsg_MediaPausedNotification( 3838 Send(new FrameHostMsg_MediaPausedNotification(
3837 routing_id_, reinterpret_cast<int64>(player))); 3839 routing_id_, reinterpret_cast<int64>(player)));
3838 } 3840 }
3839 3841
(...skipping 1233 matching lines...) Expand 10 before | Expand all | Expand 10 after
5073 void RenderFrameImpl::RegisterMojoServices() { 5075 void RenderFrameImpl::RegisterMojoServices() {
5074 // Only main frame have ImageDownloader service. 5076 // Only main frame have ImageDownloader service.
5075 if (!frame_->parent()) { 5077 if (!frame_->parent()) {
5076 GetServiceRegistry()->AddService<image_downloader::ImageDownloader>( 5078 GetServiceRegistry()->AddService<image_downloader::ImageDownloader>(
5077 base::Bind(&ImageDownloaderImpl::CreateMojoService, 5079 base::Bind(&ImageDownloaderImpl::CreateMojoService,
5078 base::Unretained(this))); 5080 base::Unretained(this)));
5079 } 5081 }
5080 } 5082 }
5081 5083
5082 } // namespace content 5084 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/render_frame_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698