OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_delegate_sync.h" | 5 #include "gpu/command_buffer/service/async_pixel_transfer_manager_sync.h" |
| 6 |
| 7 #include "gpu/command_buffer/service/async_pixel_transfer_delegate.h" |
6 | 8 |
7 namespace gpu { | 9 namespace gpu { |
8 | 10 |
9 namespace { | 11 namespace { |
10 | 12 |
11 class AsyncPixelTransferStateImpl : public AsyncPixelTransferState { | 13 class AsyncPixelTransferStateImpl : public AsyncPixelTransferState { |
12 public: | 14 public: |
13 AsyncPixelTransferStateImpl() {} | 15 AsyncPixelTransferStateImpl() {} |
14 | 16 |
15 // Implement AsyncPixelTransferState: | 17 // Implement AsyncPixelTransferState: |
16 virtual bool TransferIsInProgress() OVERRIDE { | 18 virtual bool TransferIsInProgress() OVERRIDE { |
17 return false; | 19 return false; |
18 } | 20 } |
19 | 21 |
20 private: | 22 private: |
21 virtual ~AsyncPixelTransferStateImpl() {} | 23 virtual ~AsyncPixelTransferStateImpl() {} |
22 }; | 24 }; |
23 | 25 |
24 } // namespace | 26 } // namespace |
25 | 27 |
| 28 // Class which handles async pixel transfers synchronously. |
| 29 class AsyncPixelTransferDelegateSync : public AsyncPixelTransferDelegate { |
| 30 public: |
| 31 AsyncPixelTransferDelegateSync(); |
| 32 virtual ~AsyncPixelTransferDelegateSync(); |
| 33 |
| 34 // Implement AsyncPixelTransferDelegate: |
| 35 virtual AsyncPixelTransferState* CreatePixelTransferState( |
| 36 GLuint texture_id, |
| 37 const AsyncTexImage2DParams& define_params) OVERRIDE; |
| 38 virtual void BindCompletedAsyncTransfers() OVERRIDE; |
| 39 virtual void AsyncNotifyCompletion( |
| 40 const AsyncMemoryParams& mem_params, |
| 41 const CompletionCallback& callback) OVERRIDE; |
| 42 virtual void AsyncTexImage2D( |
| 43 AsyncPixelTransferState* state, |
| 44 const AsyncTexImage2DParams& tex_params, |
| 45 const AsyncMemoryParams& mem_params, |
| 46 const base::Closure& bind_callback) OVERRIDE; |
| 47 virtual void AsyncTexSubImage2D( |
| 48 AsyncPixelTransferState* transfer_state, |
| 49 const AsyncTexSubImage2DParams& tex_params, |
| 50 const AsyncMemoryParams& mem_params) OVERRIDE; |
| 51 virtual void WaitForTransferCompletion( |
| 52 AsyncPixelTransferState* state) OVERRIDE; |
| 53 virtual uint32 GetTextureUploadCount() OVERRIDE; |
| 54 virtual base::TimeDelta GetTotalTextureUploadTime() OVERRIDE; |
| 55 virtual void ProcessMorePendingTransfers() OVERRIDE; |
| 56 virtual bool NeedsProcessMorePendingTransfers() OVERRIDE; |
| 57 |
| 58 private: |
| 59 int texture_upload_count_; |
| 60 base::TimeDelta total_texture_upload_time_; |
| 61 |
| 62 DISALLOW_COPY_AND_ASSIGN(AsyncPixelTransferDelegateSync); |
| 63 }; |
| 64 |
26 AsyncPixelTransferDelegateSync::AsyncPixelTransferDelegateSync() | 65 AsyncPixelTransferDelegateSync::AsyncPixelTransferDelegateSync() |
27 : texture_upload_count_(0) { | 66 : texture_upload_count_(0) { |
28 } | 67 } |
29 | 68 |
30 AsyncPixelTransferDelegateSync::~AsyncPixelTransferDelegateSync() {} | 69 AsyncPixelTransferDelegateSync::~AsyncPixelTransferDelegateSync() {} |
31 | 70 |
32 AsyncPixelTransferState* AsyncPixelTransferDelegateSync:: | 71 AsyncPixelTransferState* AsyncPixelTransferDelegateSync:: |
33 CreatePixelTransferState(GLuint texture_id, | 72 CreatePixelTransferState(GLuint texture_id, |
34 const AsyncTexImage2DParams& define_params) { | 73 const AsyncTexImage2DParams& define_params) { |
35 return new AsyncPixelTransferStateImpl; | 74 return new AsyncPixelTransferStateImpl; |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 return total_texture_upload_time_; | 141 return total_texture_upload_time_; |
103 } | 142 } |
104 | 143 |
105 void AsyncPixelTransferDelegateSync::ProcessMorePendingTransfers() { | 144 void AsyncPixelTransferDelegateSync::ProcessMorePendingTransfers() { |
106 } | 145 } |
107 | 146 |
108 bool AsyncPixelTransferDelegateSync::NeedsProcessMorePendingTransfers() { | 147 bool AsyncPixelTransferDelegateSync::NeedsProcessMorePendingTransfers() { |
109 return false; | 148 return false; |
110 } | 149 } |
111 | 150 |
| 151 AsyncPixelTransferManagerSync::AsyncPixelTransferManagerSync() |
| 152 : delegate_(new AsyncPixelTransferDelegateSync()) {} |
| 153 |
| 154 AsyncPixelTransferManagerSync::~AsyncPixelTransferManagerSync() {} |
| 155 |
| 156 AsyncPixelTransferDelegate* |
| 157 AsyncPixelTransferManagerSync::GetAsyncPixelTransferDelegate() { |
| 158 return delegate_.get(); |
| 159 } |
| 160 |
112 } // namespace gpu | 161 } // namespace gpu |
113 | 162 |
OLD | NEW |