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

Side by Side Diff: services/ui/surfaces/surfaces_context_provider.cc

Issue 2280723004: services/ui: Remove unwanted gpu dependency from services/ui/surfaces. (Closed)
Patch Set: . Created 4 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
« no previous file with comments | « services/ui/surfaces/surfaces_context_provider.h ('k') | services/ui/ws/DEPS » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "services/ui/surfaces/surfaces_context_provider.h" 5 #include "services/ui/surfaces/surfaces_context_provider.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
11 #include "base/command_line.h" 11 #include "base/command_line.h"
12 #include "base/synchronization/waitable_event.h" 12 #include "base/synchronization/waitable_event.h"
13 #include "base/threading/thread_task_runner_handle.h" 13 #include "base/threading/thread_task_runner_handle.h"
14 #include "build/build_config.h" 14 #include "build/build_config.h"
15 #include "gpu/command_buffer/client/gles2_cmd_helper.h" 15 #include "gpu/command_buffer/client/gles2_cmd_helper.h"
16 #include "gpu/command_buffer/client/gles2_implementation.h" 16 #include "gpu/command_buffer/client/gles2_implementation.h"
17 #include "gpu/command_buffer/client/shared_memory_limits.h" 17 #include "gpu/command_buffer/client/shared_memory_limits.h"
18 #include "gpu/command_buffer/client/transfer_buffer.h" 18 #include "gpu/command_buffer/client/transfer_buffer.h"
19 #include "gpu/ipc/client/command_buffer_proxy_impl.h" 19 #include "gpu/ipc/client/command_buffer_proxy_impl.h"
20 #include "gpu/ipc/client/gpu_channel_host.h"
20 #include "services/ui/common/switches.h" 21 #include "services/ui/common/switches.h"
21 #include "services/ui/gpu/gpu_service_internal.h"
22 #include "services/ui/surfaces/surfaces_context_provider_delegate.h" 22 #include "services/ui/surfaces/surfaces_context_provider_delegate.h"
23 #include "ui/gl/gpu_preference.h" 23 #include "ui/gl/gpu_preference.h"
24 #include "url/gurl.h"
24 25
25 namespace ui { 26 namespace ui {
26 27
27 SurfacesContextProvider::SurfacesContextProvider(gfx::AcceleratedWidget widget) 28 SurfacesContextProvider::SurfacesContextProvider(
29 gfx::AcceleratedWidget widget,
30 scoped_refptr<gpu::GpuChannelHost> gpu_channel)
28 : delegate_(nullptr), widget_(widget) { 31 : delegate_(nullptr), widget_(widget) {
29 GpuServiceInternal* service = GpuServiceInternal::GetInstance();
30 gpu::CommandBufferProxyImpl* shared_command_buffer = nullptr; 32 gpu::CommandBufferProxyImpl* shared_command_buffer = nullptr;
31 gpu::GpuStreamId stream_id = gpu::GpuStreamId::GPU_STREAM_DEFAULT; 33 gpu::GpuStreamId stream_id = gpu::GpuStreamId::GPU_STREAM_DEFAULT;
32 gpu::GpuStreamPriority stream_priority = gpu::GpuStreamPriority::NORMAL; 34 gpu::GpuStreamPriority stream_priority = gpu::GpuStreamPriority::NORMAL;
33 gpu::gles2::ContextCreationAttribHelper attributes; 35 gpu::gles2::ContextCreationAttribHelper attributes;
34 attributes.alpha_size = -1; 36 attributes.alpha_size = -1;
35 attributes.depth_size = 0; 37 attributes.depth_size = 0;
36 attributes.stencil_size = 0; 38 attributes.stencil_size = 0;
37 attributes.samples = 0; 39 attributes.samples = 0;
38 attributes.sample_buffers = 0; 40 attributes.sample_buffers = 0;
39 attributes.bind_generates_resource = false; 41 attributes.bind_generates_resource = false;
40 attributes.lose_context_when_out_of_memory = true; 42 attributes.lose_context_when_out_of_memory = true;
41 GURL active_url; 43 GURL active_url;
42 scoped_refptr<base::SingleThreadTaskRunner> task_runner = 44 scoped_refptr<base::SingleThreadTaskRunner> task_runner =
43 base::ThreadTaskRunnerHandle::Get(); 45 base::ThreadTaskRunnerHandle::Get();
44 command_buffer_proxy_impl_ = gpu::CommandBufferProxyImpl::Create( 46 command_buffer_proxy_impl_ = gpu::CommandBufferProxyImpl::Create(
45 service->gpu_channel_local(), widget, shared_command_buffer, stream_id, 47 std::move(gpu_channel), widget, shared_command_buffer, stream_id,
46 stream_priority, attributes, active_url, task_runner); 48 stream_priority, attributes, active_url, task_runner);
49 CHECK(command_buffer_proxy_impl_);
47 command_buffer_proxy_impl_->SetSwapBuffersCompletionCallback( 50 command_buffer_proxy_impl_->SetSwapBuffersCompletionCallback(
48 base::Bind(&SurfacesContextProvider::OnGpuSwapBuffersCompleted, 51 base::Bind(&SurfacesContextProvider::OnGpuSwapBuffersCompleted,
49 base::Unretained(this))); 52 base::Unretained(this)));
50 command_buffer_proxy_impl_->SetUpdateVSyncParametersCallback( 53 command_buffer_proxy_impl_->SetUpdateVSyncParametersCallback(
51 base::Bind(&SurfacesContextProvider::OnUpdateVSyncParameters, 54 base::Bind(&SurfacesContextProvider::OnUpdateVSyncParameters,
52 base::Unretained(this))); 55 base::Unretained(this)));
53 } 56 }
54 57
55 void SurfacesContextProvider::SetDelegate( 58 void SurfacesContextProvider::SetDelegate(
56 SurfacesContextProviderDelegate* delegate) { 59 SurfacesContextProviderDelegate* delegate) {
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 if (delegate_) 152 if (delegate_)
150 delegate_->OnVSyncParametersUpdated(timebase, interval); 153 delegate_->OnVSyncParametersUpdated(timebase, interval);
151 } 154 }
152 155
153 void SurfacesContextProvider::SetSwapBuffersCompletionCallback( 156 void SurfacesContextProvider::SetSwapBuffersCompletionCallback(
154 gl::GLSurface::SwapCompletionCallback callback) { 157 gl::GLSurface::SwapCompletionCallback callback) {
155 swap_buffers_completion_callback_ = callback; 158 swap_buffers_completion_callback_ = callback;
156 } 159 }
157 160
158 } // namespace ui 161 } // namespace ui
OLDNEW
« no previous file with comments | « services/ui/surfaces/surfaces_context_provider.h ('k') | services/ui/ws/DEPS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698