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

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

Issue 27420004: Remove threading from RendererGpuVideoAcceleratorFactories (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@dthread
Patch Set: f77fc38a Unittest fixes. Created 7 years, 1 month 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 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_thread_impl.h" 5 #include "content/renderer/render_thread_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <map> 9 #include <map>
10 #include <vector> 10 #include <vector>
(...skipping 856 matching lines...) Expand 10 before | Expand all | Expand 10 after
867 idle_notifications_to_skip_ = 2; 867 idle_notifications_to_skip_ = 2;
868 } 868 }
869 869
870 scoped_refptr<RendererGpuVideoAcceleratorFactories> 870 scoped_refptr<RendererGpuVideoAcceleratorFactories>
871 RenderThreadImpl::GetGpuFactories() { 871 RenderThreadImpl::GetGpuFactories() {
872 DCHECK(IsMainThread()); 872 DCHECK(IsMainThread());
873 873
874 scoped_refptr<GpuChannelHost> gpu_channel_host = GetGpuChannel(); 874 scoped_refptr<GpuChannelHost> gpu_channel_host = GetGpuChannel();
875 const CommandLine* cmd_line = CommandLine::ForCurrentProcess(); 875 const CommandLine* cmd_line = CommandLine::ForCurrentProcess();
876 scoped_refptr<RendererGpuVideoAcceleratorFactories> gpu_factories; 876 scoped_refptr<RendererGpuVideoAcceleratorFactories> gpu_factories;
877 scoped_refptr<base::MessageLoopProxy> media_loop_proxy =
878 GetMediaThreadMessageLoopProxy();
877 if (!cmd_line->HasSwitch(switches::kDisableAcceleratedVideoDecode)) { 879 if (!cmd_line->HasSwitch(switches::kDisableAcceleratedVideoDecode)) {
878 if (!gpu_va_context_provider_ || 880 if (!gpu_va_context_provider_ ||
879 gpu_va_context_provider_->DestroyedOnMainThread()) { 881 gpu_va_context_provider_->DestroyedOnMainThread()) {
880 if (!gpu_channel_host) { 882 if (!gpu_channel_host) {
881 gpu_channel_host = EstablishGpuChannelSync( 883 gpu_channel_host = EstablishGpuChannelSync(
882 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZ E); 884 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZ E);
883 } 885 }
884 gpu_va_context_provider_ = ContextProviderCommandBuffer::Create( 886 gpu_va_context_provider_ = ContextProviderCommandBuffer::Create(
885 make_scoped_ptr( 887 make_scoped_ptr(
886 WebGraphicsContext3DCommandBufferImpl::CreateOffscreenContext( 888 WebGraphicsContext3DCommandBufferImpl::CreateOffscreenContext(
887 gpu_channel_host.get(), 889 gpu_channel_host.get(),
888 WebKit::WebGraphicsContext3D::Attributes(), 890 WebKit::WebGraphicsContext3D::Attributes(),
889 GURL("chrome://gpu/RenderThreadImpl::GetGpuVDAContext3D"))), 891 GURL("chrome://gpu/RenderThreadImpl::GetGpuVDAContext3D"))),
890 "GPU-VideoAccelerator-Offscreen"); 892 "GPU-VideoAccelerator-Offscreen");
893 media_loop_proxy->PostTask(FROM_HERE, base::Bind(
894 base::IgnoreResult(&cc::ContextProvider::BindToCurrentThread),
Ami GONE FROM CHROMIUM 2013/10/26 19:30:26 I wonder if that IgnoreResult should be a CheckOnF
895 gpu_va_context_provider_));
891 } 896 }
892 } 897 }
893 if (gpu_channel_host) { 898 if (gpu_channel_host) {
894 gpu_factories = new RendererGpuVideoAcceleratorFactories( 899 gpu_factories = new RendererGpuVideoAcceleratorFactories(
895 gpu_channel_host.get(), gpu_va_context_provider_); 900 gpu_channel_host, media_loop_proxy, gpu_va_context_provider_);
896 } 901 }
897 return gpu_factories; 902 return gpu_factories;
898 } 903 }
899 904
900 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> 905 scoped_ptr<WebGraphicsContext3DCommandBufferImpl>
901 RenderThreadImpl::CreateOffscreenContext3d() { 906 RenderThreadImpl::CreateOffscreenContext3d() {
902 WebKit::WebGraphicsContext3D::Attributes attributes; 907 WebKit::WebGraphicsContext3D::Attributes attributes;
903 attributes.shareResources = true; 908 attributes.shareResources = true;
904 attributes.depth = false; 909 attributes.depth = false;
905 attributes.stencil = false; 910 attributes.stencil = false;
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after
1344 if (!gamepad_shared_memory_reader_) 1349 if (!gamepad_shared_memory_reader_)
1345 gamepad_shared_memory_reader_.reset(new GamepadSharedMemoryReader); 1350 gamepad_shared_memory_reader_.reset(new GamepadSharedMemoryReader);
1346 gamepad_shared_memory_reader_->SampleGamepads(*data); 1351 gamepad_shared_memory_reader_->SampleGamepads(*data);
1347 } 1352 }
1348 1353
1349 base::ProcessId RenderThreadImpl::renderer_process_id() const { 1354 base::ProcessId RenderThreadImpl::renderer_process_id() const {
1350 return renderer_process_id_; 1355 return renderer_process_id_;
1351 } 1356 }
1352 1357
1353 } // namespace content 1358 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698