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_egl.h" | 5 #include "gpu/command_buffer/service/async_pixel_transfer_manager_egl.h" |
| 6 | 6 |
| 7 #include <list> | 7 #include <list> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 709 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 720 if (!texture_binder) | 720 if (!texture_binder) |
| 721 texture_binder.reset(new gfx::ScopedTextureBinder(GL_TEXTURE_2D, 0)); | 721 texture_binder.reset(new gfx::ScopedTextureBinder(GL_TEXTURE_2D, 0)); |
| 722 | 722 |
| 723 // If the transfer is finished, bind it to the texture | 723 // If the transfer is finished, bind it to the texture |
| 724 // and remove it from pending list. | 724 // and remove it from pending list. |
| 725 delegate->BindTransfer(); | 725 delegate->BindTransfer(); |
| 726 shared_state_.pending_allocations.pop_front(); | 726 shared_state_.pending_allocations.pop_front(); |
| 727 } | 727 } |
| 728 } | 728 } |
| 729 | 729 |
| 730 void AsyncPixelTransferManagerEGL::AsyncRunWhenCompleted( | |
| 731 base::Callback<void()> callback) { | |
| 732 transfer_message_loop_proxy()->PostTask(FROM_HERE, callback); | |
| 733 } | |
| 734 | |
| 730 void AsyncPixelTransferManagerEGL::AsyncNotifyCompletion( | 735 void AsyncPixelTransferManagerEGL::AsyncNotifyCompletion( |
| 731 const AsyncMemoryParams& mem_params, | 736 const AsyncMemoryParams& mem_params, |
| 732 AsyncPixelTransferCompletionObserver* observer) { | 737 AsyncPixelTransferCompletionObserver* observer) { |
| 733 DCHECK(mem_params.shared_memory); | 738 DCHECK(mem_params.shared_memory); |
| 734 DCHECK_LE(mem_params.shm_data_offset + mem_params.shm_data_size, | 739 DCHECK_LE(mem_params.shm_data_offset + mem_params.shm_data_size, |
| 735 mem_params.shm_size); | 740 mem_params.shm_size); |
| 736 // Post a PerformNotifyCompletion task to the upload thread. This task | 741 // Post a PerformNotifyCompletion task to the upload thread. This task |
| 737 // will run after all async transfers are complete. | 742 // will run after all async transfers are complete. |
| 738 transfer_message_loop_proxy()->PostTask( | 743 transfer_message_loop_proxy()->PostTask( |
| 739 FROM_HERE, | 744 FROM_HERE, |
| 740 base::Bind(&PerformNotifyCompletion, | 745 base::Bind(&PerformNotifyCompletion, |
| 741 mem_params, | 746 mem_params, |
| 742 base::Owned( | 747 base::Owned( |
| 743 new ScopedSafeSharedMemory(safe_shared_memory_pool(), | 748 new ScopedSafeSharedMemory(safe_shared_memory_pool(), |
| 744 mem_params.shared_memory, | 749 mem_params.shared_memory, |
| 745 mem_params.shm_size)), | 750 mem_params.shm_size)), |
| 746 make_scoped_refptr(observer))); | 751 make_scoped_refptr(observer))); |
|
reveman
2014/01/22 17:30:04
Maybe this should now call ::AsyncRun instead of P
| |
| 747 } | 752 } |
| 748 | 753 |
| 749 uint32 AsyncPixelTransferManagerEGL::GetTextureUploadCount() { | 754 uint32 AsyncPixelTransferManagerEGL::GetTextureUploadCount() { |
| 750 return shared_state_.texture_upload_stats->GetStats(NULL); | 755 return shared_state_.texture_upload_stats->GetStats(NULL); |
| 751 } | 756 } |
| 752 | 757 |
| 753 base::TimeDelta AsyncPixelTransferManagerEGL::GetTotalTextureUploadTime() { | 758 base::TimeDelta AsyncPixelTransferManagerEGL::GetTotalTextureUploadTime() { |
| 754 base::TimeDelta total_texture_upload_time; | 759 base::TimeDelta total_texture_upload_time; |
| 755 shared_state_.texture_upload_stats->GetStats(&total_texture_upload_time); | 760 shared_state_.texture_upload_stats->GetStats(&total_texture_upload_time); |
| 756 return total_texture_upload_time; | 761 return total_texture_upload_time; |
| 757 } | 762 } |
| 758 | 763 |
| 759 void AsyncPixelTransferManagerEGL::ProcessMorePendingTransfers() { | 764 void AsyncPixelTransferManagerEGL::ProcessMorePendingTransfers() { |
| 760 } | 765 } |
| 761 | 766 |
| 762 bool AsyncPixelTransferManagerEGL::NeedsProcessMorePendingTransfers() { | 767 bool AsyncPixelTransferManagerEGL::NeedsProcessMorePendingTransfers() { |
| 763 return false; | 768 return false; |
| 764 } | 769 } |
| 765 | 770 |
| 766 AsyncPixelTransferDelegate* | 771 AsyncPixelTransferDelegate* |
| 767 AsyncPixelTransferManagerEGL::CreatePixelTransferDelegateImpl( | 772 AsyncPixelTransferManagerEGL::CreatePixelTransferDelegateImpl( |
| 768 gles2::TextureRef* ref, | 773 gles2::TextureRef* ref, |
| 769 const AsyncTexImage2DParams& define_params) { | 774 const AsyncTexImage2DParams& define_params) { |
| 770 return new AsyncPixelTransferDelegateEGL( | 775 return new AsyncPixelTransferDelegateEGL( |
| 771 &shared_state_, ref->service_id(), define_params); | 776 &shared_state_, ref->service_id(), define_params); |
| 772 } | 777 } |
| 773 | 778 |
| 774 } // namespace gpu | 779 } // namespace gpu |
| OLD | NEW |