| 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" |
| 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 "components/mus/common/switches.h" | 15 #include "components/mus/common/switches.h" |
| 15 #include "components/mus/gles2/command_buffer_driver.h" | 16 #include "components/mus/gles2/command_buffer_driver.h" |
| 16 #include "components/mus/gles2/command_buffer_impl.h" | 17 #include "components/mus/gles2/command_buffer_impl.h" |
| 17 #include "components/mus/gles2/command_buffer_local.h" | 18 #include "components/mus/gles2/command_buffer_local.h" |
| 18 #include "components/mus/gles2/gpu_state.h" | 19 #include "components/mus/gles2/gpu_state.h" |
| 19 #include "components/mus/gpu/gpu_service_mus.h" | 20 #include "components/mus/gpu/gpu_service_mus.h" |
| 20 #include "components/mus/surfaces/surfaces_context_provider_delegate.h" | 21 #include "components/mus/surfaces/surfaces_context_provider_delegate.h" |
| 21 #include "gpu/command_buffer/client/gles2_cmd_helper.h" | 22 #include "gpu/command_buffer/client/gles2_cmd_helper.h" |
| 22 #include "gpu/command_buffer/client/gles2_implementation.h" | 23 #include "gpu/command_buffer/client/gles2_implementation.h" |
| 23 #include "gpu/command_buffer/client/shared_memory_limits.h" | 24 #include "gpu/command_buffer/client/shared_memory_limits.h" |
| 24 #include "gpu/command_buffer/client/transfer_buffer.h" | 25 #include "gpu/command_buffer/client/transfer_buffer.h" |
| 25 #include "gpu/ipc/client/command_buffer_proxy_impl.h" | 26 #include "gpu/ipc/client/command_buffer_proxy_impl.h" |
| 26 #include "ui/gl/gpu_preference.h" | 27 #include "ui/gl/gpu_preference.h" |
| 27 | 28 |
| 28 namespace mus { | 29 namespace mus { |
| 29 | 30 |
| 30 SurfacesContextProvider::SurfacesContextProvider( | 31 SurfacesContextProvider::SurfacesContextProvider( |
| 31 gfx::AcceleratedWidget widget, | 32 gfx::AcceleratedWidget widget, |
| 32 const scoped_refptr<GpuState>& state) | 33 const scoped_refptr<GpuState>& state) |
| 33 : use_chrome_gpu_command_buffer_(false), | 34 : use_chrome_gpu_command_buffer_(false), |
| 34 delegate_(nullptr), | 35 delegate_(nullptr), |
| 35 widget_(widget), | 36 widget_(widget), |
| 36 command_buffer_local_(nullptr) { | 37 command_buffer_local_(nullptr) { |
| 38 // TODO(penghuang): Kludge: Use mojo command buffer when running on Windows |
| 39 // since Chrome command buffer breaks unit tests |
| 40 #if defined(OS_WIN) |
| 41 use_chrome_gpu_command_buffer_ = false; |
| 42 #else |
| 37 use_chrome_gpu_command_buffer_ = | 43 use_chrome_gpu_command_buffer_ = |
| 38 base::CommandLine::ForCurrentProcess()->HasSwitch( | 44 !base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 39 switches::kUseChromeGpuCommandBufferInMus); | 45 switches::kUseMojoGpuCommandBufferInMus); |
| 46 #endif |
| 40 if (!use_chrome_gpu_command_buffer_) { | 47 if (!use_chrome_gpu_command_buffer_) { |
| 41 command_buffer_local_ = new CommandBufferLocal(this, widget_, state); | 48 command_buffer_local_ = new CommandBufferLocal(this, widget_, state); |
| 42 } else { | 49 } else { |
| 43 GpuServiceMus* service = GpuServiceMus::GetInstance(); | 50 GpuServiceMus* service = GpuServiceMus::GetInstance(); |
| 44 gpu::CommandBufferProxyImpl* shared_command_buffer = nullptr; | 51 gpu::CommandBufferProxyImpl* shared_command_buffer = nullptr; |
| 45 gpu::GpuStreamId stream_id = gpu::GpuStreamId::GPU_STREAM_DEFAULT; | 52 gpu::GpuStreamId stream_id = gpu::GpuStreamId::GPU_STREAM_DEFAULT; |
| 46 gpu::GpuStreamPriority stream_priority = gpu::GpuStreamPriority::NORMAL; | 53 gpu::GpuStreamPriority stream_priority = gpu::GpuStreamPriority::NORMAL; |
| 47 gpu::gles2::ContextCreationAttribHelper attributes; | 54 gpu::gles2::ContextCreationAttribHelper attributes; |
| 48 attributes.alpha_size = -1; | 55 attributes.alpha_size = -1; |
| 49 attributes.depth_size = 0; | 56 attributes.depth_size = 0; |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 if (delegate_) | 199 if (delegate_) |
| 193 delegate_->OnVSyncParametersUpdated(timebase, interval); | 200 delegate_->OnVSyncParametersUpdated(timebase, interval); |
| 194 } | 201 } |
| 195 | 202 |
| 196 void SurfacesContextProvider::SetSwapBuffersCompletionCallback( | 203 void SurfacesContextProvider::SetSwapBuffersCompletionCallback( |
| 197 gl::GLSurface::SwapCompletionCallback callback) { | 204 gl::GLSurface::SwapCompletionCallback callback) { |
| 198 swap_buffers_completion_callback_ = callback; | 205 swap_buffers_completion_callback_ = callback; |
| 199 } | 206 } |
| 200 | 207 |
| 201 } // namespace mus | 208 } // namespace mus |
| OLD | NEW |