| 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_share_group.h" | 5 #include "gpu/command_buffer/service/async_pixel_transfer_manager_share_group.h" |
| 6 | 6 |
| 7 #include <list> | 7 #include <list> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
| (...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 529 texture_binder.reset(new gfx::ScopedTextureBinder(GL_TEXTURE_2D, 0)); | 529 texture_binder.reset(new gfx::ScopedTextureBinder(GL_TEXTURE_2D, 0)); |
| 530 | 530 |
| 531 // Used to set tex info from the gles2 cmd decoder once upload has | 531 // Used to set tex info from the gles2 cmd decoder once upload has |
| 532 // finished (it'll bind the texture and call a callback). | 532 // finished (it'll bind the texture and call a callback). |
| 533 delegate->BindTransfer(); | 533 delegate->BindTransfer(); |
| 534 | 534 |
| 535 shared_state_.pending_allocations.pop_front(); | 535 shared_state_.pending_allocations.pop_front(); |
| 536 } | 536 } |
| 537 } | 537 } |
| 538 | 538 |
| 539 void AsyncPixelTransferManagerShareGroup::AsyncRun( |
| 540 const base::Closure& callback) { |
| 541 transfer_message_loop_proxy()->PostTask(FROM_HERE, callback); |
| 542 } |
| 543 |
| 539 void AsyncPixelTransferManagerShareGroup::AsyncNotifyCompletion( | 544 void AsyncPixelTransferManagerShareGroup::AsyncNotifyCompletion( |
| 540 const AsyncMemoryParams& mem_params, | 545 const AsyncMemoryParams& mem_params, |
| 541 AsyncPixelTransferCompletionObserver* observer) { | 546 AsyncPixelTransferCompletionObserver* observer) { |
| 542 DCHECK(mem_params.shared_memory); | 547 DCHECK(mem_params.shared_memory); |
| 543 DCHECK_LE(mem_params.shm_data_offset + mem_params.shm_data_size, | 548 DCHECK_LE(mem_params.shm_data_offset + mem_params.shm_data_size, |
| 544 mem_params.shm_size); | 549 mem_params.shm_size); |
| 545 // Post a PerformNotifyCompletion task to the upload thread. This task | 550 // Post a PerformNotifyCompletion task to the upload thread. This task |
| 546 // will run after all async transfers are complete. | 551 // will run after all async transfers are complete. |
| 547 transfer_message_loop_proxy()->PostTask( | 552 AsyncRun( |
| 548 FROM_HERE, | |
| 549 base::Bind(&PerformNotifyCompletion, | 553 base::Bind(&PerformNotifyCompletion, |
| 550 mem_params, | 554 mem_params, |
| 551 base::Owned( | 555 base::Owned( |
| 552 new ScopedSafeSharedMemory(safe_shared_memory_pool(), | 556 new ScopedSafeSharedMemory(safe_shared_memory_pool(), |
| 553 mem_params.shared_memory, | 557 mem_params.shared_memory, |
| 554 mem_params.shm_size)), | 558 mem_params.shm_size)), |
| 555 make_scoped_refptr(observer))); | 559 make_scoped_refptr(observer))); |
| 556 } | 560 } |
| 557 | 561 |
| 558 uint32 AsyncPixelTransferManagerShareGroup::GetTextureUploadCount() { | 562 uint32 AsyncPixelTransferManagerShareGroup::GetTextureUploadCount() { |
| (...skipping 16 matching lines...) Expand all Loading... |
| 575 | 579 |
| 576 AsyncPixelTransferDelegate* | 580 AsyncPixelTransferDelegate* |
| 577 AsyncPixelTransferManagerShareGroup::CreatePixelTransferDelegateImpl( | 581 AsyncPixelTransferManagerShareGroup::CreatePixelTransferDelegateImpl( |
| 578 gles2::TextureRef* ref, | 582 gles2::TextureRef* ref, |
| 579 const AsyncTexImage2DParams& define_params) { | 583 const AsyncTexImage2DParams& define_params) { |
| 580 return new AsyncPixelTransferDelegateShareGroup( | 584 return new AsyncPixelTransferDelegateShareGroup( |
| 581 &shared_state_, ref->service_id(), define_params); | 585 &shared_state_, ref->service_id(), define_params); |
| 582 } | 586 } |
| 583 | 587 |
| 584 } // namespace gpu | 588 } // namespace gpu |
| OLD | NEW |