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 "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/synchronization/waitable_event.h" | 9 #include "base/synchronization/waitable_event.h" |
10 #include "components/mus/gles2/command_buffer_driver.h" | 10 #include "components/mus/gles2/command_buffer_driver.h" |
11 #include "components/mus/gles2/command_buffer_impl.h" | 11 #include "components/mus/gles2/command_buffer_impl.h" |
12 #include "components/mus/gles2/command_buffer_local.h" | 12 #include "components/mus/gles2/command_buffer_local.h" |
13 #include "components/mus/gles2/gpu_state.h" | 13 #include "components/mus/gles2/gpu_state.h" |
14 #include "components/mus/surfaces/surfaces_context_provider_delegate.h" | 14 #include "components/mus/surfaces/surfaces_context_provider_delegate.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/transfer_buffer.h" | 17 #include "gpu/command_buffer/client/transfer_buffer.h" |
18 | 18 |
19 namespace mus { | 19 namespace surfaces { |
20 | 20 |
21 namespace { | 21 namespace { |
22 const size_t kDefaultCommandBufferSize = 1024 * 1024; | 22 const size_t kDefaultCommandBufferSize = 1024 * 1024; |
23 const size_t kDefaultStartTransferBufferSize = 1 * 1024 * 1024; | 23 const size_t kDefaultStartTransferBufferSize = 1 * 1024 * 1024; |
24 const size_t kDefaultMinTransferBufferSize = 1 * 256 * 1024; | 24 const size_t kDefaultMinTransferBufferSize = 1 * 256 * 1024; |
25 const size_t kDefaultMaxTransferBufferSize = 16 * 1024 * 1024; | 25 const size_t kDefaultMaxTransferBufferSize = 16 * 1024 * 1024; |
26 } | 26 } |
27 | 27 |
28 SurfacesContextProvider::SurfacesContextProvider( | 28 SurfacesContextProvider::SurfacesContextProvider( |
29 SurfacesContextProviderDelegate* delegate, | 29 SurfacesContextProviderDelegate* delegate, |
30 gfx::AcceleratedWidget widget, | 30 gfx::AcceleratedWidget widget, |
31 const scoped_refptr<GpuState>& state) | 31 const scoped_refptr<gles2::GpuState>& state) |
32 : delegate_(delegate), widget_(widget) { | 32 : delegate_(delegate), widget_(widget) { |
33 capabilities_.gpu.image = true; | 33 capabilities_.gpu.image = true; |
34 command_buffer_local_.reset(new CommandBufferLocal(this, widget_, state)); | 34 command_buffer_local_.reset( |
| 35 new gles2::CommandBufferLocal(this, widget_, state)); |
35 } | 36 } |
36 | 37 |
37 // This is called when we have an accelerated widget. | 38 // This is called when we have an accelerated widget. |
38 bool SurfacesContextProvider::BindToCurrentThread() { | 39 bool SurfacesContextProvider::BindToCurrentThread() { |
39 // SurfacesContextProvider should always live on the same thread as the | 40 // SurfacesContextProvider should always live on the same thread as the |
40 // View Manager. | 41 // View Manager. |
41 DCHECK(CalledOnValidThread()); | 42 DCHECK(CalledOnValidThread()); |
42 if (!command_buffer_local_->Initialize()) | 43 if (!command_buffer_local_->Initialize()) |
43 return false; | 44 return false; |
44 gles2_helper_.reset(new gpu::gles2::GLES2CmdHelper( | 45 gles2_helper_.reset(new gpu::gles2::GLES2CmdHelper( |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 void SurfacesContextProvider::UpdateVSyncParameters(int64_t timebase, | 109 void SurfacesContextProvider::UpdateVSyncParameters(int64_t timebase, |
109 int64_t interval) { | 110 int64_t interval) { |
110 if (delegate_) | 111 if (delegate_) |
111 delegate_->OnVSyncParametersUpdated(timebase, interval); | 112 delegate_->OnVSyncParametersUpdated(timebase, interval); |
112 } | 113 } |
113 | 114 |
114 void SurfacesContextProvider::DidLoseContext() { | 115 void SurfacesContextProvider::DidLoseContext() { |
115 lost_context_callback_.Run(); | 116 lost_context_callback_.Run(); |
116 } | 117 } |
117 | 118 |
118 } // namespace mus | 119 } // namespace surfaces |
OLD | NEW |