Chromium Code Reviews| 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 "gpu/command_buffer/service/async_pixel_transfer_manager_idle.h" | 5 #include "gpu/command_buffer/service/async_pixel_transfer_manager_idle.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
| 9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
| 10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 276 AsyncPixelTransferManagerIdle::AsyncPixelTransferManagerIdle() | 276 AsyncPixelTransferManagerIdle::AsyncPixelTransferManagerIdle() |
| 277 : shared_state_() { | 277 : shared_state_() { |
| 278 } | 278 } |
| 279 | 279 |
| 280 AsyncPixelTransferManagerIdle::~AsyncPixelTransferManagerIdle() {} | 280 AsyncPixelTransferManagerIdle::~AsyncPixelTransferManagerIdle() {} |
| 281 | 281 |
| 282 void AsyncPixelTransferManagerIdle::BindCompletedAsyncTransfers() { | 282 void AsyncPixelTransferManagerIdle::BindCompletedAsyncTransfers() { |
| 283 // Everything is already bound. | 283 // Everything is already bound. |
| 284 } | 284 } |
| 285 | 285 |
| 286 void AsyncPixelTransferManagerIdle::AsyncRunWhenCompleted( | |
| 287 base::Callback<void()> callback) { | |
| 288 shared_state_.tasks.push_back( | |
| 289 Task(0, // 0 transfer_id for notification tasks. | |
| 290 base::Bind(callback))); | |
| 291 } | |
| 292 | |
| 286 void AsyncPixelTransferManagerIdle::AsyncNotifyCompletion( | 293 void AsyncPixelTransferManagerIdle::AsyncNotifyCompletion( |
| 287 const AsyncMemoryParams& mem_params, | 294 const AsyncMemoryParams& mem_params, |
| 288 AsyncPixelTransferCompletionObserver* observer) { | 295 AsyncPixelTransferCompletionObserver* observer) { |
| 289 if (shared_state_.tasks.empty()) { | 296 if (shared_state_.tasks.empty()) { |
| 290 observer->DidComplete(mem_params); | 297 observer->DidComplete(mem_params); |
| 291 return; | 298 return; |
| 292 } | 299 } |
| 293 | 300 |
| 294 shared_state_.tasks.push_back( | 301 shared_state_.tasks.push_back( |
| 295 Task(0, // 0 transfer_id for notification tasks. | 302 Task(0, // 0 transfer_id for notification tasks. |
| 296 base::Bind( | 303 base::Bind( |
| 297 &PerformNotifyCompletion, | 304 &PerformNotifyCompletion, |
| 298 mem_params, | 305 mem_params, |
| 299 base::Owned(new ScopedSafeSharedMemory(safe_shared_memory_pool(), | 306 base::Owned(new ScopedSafeSharedMemory(safe_shared_memory_pool(), |
| 300 mem_params.shared_memory, | 307 mem_params.shared_memory, |
| 301 mem_params.shm_size)), | 308 mem_params.shm_size)), |
| 302 make_scoped_refptr(observer)))); | 309 make_scoped_refptr(observer)))); |
|
reveman
2014/01/22 17:30:04
Would be nice to use AsyncRun here instead of push
| |
| 303 } | 310 } |
| 304 | 311 |
| 305 uint32 AsyncPixelTransferManagerIdle::GetTextureUploadCount() { | 312 uint32 AsyncPixelTransferManagerIdle::GetTextureUploadCount() { |
| 306 return shared_state_.texture_upload_count; | 313 return shared_state_.texture_upload_count; |
| 307 } | 314 } |
| 308 | 315 |
| 309 base::TimeDelta AsyncPixelTransferManagerIdle::GetTotalTextureUploadTime() { | 316 base::TimeDelta AsyncPixelTransferManagerIdle::GetTotalTextureUploadTime() { |
| 310 return shared_state_.total_texture_upload_time; | 317 return shared_state_.total_texture_upload_time; |
| 311 } | 318 } |
| 312 | 319 |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 329 AsyncPixelTransferDelegate* | 336 AsyncPixelTransferDelegate* |
| 330 AsyncPixelTransferManagerIdle::CreatePixelTransferDelegateImpl( | 337 AsyncPixelTransferManagerIdle::CreatePixelTransferDelegateImpl( |
| 331 gles2::TextureRef* ref, | 338 gles2::TextureRef* ref, |
| 332 const AsyncTexImage2DParams& define_params) { | 339 const AsyncTexImage2DParams& define_params) { |
| 333 return new AsyncPixelTransferDelegateIdle(&shared_state_, | 340 return new AsyncPixelTransferDelegateIdle(&shared_state_, |
| 334 ref->service_id(), | 341 ref->service_id(), |
| 335 define_params); | 342 define_params); |
| 336 } | 343 } |
| 337 | 344 |
| 338 } // namespace gpu | 345 } // namespace gpu |
| OLD | NEW |