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; | |
63 GURL active_url; | 62 GURL active_url; |
64 scoped_refptr<base::SingleThreadTaskRunner> task_runner = | 63 scoped_refptr<base::SingleThreadTaskRunner> task_runner = |
65 base::ThreadTaskRunnerHandle::Get(); | 64 base::ThreadTaskRunnerHandle::Get(); |
66 command_buffer_proxy_impl_ = gpu::CommandBufferProxyImpl::Create( | 65 command_buffer_proxy_impl_ = gpu::CommandBufferProxyImpl::Create( |
67 service->gpu_channel_local(), widget, gfx::Size(), | 66 service->gpu_channel_local(), widget, shared_command_buffer, stream_id, |
68 shared_command_buffer, stream_id, stream_priority, attributes, | 67 stream_priority, attributes, active_url, task_runner); |
69 active_url, gpu_preference, task_runner); | |
70 command_buffer_proxy_impl_->SetSwapBuffersCompletionCallback( | 68 command_buffer_proxy_impl_->SetSwapBuffersCompletionCallback( |
71 base::Bind(&SurfacesContextProvider::OnGpuSwapBuffersCompleted, | 69 base::Bind(&SurfacesContextProvider::OnGpuSwapBuffersCompleted, |
72 base::Unretained(this))); | 70 base::Unretained(this))); |
73 command_buffer_proxy_impl_->SetUpdateVSyncParametersCallback( | 71 command_buffer_proxy_impl_->SetUpdateVSyncParametersCallback( |
74 base::Bind(&SurfacesContextProvider::OnUpdateVSyncParameters, | 72 base::Bind(&SurfacesContextProvider::OnUpdateVSyncParameters, |
75 base::Unretained(this))); | 73 base::Unretained(this))); |
76 } | 74 } |
77 } | 75 } |
78 | 76 |
79 void SurfacesContextProvider::SetDelegate( | 77 void SurfacesContextProvider::SetDelegate( |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 if (delegate_) | 197 if (delegate_) |
200 delegate_->OnVSyncParametersUpdated(timebase, interval); | 198 delegate_->OnVSyncParametersUpdated(timebase, interval); |
201 } | 199 } |
202 | 200 |
203 void SurfacesContextProvider::SetSwapBuffersCompletionCallback( | 201 void SurfacesContextProvider::SetSwapBuffersCompletionCallback( |
204 gl::GLSurface::SwapCompletionCallback callback) { | 202 gl::GLSurface::SwapCompletionCallback callback) { |
205 swap_buffers_completion_callback_ = callback; | 203 swap_buffers_completion_callback_ = callback; |
206 } | 204 } |
207 | 205 |
208 } // namespace mus | 206 } // namespace mus |
OLD | NEW |