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

Side by Side Diff: content/browser/renderer_host/media/video_capture_device_client.cc

Issue 1359163005: Remove surface_id from RenderWidget/RenderWidgetHost and friends (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@channel_creation_preempt
Patch Set: fix more tests Created 5 years, 3 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 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/browser/renderer_host/media/video_capture_device_client.h" 5 #include "content/browser/renderer_host/media/video_capture_device_client.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 24 matching lines...) Expand all
35 using media::VideoFrame; 35 using media::VideoFrame;
36 using media::VideoFrameMetadata; 36 using media::VideoFrameMetadata;
37 37
38 namespace content { 38 namespace content {
39 39
40 namespace { 40 namespace {
41 41
42 #if !defined(OS_ANDROID) 42 #if !defined(OS_ANDROID)
43 // Modelled after GpuProcessTransportFactory::CreateContextCommon(). 43 // Modelled after GpuProcessTransportFactory::CreateContextCommon().
44 scoped_ptr<content::WebGraphicsContext3DCommandBufferImpl> CreateContextCommon( 44 scoped_ptr<content::WebGraphicsContext3DCommandBufferImpl> CreateContextCommon(
45 scoped_refptr<content::GpuChannelHost> gpu_channel_host, 45 scoped_refptr<content::GpuChannelHost> gpu_channel_host) {
46 int surface_id) {
47 if (!content::GpuDataManagerImpl::GetInstance()-> 46 if (!content::GpuDataManagerImpl::GetInstance()->
48 CanUseGpuBrowserCompositor()) { 47 CanUseGpuBrowserCompositor()) {
49 DLOG(ERROR) << "No accelerated graphics found. Check chrome://gpu"; 48 DLOG(ERROR) << "No accelerated graphics found. Check chrome://gpu";
50 return scoped_ptr<content::WebGraphicsContext3DCommandBufferImpl>(); 49 return scoped_ptr<content::WebGraphicsContext3DCommandBufferImpl>();
51 } 50 }
52 blink::WebGraphicsContext3D::Attributes attrs; 51 blink::WebGraphicsContext3D::Attributes attrs;
53 attrs.shareResources = true; 52 attrs.shareResources = true;
54 attrs.depth = false; 53 attrs.depth = false;
55 attrs.stencil = false; 54 attrs.stencil = false;
56 attrs.antialias = false; 55 attrs.antialias = false;
57 attrs.noAutomaticFlushes = true; 56 attrs.noAutomaticFlushes = true;
58 57
59 if (!gpu_channel_host.get()) { 58 if (!gpu_channel_host.get()) {
60 DLOG(ERROR) << "Failed to establish GPU channel."; 59 DLOG(ERROR) << "Failed to establish GPU channel.";
61 return scoped_ptr<content::WebGraphicsContext3DCommandBufferImpl>(); 60 return scoped_ptr<content::WebGraphicsContext3DCommandBufferImpl>();
62 } 61 }
63 GURL url("chrome://gpu/GpuProcessTransportFactory::CreateCaptureContext"); 62 GURL url("chrome://gpu/GpuProcessTransportFactory::CreateCaptureContext");
64 return make_scoped_ptr( 63 return make_scoped_ptr(new WebGraphicsContext3DCommandBufferImpl(
65 new WebGraphicsContext3DCommandBufferImpl( 64 0, url, gpu_channel_host.get(), attrs,
66 surface_id, 65 true /* lose_context_when_out_of_memory */,
67 url, 66 content::WebGraphicsContext3DCommandBufferImpl::SharedMemoryLimits(),
68 gpu_channel_host.get(), 67 NULL));
69 attrs,
70 true /* lose_context_when_out_of_memory */,
71 content::WebGraphicsContext3DCommandBufferImpl::SharedMemoryLimits(),
72 NULL));
73 } 68 }
74 69
75 // Modelled after 70 // Modelled after
76 // GpuProcessTransportFactory::CreateOffscreenCommandBufferContext(). 71 // GpuProcessTransportFactory::CreateOffscreenCommandBufferContext().
77 scoped_ptr<content::WebGraphicsContext3DCommandBufferImpl> 72 scoped_ptr<content::WebGraphicsContext3DCommandBufferImpl>
78 CreateOffscreenCommandBufferContext() { 73 CreateOffscreenCommandBufferContext() {
79 content::CauseForGpuLaunch cause = content::CAUSE_FOR_GPU_LAUNCH_CANVAS_2D; 74 content::CauseForGpuLaunch cause = content::CAUSE_FOR_GPU_LAUNCH_CANVAS_2D;
80 // Android does not support synchronous opening of GPU channels. Should use 75 // Android does not support synchronous opening of GPU channels. Should use
81 // EstablishGpuChannel() instead. 76 // EstablishGpuChannel() instead.
82 if (!content::BrowserGpuChannelHostFactory::instance()) 77 if (!content::BrowserGpuChannelHostFactory::instance())
83 return scoped_ptr<content::WebGraphicsContext3DCommandBufferImpl>(); 78 return scoped_ptr<content::WebGraphicsContext3DCommandBufferImpl>();
84 scoped_refptr<content::GpuChannelHost> gpu_channel_host( 79 scoped_refptr<content::GpuChannelHost> gpu_channel_host(
85 content::BrowserGpuChannelHostFactory::instance()-> 80 content::BrowserGpuChannelHostFactory::instance()->
86 EstablishGpuChannelSync(cause)); 81 EstablishGpuChannelSync(cause));
87 DCHECK(gpu_channel_host); 82 DCHECK(gpu_channel_host);
88 return CreateContextCommon(gpu_channel_host, 0); 83 return CreateContextCommon(gpu_channel_host);
89 } 84 }
90 #endif 85 #endif
91 86
92 typedef base::Callback<void(scoped_refptr<ContextProviderCommandBuffer>)> 87 typedef base::Callback<void(scoped_refptr<ContextProviderCommandBuffer>)>
93 ProcessContextCallback; 88 ProcessContextCallback;
94 89
95 void CreateContextOnUIThread(ProcessContextCallback bottom_half) { 90 void CreateContextOnUIThread(ProcessContextCallback bottom_half) {
96 DCHECK_CURRENTLY_ON(BrowserThread::UI); 91 DCHECK_CURRENTLY_ON(BrowserThread::UI);
97 #if !defined(OS_ANDROID) 92 #if !defined(OS_ANDROID)
98 bottom_half.Run(ContextProviderCommandBuffer::Create( 93 bottom_half.Run(ContextProviderCommandBuffer::Create(
(...skipping 667 matching lines...) Expand 10 before | Expand all | Expand 10 after
766 void VideoCaptureDeviceClient::TextureWrapHelper::OnError( 761 void VideoCaptureDeviceClient::TextureWrapHelper::OnError(
767 const std::string& message) { 762 const std::string& message) {
768 DCHECK(capture_task_runner_->BelongsToCurrentThread()); 763 DCHECK(capture_task_runner_->BelongsToCurrentThread());
769 DLOG(ERROR) << message; 764 DLOG(ERROR) << message;
770 BrowserThread::PostTask( 765 BrowserThread::PostTask(
771 BrowserThread::IO, FROM_HERE, 766 BrowserThread::IO, FROM_HERE,
772 base::Bind(&VideoCaptureController::DoErrorOnIOThread, controller_)); 767 base::Bind(&VideoCaptureController::DoErrorOnIOThread, controller_));
773 } 768 }
774 769
775 } // namespace content 770 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698