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_stub.h" | 5 #include "gpu/command_buffer/service/async_pixel_transfer_manager_stub.h" |
6 | 6 |
7 #include "gpu/command_buffer/service/async_pixel_transfer_delegate.h" | 7 #include "gpu/command_buffer/service/async_pixel_transfer_delegate.h" |
8 | 8 |
9 namespace gpu { | 9 namespace gpu { |
10 | 10 |
11 namespace { | |
12 | |
13 class AsyncPixelTransferStateImpl : public AsyncPixelTransferState { | |
14 public: | |
15 AsyncPixelTransferStateImpl() {} | |
16 | |
17 // Implement AsyncPixelTransferState: | |
18 virtual bool TransferIsInProgress() OVERRIDE { | |
19 return false; | |
20 } | |
21 | |
22 private: | |
23 virtual ~AsyncPixelTransferStateImpl() {} | |
24 }; | |
25 | |
26 } // namespace | |
27 | |
28 class AsyncPixelTransferDelegateStub : public AsyncPixelTransferDelegate { | 11 class AsyncPixelTransferDelegateStub : public AsyncPixelTransferDelegate { |
29 public: | 12 public: |
30 AsyncPixelTransferDelegateStub(); | 13 AsyncPixelTransferDelegateStub(); |
31 virtual ~AsyncPixelTransferDelegateStub(); | 14 virtual ~AsyncPixelTransferDelegateStub(); |
32 | 15 |
33 // Implement AsyncPixelTransferDelegate: | 16 // Implement AsyncPixelTransferDelegate: |
34 virtual AsyncPixelTransferState* CreatePixelTransferState( | |
35 GLuint texture_id, | |
36 const AsyncTexImage2DParams& define_params) OVERRIDE; | |
37 virtual void AsyncTexImage2D( | 17 virtual void AsyncTexImage2D( |
38 AsyncPixelTransferState* state, | |
39 const AsyncTexImage2DParams& tex_params, | 18 const AsyncTexImage2DParams& tex_params, |
40 const AsyncMemoryParams& mem_params, | 19 const AsyncMemoryParams& mem_params, |
41 const base::Closure& bind_callback) OVERRIDE; | 20 const base::Closure& bind_callback) OVERRIDE; |
42 virtual void AsyncTexSubImage2D( | 21 virtual void AsyncTexSubImage2D( |
43 AsyncPixelTransferState* transfer_state, | |
44 const AsyncTexSubImage2DParams& tex_params, | 22 const AsyncTexSubImage2DParams& tex_params, |
45 const AsyncMemoryParams& mem_params) OVERRIDE; | 23 const AsyncMemoryParams& mem_params) OVERRIDE; |
46 virtual void WaitForTransferCompletion( | 24 virtual bool TransferIsInProgress() OVERRIDE; |
47 AsyncPixelTransferState* state) OVERRIDE; | 25 virtual void WaitForTransferCompletion() OVERRIDE; |
48 | 26 |
49 private: | 27 private: |
50 DISALLOW_COPY_AND_ASSIGN(AsyncPixelTransferDelegateStub); | 28 DISALLOW_COPY_AND_ASSIGN(AsyncPixelTransferDelegateStub); |
51 }; | 29 }; |
52 | 30 |
53 AsyncPixelTransferDelegateStub::AsyncPixelTransferDelegateStub() {} | 31 AsyncPixelTransferDelegateStub::AsyncPixelTransferDelegateStub() {} |
54 | 32 |
55 AsyncPixelTransferDelegateStub::~AsyncPixelTransferDelegateStub() {} | 33 AsyncPixelTransferDelegateStub::~AsyncPixelTransferDelegateStub() {} |
56 | 34 |
57 AsyncPixelTransferState* AsyncPixelTransferDelegateStub:: | |
58 CreatePixelTransferState(GLuint texture_id, | |
59 const AsyncTexImage2DParams& define_params) { | |
60 return new AsyncPixelTransferStateImpl; | |
61 } | |
62 | |
63 void AsyncPixelTransferDelegateStub::AsyncTexImage2D( | 35 void AsyncPixelTransferDelegateStub::AsyncTexImage2D( |
64 AsyncPixelTransferState* transfer_state, | |
65 const AsyncTexImage2DParams& tex_params, | 36 const AsyncTexImage2DParams& tex_params, |
66 const AsyncMemoryParams& mem_params, | 37 const AsyncMemoryParams& mem_params, |
67 const base::Closure& bind_callback) { | 38 const base::Closure& bind_callback) { |
68 bind_callback.Run(); | 39 bind_callback.Run(); |
69 } | 40 } |
70 | 41 |
71 void AsyncPixelTransferDelegateStub::AsyncTexSubImage2D( | 42 void AsyncPixelTransferDelegateStub::AsyncTexSubImage2D( |
72 AsyncPixelTransferState* transfer_state, | |
73 const AsyncTexSubImage2DParams& tex_params, | 43 const AsyncTexSubImage2DParams& tex_params, |
74 const AsyncMemoryParams& mem_params) { | 44 const AsyncMemoryParams& mem_params) { |
75 } | 45 } |
76 | 46 |
77 void AsyncPixelTransferDelegateStub::WaitForTransferCompletion( | 47 bool AsyncPixelTransferDelegateStub::TransferIsInProgress() { |
78 AsyncPixelTransferState* state) { | 48 return false; |
79 } | 49 } |
80 | 50 |
81 AsyncPixelTransferManagerStub::AsyncPixelTransferManagerStub() | 51 void AsyncPixelTransferDelegateStub::WaitForTransferCompletion() {} |
82 : delegate_(new AsyncPixelTransferDelegateStub()) {} | 52 |
| 53 AsyncPixelTransferManagerStub::AsyncPixelTransferManagerStub() {} |
83 | 54 |
84 AsyncPixelTransferManagerStub::~AsyncPixelTransferManagerStub() {} | 55 AsyncPixelTransferManagerStub::~AsyncPixelTransferManagerStub() {} |
85 | 56 |
86 void AsyncPixelTransferManagerStub::BindCompletedAsyncTransfers() { | 57 void AsyncPixelTransferManagerStub::BindCompletedAsyncTransfers() { |
87 } | 58 } |
88 | 59 |
89 void AsyncPixelTransferManagerStub::AsyncNotifyCompletion( | 60 void AsyncPixelTransferManagerStub::AsyncNotifyCompletion( |
90 const AsyncMemoryParams& mem_params, | 61 const AsyncMemoryParams& mem_params, |
91 const CompletionCallback& callback) { | 62 const CompletionCallback& callback) { |
92 callback.Run(mem_params); | 63 callback.Run(mem_params); |
93 } | 64 } |
94 | 65 |
95 uint32 AsyncPixelTransferManagerStub::GetTextureUploadCount() { | 66 uint32 AsyncPixelTransferManagerStub::GetTextureUploadCount() { |
96 return 0; | 67 return 0; |
97 } | 68 } |
98 | 69 |
99 base::TimeDelta AsyncPixelTransferManagerStub::GetTotalTextureUploadTime() { | 70 base::TimeDelta AsyncPixelTransferManagerStub::GetTotalTextureUploadTime() { |
100 return base::TimeDelta(); | 71 return base::TimeDelta(); |
101 } | 72 } |
102 | 73 |
103 void AsyncPixelTransferManagerStub::ProcessMorePendingTransfers() { | 74 void AsyncPixelTransferManagerStub::ProcessMorePendingTransfers() { |
104 } | 75 } |
105 | 76 |
106 bool AsyncPixelTransferManagerStub::NeedsProcessMorePendingTransfers() { | 77 bool AsyncPixelTransferManagerStub::NeedsProcessMorePendingTransfers() { |
107 return false; | 78 return false; |
108 } | 79 } |
109 | 80 |
110 AsyncPixelTransferDelegate* | 81 AsyncPixelTransferDelegate* |
111 AsyncPixelTransferManagerStub::GetAsyncPixelTransferDelegate() { | 82 AsyncPixelTransferManagerStub::CreatePixelTransferDelegateImpl( |
112 return delegate_.get(); | 83 gles2::TextureRef* ref, |
| 84 const AsyncTexImage2DParams& define_params) { |
| 85 return new AsyncPixelTransferDelegateStub(); |
113 } | 86 } |
114 | 87 |
115 } // namespace gpu | 88 } // namespace gpu |
OLD | NEW |