| 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/debug/trace_event_synthetic_delay.h" | 9 #include "base/debug/trace_event_synthetic_delay.h" |
| 10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 AsyncPixelTransferManagerIdle::AsyncPixelTransferManagerIdle() | 281 AsyncPixelTransferManagerIdle::AsyncPixelTransferManagerIdle() |
| 282 : shared_state_() { | 282 : shared_state_() { |
| 283 } | 283 } |
| 284 | 284 |
| 285 AsyncPixelTransferManagerIdle::~AsyncPixelTransferManagerIdle() {} | 285 AsyncPixelTransferManagerIdle::~AsyncPixelTransferManagerIdle() {} |
| 286 | 286 |
| 287 void AsyncPixelTransferManagerIdle::BindCompletedAsyncTransfers() { | 287 void AsyncPixelTransferManagerIdle::BindCompletedAsyncTransfers() { |
| 288 // Everything is already bound. | 288 // Everything is already bound. |
| 289 } | 289 } |
| 290 | 290 |
| 291 void AsyncPixelTransferManagerIdle::AsyncRun(const base::Closure& callback) { |
| 292 shared_state_.tasks.push_back( |
| 293 Task(0, // 0 transfer_id for notification tasks. |
| 294 base::Bind(callback))); |
| 295 } |
| 296 |
| 291 void AsyncPixelTransferManagerIdle::AsyncNotifyCompletion( | 297 void AsyncPixelTransferManagerIdle::AsyncNotifyCompletion( |
| 292 const AsyncMemoryParams& mem_params, | 298 const AsyncMemoryParams& mem_params, |
| 293 AsyncPixelTransferCompletionObserver* observer) { | 299 AsyncPixelTransferCompletionObserver* observer) { |
| 294 if (shared_state_.tasks.empty()) { | 300 if (shared_state_.tasks.empty()) { |
| 295 observer->DidComplete(mem_params); | 301 observer->DidComplete(mem_params); |
| 296 return; | 302 return; |
| 297 } | 303 } |
| 298 | 304 |
| 299 shared_state_.tasks.push_back( | 305 AsyncRun( |
| 300 Task(0, // 0 transfer_id for notification tasks. | 306 base::Bind( |
| 301 base::Bind( | 307 &PerformNotifyCompletion, |
| 302 &PerformNotifyCompletion, | 308 mem_params, |
| 303 mem_params, | 309 base::Owned(new ScopedSafeSharedMemory(safe_shared_memory_pool(), |
| 304 base::Owned(new ScopedSafeSharedMemory(safe_shared_memory_pool(), | 310 mem_params.shared_memory, |
| 305 mem_params.shared_memory, | 311 mem_params.shm_size)), |
| 306 mem_params.shm_size)), | 312 make_scoped_refptr(observer))); |
| 307 make_scoped_refptr(observer)))); | |
| 308 } | 313 } |
| 309 | 314 |
| 310 uint32 AsyncPixelTransferManagerIdle::GetTextureUploadCount() { | 315 uint32 AsyncPixelTransferManagerIdle::GetTextureUploadCount() { |
| 311 return shared_state_.texture_upload_count; | 316 return shared_state_.texture_upload_count; |
| 312 } | 317 } |
| 313 | 318 |
| 314 base::TimeDelta AsyncPixelTransferManagerIdle::GetTotalTextureUploadTime() { | 319 base::TimeDelta AsyncPixelTransferManagerIdle::GetTotalTextureUploadTime() { |
| 315 return shared_state_.total_texture_upload_time; | 320 return shared_state_.total_texture_upload_time; |
| 316 } | 321 } |
| 317 | 322 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 334 AsyncPixelTransferDelegate* | 339 AsyncPixelTransferDelegate* |
| 335 AsyncPixelTransferManagerIdle::CreatePixelTransferDelegateImpl( | 340 AsyncPixelTransferManagerIdle::CreatePixelTransferDelegateImpl( |
| 336 gles2::TextureRef* ref, | 341 gles2::TextureRef* ref, |
| 337 const AsyncTexImage2DParams& define_params) { | 342 const AsyncTexImage2DParams& define_params) { |
| 338 return new AsyncPixelTransferDelegateIdle(&shared_state_, | 343 return new AsyncPixelTransferDelegateIdle(&shared_state_, |
| 339 ref->service_id(), | 344 ref->service_id(), |
| 340 define_params); | 345 define_params); |
| 341 } | 346 } |
| 342 | 347 |
| 343 } // namespace gpu | 348 } // namespace gpu |
| OLD | NEW |