| 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 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 OnContextLost(state.context_lost_reason); | 229 OnContextLost(state.context_lost_reason); |
| 230 } | 230 } |
| 231 | 231 |
| 232 void CommandBufferDriver::OnResize(gfx::Size size, float scale_factor) { | 232 void CommandBufferDriver::OnResize(gfx::Size size, float scale_factor) { |
| 233 surface_->Resize(size); | 233 surface_->Resize(size); |
| 234 } | 234 } |
| 235 | 235 |
| 236 bool CommandBufferDriver::OnWaitSyncPoint(uint32_t sync_point) { | 236 bool CommandBufferDriver::OnWaitSyncPoint(uint32_t sync_point) { |
| 237 if (!sync_point) | 237 if (!sync_point) |
| 238 return true; | 238 return true; |
| 239 if (mailbox_manager_->UsesSync()) |
| 240 mailbox_manager_->PullTextureUpdates(sync_point); |
| 239 if (sync_point_manager_->IsSyncPointRetired(sync_point)) | 241 if (sync_point_manager_->IsSyncPointRetired(sync_point)) |
| 240 return true; | 242 return true; |
| 241 scheduler_->SetScheduled(false); | 243 scheduler_->SetScheduled(false); |
| 242 sync_point_manager_->AddSyncPointCallback( | 244 sync_point_manager_->AddSyncPointCallback( |
| 243 sync_point, base::Bind(&CommandBufferDriver::OnSyncPointRetired, | 245 sync_point, base::Bind(&CommandBufferDriver::OnSyncPointRetired, |
| 244 weak_factory_.GetWeakPtr())); | 246 weak_factory_.GetWeakPtr())); |
| 245 return scheduler_->IsScheduled(); | 247 return scheduler_->IsScheduled(); |
| 246 } | 248 } |
| 247 | 249 |
| 248 void CommandBufferDriver::OnSyncPointRetired() { | 250 void CommandBufferDriver::OnSyncPointRetired() { |
| 249 scheduler_->SetScheduled(true); | 251 scheduler_->SetScheduled(true); |
| 250 } | 252 } |
| 251 | 253 |
| 254 void CommandBufferDriver::RetireSyncPointOnGpuThread(uint32 sync_point) { |
| 255 if (mailbox_manager_->UsesSync()) |
| 256 mailbox_manager_->PushTextureUpdates(sync_point); |
| 257 sync_point_manager_->RetireSyncPoint(sync_point); |
| 258 } |
| 259 |
| 252 void CommandBufferDriver::OnContextLost(uint32_t reason) { | 260 void CommandBufferDriver::OnContextLost(uint32_t reason) { |
| 253 loss_observer_->DidLoseContext(reason); | 261 loss_observer_->DidLoseContext(reason); |
| 254 client_->DidLoseContext(); | 262 client_->DidLoseContext(); |
| 255 } | 263 } |
| 256 | 264 |
| 257 void CommandBufferDriver::OnUpdateVSyncParameters( | 265 void CommandBufferDriver::OnUpdateVSyncParameters( |
| 258 const base::TimeTicks timebase, | 266 const base::TimeTicks timebase, |
| 259 const base::TimeDelta interval) { | 267 const base::TimeDelta interval) { |
| 260 client_->UpdateVSyncParameters(timebase, interval); | 268 client_->UpdateVSyncParameters(timebase, interval); |
| 261 } | 269 } |
| 262 | 270 |
| 263 } // namespace gles2 | 271 } // namespace gles2 |
| OLD | NEW |