| 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 <utility> |
| 8 |
| 7 #include "base/bind.h" | 9 #include "base/bind.h" |
| 8 #include "base/macros.h" | 10 #include "base/macros.h" |
| 9 #include "base/memory/shared_memory.h" | 11 #include "base/memory/shared_memory.h" |
| 10 #include "gpu/command_buffer/common/constants.h" | 12 #include "gpu/command_buffer/common/constants.h" |
| 11 #include "gpu/command_buffer/common/value_state.h" | 13 #include "gpu/command_buffer/common/value_state.h" |
| 12 #include "gpu/command_buffer/service/command_buffer_service.h" | 14 #include "gpu/command_buffer/service/command_buffer_service.h" |
| 13 #include "gpu/command_buffer/service/context_group.h" | 15 #include "gpu/command_buffer/service/context_group.h" |
| 14 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" | 16 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" |
| 15 #include "gpu/command_buffer/service/gpu_scheduler.h" | 17 #include "gpu/command_buffer/service/gpu_scheduler.h" |
| 16 #include "gpu/command_buffer/service/image_manager.h" | 18 #include "gpu/command_buffer/service/image_manager.h" |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 } | 80 } |
| 79 | 81 |
| 80 CommandBufferDriver::~CommandBufferDriver() { | 82 CommandBufferDriver::~CommandBufferDriver() { |
| 81 if (decoder_) { | 83 if (decoder_) { |
| 82 bool have_context = decoder_->MakeCurrent(); | 84 bool have_context = decoder_->MakeCurrent(); |
| 83 decoder_->Destroy(have_context); | 85 decoder_->Destroy(have_context); |
| 84 } | 86 } |
| 85 } | 87 } |
| 86 | 88 |
| 87 void CommandBufferDriver::Initialize( | 89 void CommandBufferDriver::Initialize( |
| 88 mojo::CommandBufferSyncClientPtr sync_client, | 90 mojo::InterfaceHandle<mojo::CommandBufferSyncClient> sync_client, |
| 89 mojo::CommandBufferLostContextObserverPtr loss_observer, | 91 mojo::InterfaceHandle<mojo::CommandBufferLostContextObserver> loss_observer, |
| 90 mojo::ScopedSharedBufferHandle shared_state) { | 92 mojo::ScopedSharedBufferHandle shared_state) { |
| 91 sync_client_ = sync_client.Pass(); | 93 sync_client_ = |
| 92 loss_observer_ = loss_observer.Pass(); | 94 mojo::CommandBufferSyncClientPtr::Create(std::move(sync_client)); |
| 95 loss_observer_ = mojo::CommandBufferLostContextObserverPtr::Create( |
| 96 std::move(loss_observer)); |
| 93 bool success = DoInitialize(shared_state.Pass()); | 97 bool success = DoInitialize(shared_state.Pass()); |
| 94 mojo::GpuCapabilitiesPtr capabilities = | 98 mojo::GpuCapabilitiesPtr capabilities = |
| 95 success ? mojo::GpuCapabilities::From(decoder_->GetCapabilities()) | 99 success ? mojo::GpuCapabilities::From(decoder_->GetCapabilities()) |
| 96 : mojo::GpuCapabilities::New(); | 100 : mojo::GpuCapabilities::New(); |
| 97 sync_client_->DidInitialize(success, capabilities.Pass()); | 101 sync_client_->DidInitialize(success, capabilities.Pass()); |
| 98 } | 102 } |
| 99 | 103 |
| 100 bool CommandBufferDriver::DoInitialize( | 104 bool CommandBufferDriver::DoInitialize( |
| 101 mojo::ScopedSharedBufferHandle shared_state) { | 105 mojo::ScopedSharedBufferHandle shared_state) { |
| 102 if (widget_ == gfx::kNullAcceleratedWidget) { | 106 if (widget_ == gfx::kNullAcceleratedWidget) { |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 client_->DidLoseContext(); | 266 client_->DidLoseContext(); |
| 263 } | 267 } |
| 264 | 268 |
| 265 void CommandBufferDriver::OnUpdateVSyncParameters( | 269 void CommandBufferDriver::OnUpdateVSyncParameters( |
| 266 const base::TimeTicks timebase, | 270 const base::TimeTicks timebase, |
| 267 const base::TimeDelta interval) { | 271 const base::TimeDelta interval) { |
| 268 client_->UpdateVSyncParameters(timebase, interval); | 272 client_->UpdateVSyncParameters(timebase, interval); |
| 269 } | 273 } |
| 270 | 274 |
| 271 } // namespace gles2 | 275 } // namespace gles2 |
| OLD | NEW |