Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(57)

Side by Side Diff: services/gles2/command_buffer_driver.cc

Issue 868203003: De-Client CommandBuffer interface (Closed) Base URL: git@github.com:domokit/mojo.git@fix_sample_app
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « services/gles2/command_buffer_driver.h ('k') | services/gles2/command_buffer_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 mailbox_manager_(mailbox_manager), 74 mailbox_manager_(mailbox_manager),
75 sync_point_manager_(sync_point_manager), 75 sync_point_manager_(sync_point_manager),
76 weak_factory_(this) { 76 weak_factory_(this) {
77 } 77 }
78 78
79 CommandBufferDriver::~CommandBufferDriver() { 79 CommandBufferDriver::~CommandBufferDriver() {
80 if (decoder_) { 80 if (decoder_) {
81 bool have_context = decoder_->MakeCurrent(); 81 bool have_context = decoder_->MakeCurrent();
82 decoder_->Destroy(have_context); 82 decoder_->Destroy(have_context);
83 } 83 }
84 client_->DidDestroy();
85 } 84 }
86 85
87 void CommandBufferDriver::Initialize( 86 void CommandBufferDriver::Initialize(
88 mojo::CommandBufferSyncClientPtr sync_client, 87 mojo::CommandBufferSyncClientPtr sync_client,
88 mojo::CommandBufferLostContextObserverPtr loss_observer,
89 mojo::ScopedSharedBufferHandle shared_state) { 89 mojo::ScopedSharedBufferHandle shared_state) {
90 sync_client_ = sync_client.Pass(); 90 sync_client_ = sync_client.Pass();
91 loss_observer_ = loss_observer.Pass();
91 bool success = DoInitialize(shared_state.Pass()); 92 bool success = DoInitialize(shared_state.Pass());
92 mojo::GpuCapabilitiesPtr capabilities = 93 mojo::GpuCapabilitiesPtr capabilities =
93 success ? mojo::GpuCapabilities::From(decoder_->GetCapabilities()) 94 success ? mojo::GpuCapabilities::From(decoder_->GetCapabilities())
94 : mojo::GpuCapabilities::New(); 95 : mojo::GpuCapabilities::New();
95 sync_client_->DidInitialize(success, capabilities.Pass()); 96 sync_client_->DidInitialize(success, capabilities.Pass());
96 } 97 }
97 98
98 bool CommandBufferDriver::DoInitialize( 99 bool CommandBufferDriver::DoInitialize(
99 mojo::ScopedSharedBufferHandle shared_state) { 100 mojo::ScopedSharedBufferHandle shared_state) {
100 if (widget_ == gfx::kNullAcceleratedWidget) 101 if (widget_ == gfx::kNullAcceleratedWidget)
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 sync_point, base::Bind(&CommandBufferDriver::OnSyncPointRetired, 232 sync_point, base::Bind(&CommandBufferDriver::OnSyncPointRetired,
232 weak_factory_.GetWeakPtr())); 233 weak_factory_.GetWeakPtr()));
233 return scheduler_->IsScheduled(); 234 return scheduler_->IsScheduled();
234 } 235 }
235 236
236 void CommandBufferDriver::OnSyncPointRetired() { 237 void CommandBufferDriver::OnSyncPointRetired() {
237 scheduler_->SetScheduled(true); 238 scheduler_->SetScheduled(true);
238 } 239 }
239 240
240 void CommandBufferDriver::OnContextLost(uint32_t reason) { 241 void CommandBufferDriver::OnContextLost(uint32_t reason) {
241 client_->LostContext(reason); 242 loss_observer_->DidLoseContext(reason);
243 client_->DidLoseContext();
242 } 244 }
243 245
244 void CommandBufferDriver::OnUpdateVSyncParameters( 246 void CommandBufferDriver::OnUpdateVSyncParameters(
245 const base::TimeTicks timebase, 247 const base::TimeTicks timebase,
246 const base::TimeDelta interval) { 248 const base::TimeDelta interval) {
247 client_->UpdateVSyncParameters(timebase, interval); 249 client_->UpdateVSyncParameters(timebase, interval);
248 } 250 }
249 251
250 } // namespace gles2 252 } // namespace gles2
OLDNEW
« no previous file with comments | « services/gles2/command_buffer_driver.h ('k') | services/gles2/command_buffer_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698