OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/gles2/command_buffer_driver.h" | 5 #include "services/gles2/command_buffer_driver.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/memory/shared_memory.h" | 9 #include "base/memory/shared_memory.h" |
10 #include "gpu/command_buffer/common/constants.h" | 10 #include "gpu/command_buffer/common/constants.h" |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
92 loss_observer_ = loss_observer.Pass(); | 92 loss_observer_ = loss_observer.Pass(); |
93 bool success = DoInitialize(shared_state.Pass()); | 93 bool success = DoInitialize(shared_state.Pass()); |
94 mojo::GpuCapabilitiesPtr capabilities = | 94 mojo::GpuCapabilitiesPtr capabilities = |
95 success ? mojo::GpuCapabilities::From(decoder_->GetCapabilities()) | 95 success ? mojo::GpuCapabilities::From(decoder_->GetCapabilities()) |
96 : mojo::GpuCapabilities::New(); | 96 : mojo::GpuCapabilities::New(); |
97 sync_client_->DidInitialize(success, capabilities.Pass()); | 97 sync_client_->DidInitialize(success, capabilities.Pass()); |
98 } | 98 } |
99 | 99 |
100 bool CommandBufferDriver::DoInitialize( | 100 bool CommandBufferDriver::DoInitialize( |
101 mojo::ScopedSharedBufferHandle shared_state) { | 101 mojo::ScopedSharedBufferHandle shared_state) { |
102 if (widget_ == gfx::kNullAcceleratedWidget) | 102 if (widget_ == gfx::kNullAcceleratedWidget) { |
103 // This is a dummy surface, so attempt to skip actual surface | |
104 // allocation by passing size 0. | |
103 surface_ = gfx::GLSurface::CreateOffscreenGLSurface( | 105 surface_ = gfx::GLSurface::CreateOffscreenGLSurface( |
106 gfx::Size(0, 0), requested_configuration_); | |
107 if (!surface_) | |
jamesr
2015/09/11 21:34:59
add { }s since the body of this conditional is mul
cdotstout
2015/09/11 21:52:54
Done.
| |
108 surface_ = gfx::GLSurface::CreateOffscreenGLSurface( | |
104 gfx::Size(1, 1), requested_configuration_); | 109 gfx::Size(1, 1), requested_configuration_); |
jamesr
2015/09/11 21:34:59
i think indentation is now wrong on this line
cdotstout
2015/09/11 21:52:54
Done.
| |
105 else { | 110 } else { |
106 surface_ = | 111 surface_ = |
107 gfx::GLSurface::CreateViewGLSurface(widget_, requested_configuration_); | 112 gfx::GLSurface::CreateViewGLSurface(widget_, requested_configuration_); |
108 if (auto vsync_provider = surface_->GetVSyncProvider()) { | 113 if (auto vsync_provider = surface_->GetVSyncProvider()) { |
109 vsync_provider->GetVSyncParameters( | 114 vsync_provider->GetVSyncParameters( |
110 base::Bind(&CommandBufferDriver::OnUpdateVSyncParameters, | 115 base::Bind(&CommandBufferDriver::OnUpdateVSyncParameters, |
111 weak_factory_.GetWeakPtr())); | 116 weak_factory_.GetWeakPtr())); |
112 } | 117 } |
113 } | 118 } |
114 | 119 |
115 if (!surface_.get()) | 120 if (!surface_.get()) |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
247 client_->DidLoseContext(); | 252 client_->DidLoseContext(); |
248 } | 253 } |
249 | 254 |
250 void CommandBufferDriver::OnUpdateVSyncParameters( | 255 void CommandBufferDriver::OnUpdateVSyncParameters( |
251 const base::TimeTicks timebase, | 256 const base::TimeTicks timebase, |
252 const base::TimeDelta interval) { | 257 const base::TimeDelta interval) { |
253 client_->UpdateVSyncParameters(timebase, interval); | 258 client_->UpdateVSyncParameters(timebase, interval); |
254 } | 259 } |
255 | 260 |
256 } // namespace gles2 | 261 } // namespace gles2 |
OLD | NEW |