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 18 matching lines...) Expand all Loading... |
29 } | 29 } |
30 | 30 |
31 namespace gpu { | 31 namespace gpu { |
32 class AsyncPixelTransferDelegate; | 32 class AsyncPixelTransferDelegate; |
33 class AsyncPixelTransferState; | 33 class AsyncPixelTransferState; |
34 struct AsyncTexImage2DParams; | 34 struct AsyncTexImage2DParams; |
35 | 35 |
36 class GPU_EXPORT AsyncPixelTransferManager | 36 class GPU_EXPORT AsyncPixelTransferManager |
37 : public gles2::TextureManager::DestructionObserver { | 37 : public gles2::TextureManager::DestructionObserver { |
38 public: | 38 public: |
39 AsyncPixelTransferManager(gles2::TextureManager* texture_manager_, | 39 static AsyncPixelTransferManager* Create(gfx::GLContext* context); |
40 gfx::GLContext* context); | 40 |
41 virtual ~AsyncPixelTransferManager(); | 41 virtual ~AsyncPixelTransferManager(); |
42 | 42 |
43 AsyncPixelTransferDelegate* GetAsyncPixelTransferDelegate() { | 43 void Initialize(gles2::TextureManager* texture_manager); |
44 return delegate_.get(); | |
45 } | |
46 | 44 |
47 void SetAsyncPixelTransferDelegateForTest( | 45 virtual AsyncPixelTransferDelegate* GetAsyncPixelTransferDelegate() = 0; |
48 AsyncPixelTransferDelegate* delegate) { | |
49 delegate_ = make_scoped_ptr(delegate); | |
50 } | |
51 | 46 |
52 AsyncPixelTransferState* CreatePixelTransferState( | 47 AsyncPixelTransferState* CreatePixelTransferState( |
53 gles2::TextureRef* ref, | 48 gles2::TextureRef* ref, |
54 const AsyncTexImage2DParams& define_params); | 49 const AsyncTexImage2DParams& define_params); |
55 | 50 |
56 AsyncPixelTransferState* GetPixelTransferState( | 51 AsyncPixelTransferState* GetPixelTransferState( |
57 gles2::TextureRef* ref); | 52 gles2::TextureRef* ref); |
58 | 53 |
59 void ClearPixelTransferStateForTest(gles2::TextureRef* ref); | 54 void ClearPixelTransferStateForTest(gles2::TextureRef* ref); |
60 | 55 |
61 bool AsyncTransferIsInProgress(gles2::TextureRef* ref); | 56 bool AsyncTransferIsInProgress(gles2::TextureRef* ref); |
62 | 57 |
63 // gles2::TextureRef::DestructionObserver implementation: | 58 // gles2::TextureRef::DestructionObserver implementation: |
64 virtual void OnTextureManagerDestroying(gles2::TextureManager* manager) | 59 virtual void OnTextureManagerDestroying(gles2::TextureManager* manager) |
65 OVERRIDE; | 60 OVERRIDE; |
66 virtual void OnTextureRefDestroying(gles2::TextureRef* texture) OVERRIDE; | 61 virtual void OnTextureRefDestroying(gles2::TextureRef* texture) OVERRIDE; |
67 | 62 |
| 63 protected: |
| 64 AsyncPixelTransferManager(); |
| 65 |
68 private: | 66 private: |
69 gles2::TextureManager* manager_; | 67 gles2::TextureManager* manager_; |
70 | 68 |
71 scoped_ptr<AsyncPixelTransferDelegate> delegate_; | |
72 | |
73 typedef base::hash_map<gles2::TextureRef*, | 69 typedef base::hash_map<gles2::TextureRef*, |
74 scoped_refptr<AsyncPixelTransferState> > | 70 scoped_refptr<AsyncPixelTransferState> > |
75 TextureToStateMap; | 71 TextureToStateMap; |
76 TextureToStateMap state_map_; | 72 TextureToStateMap state_map_; |
77 | 73 |
78 DISALLOW_COPY_AND_ASSIGN(AsyncPixelTransferManager); | 74 DISALLOW_COPY_AND_ASSIGN(AsyncPixelTransferManager); |
79 }; | 75 }; |
80 | 76 |
81 } // namespace gpu | 77 } // namespace gpu |
82 | 78 |
83 #endif // GPU_COMMAND_BUFFER_SERVICE_ASYNC_PIXEL_TRANSFER_MANAGER_H_ | 79 #endif // GPU_COMMAND_BUFFER_SERVICE_ASYNC_PIXEL_TRANSFER_MANAGER_H_ |
OLD | NEW |