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 "components/mus/surfaces/surfaces_context_provider.h" | 5 #include "components/mus/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" |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 gpu::GpuStreamId stream_id = gpu::GpuStreamId::GPU_STREAM_DEFAULT; | 52 gpu::GpuStreamId stream_id = gpu::GpuStreamId::GPU_STREAM_DEFAULT; |
53 gpu::GpuStreamPriority stream_priority = gpu::GpuStreamPriority::NORMAL; | 53 gpu::GpuStreamPriority stream_priority = gpu::GpuStreamPriority::NORMAL; |
54 gpu::gles2::ContextCreationAttribHelper attributes; | 54 gpu::gles2::ContextCreationAttribHelper attributes; |
55 attributes.alpha_size = -1; | 55 attributes.alpha_size = -1; |
56 attributes.depth_size = 0; | 56 attributes.depth_size = 0; |
57 attributes.stencil_size = 0; | 57 attributes.stencil_size = 0; |
58 attributes.samples = 0; | 58 attributes.samples = 0; |
59 attributes.sample_buffers = 0; | 59 attributes.sample_buffers = 0; |
60 attributes.bind_generates_resource = false; | 60 attributes.bind_generates_resource = false; |
61 attributes.lose_context_when_out_of_memory = true; | 61 attributes.lose_context_when_out_of_memory = true; |
| 62 gl::GpuPreference gpu_preference = gl::PreferIntegratedGpu; |
62 GURL active_url; | 63 GURL active_url; |
63 scoped_refptr<base::SingleThreadTaskRunner> task_runner = | 64 scoped_refptr<base::SingleThreadTaskRunner> task_runner = |
64 base::ThreadTaskRunnerHandle::Get(); | 65 base::ThreadTaskRunnerHandle::Get(); |
65 command_buffer_proxy_impl_ = gpu::CommandBufferProxyImpl::Create( | 66 command_buffer_proxy_impl_ = gpu::CommandBufferProxyImpl::Create( |
66 service->gpu_channel_local(), widget, shared_command_buffer, stream_id, | 67 service->gpu_channel_local(), widget, gfx::Size(), |
67 stream_priority, attributes, active_url, task_runner); | 68 shared_command_buffer, stream_id, stream_priority, attributes, |
| 69 active_url, gpu_preference, task_runner); |
68 command_buffer_proxy_impl_->SetSwapBuffersCompletionCallback( | 70 command_buffer_proxy_impl_->SetSwapBuffersCompletionCallback( |
69 base::Bind(&SurfacesContextProvider::OnGpuSwapBuffersCompleted, | 71 base::Bind(&SurfacesContextProvider::OnGpuSwapBuffersCompleted, |
70 base::Unretained(this))); | 72 base::Unretained(this))); |
71 command_buffer_proxy_impl_->SetUpdateVSyncParametersCallback( | 73 command_buffer_proxy_impl_->SetUpdateVSyncParametersCallback( |
72 base::Bind(&SurfacesContextProvider::OnUpdateVSyncParameters, | 74 base::Bind(&SurfacesContextProvider::OnUpdateVSyncParameters, |
73 base::Unretained(this))); | 75 base::Unretained(this))); |
74 } | 76 } |
75 } | 77 } |
76 | 78 |
77 void SurfacesContextProvider::SetDelegate( | 79 void SurfacesContextProvider::SetDelegate( |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 if (delegate_) | 199 if (delegate_) |
198 delegate_->OnVSyncParametersUpdated(timebase, interval); | 200 delegate_->OnVSyncParametersUpdated(timebase, interval); |
199 } | 201 } |
200 | 202 |
201 void SurfacesContextProvider::SetSwapBuffersCompletionCallback( | 203 void SurfacesContextProvider::SetSwapBuffersCompletionCallback( |
202 gl::GLSurface::SwapCompletionCallback callback) { | 204 gl::GLSurface::SwapCompletionCallback callback) { |
203 swap_buffers_completion_callback_ = callback; | 205 swap_buffers_completion_callback_ = callback; |
204 } | 206 } |
205 | 207 |
206 } // namespace mus | 208 } // namespace mus |
OLD | NEW |