| 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 #ifndef GPU_COMMAND_BUFFER_SERVICE_ASYNC_PIXEL_TRANSFER_MANAGER_H_ | 5 #ifndef GPU_COMMAND_BUFFER_SERVICE_ASYNC_PIXEL_TRANSFER_MANAGER_H_ |
| 6 #define GPU_COMMAND_BUFFER_SERVICE_ASYNC_PIXEL_TRANSFER_MANAGER_H_ | 6 #define GPU_COMMAND_BUFFER_SERVICE_ASYNC_PIXEL_TRANSFER_MANAGER_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 friend class base::RefCountedThreadSafe<AsyncPixelTransferCompletionObserver>; | 38 friend class base::RefCountedThreadSafe<AsyncPixelTransferCompletionObserver>; |
| 39 | 39 |
| 40 DISALLOW_COPY_AND_ASSIGN(AsyncPixelTransferCompletionObserver); | 40 DISALLOW_COPY_AND_ASSIGN(AsyncPixelTransferCompletionObserver); |
| 41 }; | 41 }; |
| 42 | 42 |
| 43 class GPU_EXPORT AsyncPixelTransferManager | 43 class GPU_EXPORT AsyncPixelTransferManager |
| 44 : public gles2::TextureManager::DestructionObserver { | 44 : public gles2::TextureManager::DestructionObserver { |
| 45 public: | 45 public: |
| 46 static AsyncPixelTransferManager* Create(gfx::GLContext* context); | 46 static AsyncPixelTransferManager* Create(gfx::GLContext* context); |
| 47 | 47 |
| 48 virtual ~AsyncPixelTransferManager(); | 48 ~AsyncPixelTransferManager() override; |
| 49 | 49 |
| 50 void Initialize(gles2::TextureManager* texture_manager); | 50 void Initialize(gles2::TextureManager* texture_manager); |
| 51 | 51 |
| 52 virtual void BindCompletedAsyncTransfers() = 0; | 52 virtual void BindCompletedAsyncTransfers() = 0; |
| 53 | 53 |
| 54 // There's no guarantee that callback will run on the caller thread. | 54 // There's no guarantee that callback will run on the caller thread. |
| 55 virtual void AsyncNotifyCompletion( | 55 virtual void AsyncNotifyCompletion( |
| 56 const AsyncMemoryParams& mem_params, | 56 const AsyncMemoryParams& mem_params, |
| 57 AsyncPixelTransferCompletionObserver* observer) = 0; | 57 AsyncPixelTransferCompletionObserver* observer) = 0; |
| 58 | 58 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 75 const AsyncTexImage2DParams& define_params); | 75 const AsyncTexImage2DParams& define_params); |
| 76 | 76 |
| 77 AsyncPixelTransferDelegate* GetPixelTransferDelegate( | 77 AsyncPixelTransferDelegate* GetPixelTransferDelegate( |
| 78 gles2::TextureRef* ref); | 78 gles2::TextureRef* ref); |
| 79 | 79 |
| 80 void ClearPixelTransferDelegateForTest(gles2::TextureRef* ref); | 80 void ClearPixelTransferDelegateForTest(gles2::TextureRef* ref); |
| 81 | 81 |
| 82 bool AsyncTransferIsInProgress(gles2::TextureRef* ref); | 82 bool AsyncTransferIsInProgress(gles2::TextureRef* ref); |
| 83 | 83 |
| 84 // gles2::TextureRef::DestructionObserver implementation: | 84 // gles2::TextureRef::DestructionObserver implementation: |
| 85 virtual void OnTextureManagerDestroying(gles2::TextureManager* manager) | 85 void OnTextureManagerDestroying(gles2::TextureManager* manager) override; |
| 86 override; | 86 void OnTextureRefDestroying(gles2::TextureRef* texture) override; |
| 87 virtual void OnTextureRefDestroying(gles2::TextureRef* texture) override; | |
| 88 | 87 |
| 89 protected: | 88 protected: |
| 90 AsyncPixelTransferManager(); | 89 AsyncPixelTransferManager(); |
| 91 | 90 |
| 92 private: | 91 private: |
| 93 gles2::TextureManager* manager_; | 92 gles2::TextureManager* manager_; |
| 94 | 93 |
| 95 typedef base::hash_map<gles2::TextureRef*, | 94 typedef base::hash_map<gles2::TextureRef*, |
| 96 linked_ptr<AsyncPixelTransferDelegate> > | 95 linked_ptr<AsyncPixelTransferDelegate> > |
| 97 TextureToDelegateMap; | 96 TextureToDelegateMap; |
| 98 TextureToDelegateMap delegate_map_; | 97 TextureToDelegateMap delegate_map_; |
| 99 | 98 |
| 100 // A factory method called by CreatePixelTransferDelegate that is overriden | 99 // A factory method called by CreatePixelTransferDelegate that is overriden |
| 101 // by each implementation. | 100 // by each implementation. |
| 102 virtual AsyncPixelTransferDelegate* CreatePixelTransferDelegateImpl( | 101 virtual AsyncPixelTransferDelegate* CreatePixelTransferDelegateImpl( |
| 103 gles2::TextureRef* ref, | 102 gles2::TextureRef* ref, |
| 104 const AsyncTexImage2DParams& define_params) = 0; | 103 const AsyncTexImage2DParams& define_params) = 0; |
| 105 | 104 |
| 106 DISALLOW_COPY_AND_ASSIGN(AsyncPixelTransferManager); | 105 DISALLOW_COPY_AND_ASSIGN(AsyncPixelTransferManager); |
| 107 }; | 106 }; |
| 108 | 107 |
| 109 } // namespace gpu | 108 } // namespace gpu |
| 110 | 109 |
| 111 #endif // GPU_COMMAND_BUFFER_SERVICE_ASYNC_PIXEL_TRANSFER_MANAGER_H_ | 110 #endif // GPU_COMMAND_BUFFER_SERVICE_ASYNC_PIXEL_TRANSFER_MANAGER_H_ |
| OLD | NEW |