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

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

Issue 159263004: Remove threading from GpuVideoAcceleratorFactories (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 0f7ba9fd NULL pointer fix. Created 6 years, 10 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 | Annotate | Revision Log
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 880 matching lines...) Expand 10 before | Expand all | Expand 10 after
891 idle_notifications_to_skip_ = 2; 891 idle_notifications_to_skip_ = 2;
892 } 892 }
893 893
894 scoped_refptr<RendererGpuVideoAcceleratorFactories> 894 scoped_refptr<RendererGpuVideoAcceleratorFactories>
895 RenderThreadImpl::GetGpuFactories() { 895 RenderThreadImpl::GetGpuFactories() {
896 DCHECK(IsMainThread()); 896 DCHECK(IsMainThread());
897 897
898 scoped_refptr<GpuChannelHost> gpu_channel_host = GetGpuChannel(); 898 scoped_refptr<GpuChannelHost> gpu_channel_host = GetGpuChannel();
899 const CommandLine* cmd_line = CommandLine::ForCurrentProcess(); 899 const CommandLine* cmd_line = CommandLine::ForCurrentProcess();
900 scoped_refptr<RendererGpuVideoAcceleratorFactories> gpu_factories; 900 scoped_refptr<RendererGpuVideoAcceleratorFactories> gpu_factories;
901 scoped_refptr<base::MessageLoopProxy> media_loop_proxy =
902 GetMediaThreadMessageLoopProxy();
901 if (!cmd_line->HasSwitch(switches::kDisableAcceleratedVideoDecode)) { 903 if (!cmd_line->HasSwitch(switches::kDisableAcceleratedVideoDecode)) {
902 if (!gpu_va_context_provider_ || 904 if (!gpu_va_context_provider_ ||
903 gpu_va_context_provider_->DestroyedOnMainThread()) { 905 gpu_va_context_provider_->DestroyedOnMainThread()) {
904 if (!gpu_channel_host) { 906 if (!gpu_channel_host) {
905 gpu_channel_host = EstablishGpuChannelSync( 907 gpu_channel_host = EstablishGpuChannelSync(
906 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZ E); 908 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZ E);
907 } 909 }
908 gpu_va_context_provider_ = ContextProviderCommandBuffer::Create( 910 gpu_va_context_provider_ = ContextProviderCommandBuffer::Create(
909 make_scoped_ptr( 911 make_scoped_ptr(
910 WebGraphicsContext3DCommandBufferImpl::CreateOffscreenContext( 912 WebGraphicsContext3DCommandBufferImpl::CreateOffscreenContext(
911 gpu_channel_host.get(), 913 gpu_channel_host.get(),
912 blink::WebGraphicsContext3D::Attributes(), 914 blink::WebGraphicsContext3D::Attributes(),
913 GURL("chrome://gpu/RenderThreadImpl::GetGpuVDAContext3D"), 915 GURL("chrome://gpu/RenderThreadImpl::GetGpuVDAContext3D"),
914 WebGraphicsContext3DCommandBufferImpl::SharedMemoryLimits())), 916 WebGraphicsContext3DCommandBufferImpl::SharedMemoryLimits())),
915 "GPU-VideoAccelerator-Offscreen"); 917 "GPU-VideoAccelerator-Offscreen");
918 if (gpu_va_context_provider_) {
919 media_loop_proxy->PostTask(
920 FROM_HERE,
921 base::Bind(
922 base::IgnoreResult(&cc::ContextProvider::BindToCurrentThread),
923 gpu_va_context_provider_));
924 }
916 } 925 }
917 } 926 }
918 if (gpu_channel_host) { 927 if (gpu_va_context_provider_) {
919 gpu_factories = new RendererGpuVideoAcceleratorFactories( 928 gpu_factories = new RendererGpuVideoAcceleratorFactories(
920 gpu_channel_host.get(), gpu_va_context_provider_); 929 gpu_channel_host, media_loop_proxy, gpu_va_context_provider_);
921 } 930 }
922 return gpu_factories; 931 return gpu_factories;
923 } 932 }
924 933
925 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> 934 scoped_ptr<WebGraphicsContext3DCommandBufferImpl>
926 RenderThreadImpl::CreateOffscreenContext3d() { 935 RenderThreadImpl::CreateOffscreenContext3d() {
927 blink::WebGraphicsContext3D::Attributes attributes; 936 blink::WebGraphicsContext3D::Attributes attributes;
928 attributes.shareResources = true; 937 attributes.shareResources = true;
929 attributes.depth = false; 938 attributes.depth = false;
930 attributes.stencil = false; 939 attributes.stencil = false;
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after
1411 hidden_widget_count_--; 1420 hidden_widget_count_--;
1412 1421
1413 if (!GetContentClient()->renderer()->RunIdleHandlerWhenWidgetsHidden()) { 1422 if (!GetContentClient()->renderer()->RunIdleHandlerWhenWidgetsHidden()) {
1414 return; 1423 return;
1415 } 1424 }
1416 1425
1417 ScheduleIdleHandler(kLongIdleHandlerDelayMs); 1426 ScheduleIdleHandler(kLongIdleHandlerDelayMs);
1418 } 1427 }
1419 1428
1420 } // namespace content 1429 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/media/webmediaplayer_impl.cc ('k') | media/cast/test/fake_gpu_video_accelerator_factories.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698