summaryrefslogtreecommitdiffstats
path: root/content
diff options
context:
space:
mode:
authorsheu@chromium.org <sheu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-10-19 18:05:07 +0000
committersheu@chromium.org <sheu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-10-19 18:05:07 +0000
commitc50edb9626d82e6637453ebe938b6f967898e816 (patch)
tree2545d7c4477bdf8b370e8d3bdeb81e753a795c2c /content
parent7d668551c47c697f1214118e34ca7634f18c3701 (diff)
downloadchromium_src-c50edb9626d82e6637453ebe938b6f967898e816.zip
chromium_src-c50edb9626d82e6637453ebe938b6f967898e816.tar.gz
chromium_src-c50edb9626d82e6637453ebe938b6f967898e816.tar.bz2
Remove message loop parameter from RenderThreadImpl::GetGpuFactories()
RenderThreadImpl::GetGpuFactories() makes the assumption that all the GpuVideoAcceleratorFactories retrieved from it can use the same 3D context. This is only true if all the factories use the same message loop for the 3D context. Ensure this by unconditionally using RenderThreadImpl::GetMediaThreadMessageLoopProxy() for that message loop. This change should be a functional no-op according to the current architecture. BUG=306333 TEST=local build, run on CrOS snow, build on desktop Linux Review URL: https://codereview.chromium.org/27019011 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@229600 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r--content/renderer/media/media_stream_dependency_factory.cc4
-rw-r--r--content/renderer/media/renderer_gpu_video_accelerator_factories.cc5
-rw-r--r--content/renderer/media/renderer_gpu_video_accelerator_factories.h5
-rw-r--r--content/renderer/media/webmediaplayer_impl.cc5
-rw-r--r--content/renderer/render_thread_impl.cc5
-rw-r--r--content/renderer/render_thread_impl.h4
-rw-r--r--content/renderer/render_view_impl.cc6
7 files changed, 15 insertions, 19 deletions
diff --git a/content/renderer/media/media_stream_dependency_factory.cc b/content/renderer/media/media_stream_dependency_factory.cc
index 1a7fd53..c05d889 100644
--- a/content/renderer/media/media_stream_dependency_factory.cc
+++ b/content/renderer/media/media_stream_dependency_factory.cc
@@ -520,10 +520,8 @@ bool MediaStreamDependencyFactory::CreatePeerConnectionFactory() {
scoped_ptr<cricket::WebRtcVideoEncoderFactory> encoder_factory;
const CommandLine* cmd_line = CommandLine::ForCurrentProcess();
- scoped_refptr<base::MessageLoopProxy> media_loop_proxy =
- RenderThreadImpl::current()->GetMediaThreadMessageLoopProxy();
scoped_refptr<RendererGpuVideoAcceleratorFactories> gpu_factories =
- RenderThreadImpl::current()->GetGpuFactories(media_loop_proxy);
+ RenderThreadImpl::current()->GetGpuFactories();
#if !defined(GOOGLE_TV)
if (!cmd_line->HasSwitch(switches::kDisableWebRtcHWDecoding)) {
if (gpu_factories)
diff --git a/content/renderer/media/renderer_gpu_video_accelerator_factories.cc b/content/renderer/media/renderer_gpu_video_accelerator_factories.cc
index 99b6771..dfee4d2 100644
--- a/content/renderer/media/renderer_gpu_video_accelerator_factories.cc
+++ b/content/renderer/media/renderer_gpu_video_accelerator_factories.cc
@@ -12,6 +12,7 @@
#include "content/common/gpu/client/context_provider_command_buffer.h"
#include "content/common/gpu/client/gpu_channel_host.h"
#include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h"
+#include "content/renderer/render_thread_impl.h"
#include "gpu/command_buffer/client/gles2_implementation.h"
#include "third_party/skia/include/core/SkPixelRef.h"
@@ -20,9 +21,9 @@ namespace content {
RendererGpuVideoAcceleratorFactories::~RendererGpuVideoAcceleratorFactories() {}
RendererGpuVideoAcceleratorFactories::RendererGpuVideoAcceleratorFactories(
GpuChannelHost* gpu_channel_host,
- const scoped_refptr<base::MessageLoopProxy>& message_loop,
const scoped_refptr<ContextProviderCommandBuffer>& context_provider)
- : message_loop_(message_loop),
+ : message_loop_(
+ RenderThreadImpl::current()->GetMediaThreadMessageLoopProxy()),
gpu_channel_host_(gpu_channel_host),
context_provider_(context_provider),
thread_safe_sender_(ChildThread::current()->thread_safe_sender()),
diff --git a/content/renderer/media/renderer_gpu_video_accelerator_factories.h b/content/renderer/media/renderer_gpu_video_accelerator_factories.h
index e9beefc..44cc9d0 100644
--- a/content/renderer/media/renderer_gpu_video_accelerator_factories.h
+++ b/content/renderer/media/renderer_gpu_video_accelerator_factories.h
@@ -33,8 +33,8 @@ class WebGraphicsContext3DCommandBufferImpl;
// implementation from render_view_impl.cc which is already far too large.
//
// The public methods of the class can be called from any thread, and are
-// internally trampolined to the appropriate thread. GPU/GL-related calls go to
-// the constructor-argument loop (the media thread).
+// internally trampolined to the appropriate thread. GPU/GL-related calls must
+// be made on the media thread.
class CONTENT_EXPORT RendererGpuVideoAcceleratorFactories
: public media::GpuVideoAcceleratorFactories {
public:
@@ -42,7 +42,6 @@ class CONTENT_EXPORT RendererGpuVideoAcceleratorFactories
// use.
RendererGpuVideoAcceleratorFactories(
GpuChannelHost* gpu_channel_host,
- const scoped_refptr<base::MessageLoopProxy>& message_loop,
const scoped_refptr<ContextProviderCommandBuffer>& context_provider);
// media::GpuVideoAcceleratorFactories implementation.
diff --git a/content/renderer/media/webmediaplayer_impl.cc b/content/renderer/media/webmediaplayer_impl.cc
index 15c6b00..8b2f44a 100644
--- a/content/renderer/media/webmediaplayer_impl.cc
+++ b/content/renderer/media/webmediaplayer_impl.cc
@@ -165,6 +165,11 @@ WebMediaPlayerImpl::WebMediaPlayerImpl(
pipeline_.reset(new media::Pipeline(media_loop_, media_log_.get()));
+ // |gpu_factories_| requires that its entry points be called on its
+ // |GetMessageLoop()|. Since |pipeline_| will own decoders created from the
+ // factories, require that their message loops are identical.
+ DCHECK(!gpu_factories_ || (gpu_factories_->GetMessageLoop() == media_loop_));
+
// Let V8 know we started new thread if we did not do it yet.
// Made separate task to avoid deletion of player currently being created.
// Also, delaying GC until after player starts gets rid of starting lag --
diff --git a/content/renderer/render_thread_impl.cc b/content/renderer/render_thread_impl.cc
index 333dc01..4f719e3 100644
--- a/content/renderer/render_thread_impl.cc
+++ b/content/renderer/render_thread_impl.cc
@@ -866,8 +866,7 @@ void RenderThreadImpl::PostponeIdleNotification() {
}
scoped_refptr<RendererGpuVideoAcceleratorFactories>
-RenderThreadImpl::GetGpuFactories(
- const scoped_refptr<base::MessageLoopProxy>& factories_loop) {
+RenderThreadImpl::GetGpuFactories() {
DCHECK(IsMainThread());
const CommandLine* cmd_line = CommandLine::ForCurrentProcess();
@@ -887,7 +886,7 @@ RenderThreadImpl::GetGpuFactories(
GpuChannelHost* gpu_channel_host = GetGpuChannel();
if (gpu_channel_host) {
gpu_factories = new RendererGpuVideoAcceleratorFactories(
- gpu_channel_host, factories_loop, gpu_va_context_provider_);
+ gpu_channel_host, gpu_va_context_provider_);
}
return gpu_factories;
}
diff --git a/content/renderer/render_thread_impl.h b/content/renderer/render_thread_impl.h
index f8cec0d..b2e7e9b 100644
--- a/content/renderer/render_thread_impl.h
+++ b/content/renderer/render_thread_impl.h
@@ -263,9 +263,7 @@ class CONTENT_EXPORT RenderThreadImpl : public RenderThread,
// not sent for at least one notification delay.
void PostponeIdleNotification();
- // Gets gpu factories, which will run on |factories_loop|.
- scoped_refptr<RendererGpuVideoAcceleratorFactories> GetGpuFactories(
- const scoped_refptr<base::MessageLoopProxy>& factories_loop);
+ scoped_refptr<RendererGpuVideoAcceleratorFactories> GetGpuFactories();
scoped_refptr<cc::ContextProvider> OffscreenCompositorContextProvider();
scoped_refptr<cc::ContextProvider> SharedMainThreadContextProvider();
diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc
index 9cf66c3..be6f157 100644
--- a/content/renderer/render_view_impl.cc
+++ b/content/renderer/render_view_impl.cc
@@ -3153,17 +3153,13 @@ WebMediaPlayer* RenderViewImpl::createMediaPlayer(
DVLOG(1) << "Using AudioRendererMixerManager-provided sink: " << sink.get();
}
- scoped_refptr<media::GpuVideoAcceleratorFactories> gpu_factories =
- RenderThreadImpl::current()->GetGpuFactories(
- RenderThreadImpl::current()->GetMediaThreadMessageLoopProxy());
-
WebMediaPlayerParams params(
RenderThreadImpl::current()->GetMediaThreadMessageLoopProxy(),
base::Bind(&ContentRendererClient::DeferMediaLoad,
base::Unretained(GetContentClient()->renderer()),
static_cast<RenderView*>(this)),
sink,
- gpu_factories,
+ RenderThreadImpl::current()->GetGpuFactories(),
new RenderMediaLog());
return new WebMediaPlayerImpl(frame, client, AsWeakPtr(), params);
}