OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/android/in_process/synchronous_compositor_factory_impl
.h" | 5 #include "content/browser/android/in_process/synchronous_compositor_factory_impl
.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 #include <utility> |
8 | 9 |
9 #include "base/command_line.h" | 10 #include "base/command_line.h" |
10 #include "base/macros.h" | 11 #include "base/macros.h" |
11 #include "base/observer_list.h" | 12 #include "base/observer_list.h" |
12 #include "base/sys_info.h" | 13 #include "base/sys_info.h" |
13 #include "base/thread_task_runner_handle.h" | 14 #include "base/thread_task_runner_handle.h" |
14 #include "content/browser/android/in_process/context_provider_in_process.h" | 15 #include "content/browser/android/in_process/context_provider_in_process.h" |
15 #include "content/browser/android/in_process/synchronous_compositor_impl.h" | 16 #include "content/browser/android/in_process/synchronous_compositor_impl.h" |
16 #include "content/browser/android/in_process/synchronous_compositor_registry_in_
proc.h" | 17 #include "content/browser/android/in_process/synchronous_compositor_registry_in_
proc.h" |
17 #include "content/browser/gpu/browser_gpu_memory_buffer_manager.h" | 18 #include "content/browser/gpu/browser_gpu_memory_buffer_manager.h" |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 gfx::Size(1, 1), NULL /* share_context */, attributes.shareResources, | 71 gfx::Size(1, 1), NULL /* share_context */, attributes.shareResources, |
71 in_process_attribs, gfx::PreferDiscreteGpu, mem_limits, | 72 in_process_attribs, gfx::PreferDiscreteGpu, mem_limits, |
72 BrowserGpuMemoryBufferManager::current(), nullptr)); | 73 BrowserGpuMemoryBufferManager::current(), nullptr)); |
73 | 74 |
74 gpu::GLInProcessContext* context_ptr = context.get(); | 75 gpu::GLInProcessContext* context_ptr = context.get(); |
75 | 76 |
76 ContextHolder holder; | 77 ContextHolder holder; |
77 holder.command_buffer = | 78 holder.command_buffer = |
78 scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl>( | 79 scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl>( |
79 WebGraphicsContext3DInProcessCommandBufferImpl::WrapContext( | 80 WebGraphicsContext3DInProcessCommandBufferImpl::WrapContext( |
80 context.Pass(), attributes)); | 81 std::move(context), attributes)); |
81 holder.gl_in_process_context = context_ptr; | 82 holder.gl_in_process_context = context_ptr; |
82 | 83 |
83 return holder; | 84 return holder; |
84 } | 85 } |
85 | 86 |
86 } // namespace | 87 } // namespace |
87 | 88 |
88 class SynchronousCompositorFactoryImpl::VideoContextProvider | 89 class SynchronousCompositorFactoryImpl::VideoContextProvider |
89 : public StreamTextureFactorySynchronousImpl::ContextProvider { | 90 : public StreamTextureFactorySynchronousImpl::ContextProvider { |
90 public: | 91 public: |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 DCHECK(android_view_service_.get()); | 234 DCHECK(android_view_service_.get()); |
234 | 235 |
235 blink::WebGraphicsContext3D::Attributes attributes = GetDefaultAttribs(); | 236 blink::WebGraphicsContext3D::Attributes attributes = GetDefaultAttribs(); |
236 attributes.shareResources = false; | 237 attributes.shareResources = false; |
237 // This needs to run in on-screen |android_view_service_| context due to | 238 // This needs to run in on-screen |android_view_service_| context due to |
238 // SurfaceTexture limitations. | 239 // SurfaceTexture limitations. |
239 ContextHolder holder = | 240 ContextHolder holder = |
240 CreateContextHolder(attributes, android_view_service_, | 241 CreateContextHolder(attributes, android_view_service_, |
241 gpu::GLInProcessContextSharedMemoryLimits(), false); | 242 gpu::GLInProcessContextSharedMemoryLimits(), false); |
242 video_context_provider_ = new VideoContextProvider( | 243 video_context_provider_ = new VideoContextProvider( |
243 ContextProviderInProcess::Create(holder.command_buffer.Pass(), | 244 ContextProviderInProcess::Create(std::move(holder.command_buffer), |
244 "Video-Offscreen-main-thread"), | 245 "Video-Offscreen-main-thread"), |
245 holder.gl_in_process_context); | 246 holder.gl_in_process_context); |
246 } | 247 } |
247 return video_context_provider_; | 248 return video_context_provider_; |
248 } | 249 } |
249 | 250 |
250 void SynchronousCompositorFactoryImpl::SetDeferredGpuService( | 251 void SynchronousCompositorFactoryImpl::SetDeferredGpuService( |
251 scoped_refptr<gpu::InProcessCommandBuffer::Service> service) { | 252 scoped_refptr<gpu::InProcessCommandBuffer::Service> service) { |
252 DCHECK(!android_view_service_.get()); | 253 DCHECK(!android_view_service_.get()); |
253 android_view_service_ = service; | 254 android_view_service_ = service; |
254 } | 255 } |
255 | 256 |
256 } // namespace content | 257 } // namespace content |
OLD | NEW |