Chromium Code Reviews| Index: ui/gl/async_pixel_transfer_delegate_stub.h |
| diff --git a/ui/gl/async_pixel_transfer_delegate_stub.h b/ui/gl/async_pixel_transfer_delegate_stub.h |
| index cb21d8cbe824dc66ce819dbf7bfa386bc143cf67..38f40ed7541ff3f5da28afe79285d3ff3e657403 100644 |
| --- a/ui/gl/async_pixel_transfer_delegate_stub.h |
| +++ b/ui/gl/async_pixel_transfer_delegate_stub.h |
| @@ -5,29 +5,21 @@ |
| #ifndef UI_GL_ASYNC_TASK_DELEGATE_STUB_H_ |
| #define UI_GL_ASYNC_TASK_DELEGATE_STUB_H_ |
| +#include <list> |
| +#include <queue> |
| + |
| +#include "base/callback.h" |
| #include "ui/gl/async_pixel_transfer_delegate.h" |
| namespace gfx { |
| - |
| -class AsyncTransferStateStub : public AsyncPixelTransferState { |
| - public: |
| - // implement AsyncPixelTransferState: |
| - virtual bool TransferIsInProgress() OVERRIDE; |
| - virtual void BindTransfer(AsyncTexImage2DParams* bound_params) OVERRIDE; |
| - |
| - private: |
| - friend class AsyncPixelTransferDelegateStub; |
| - bool needs_late_bind_; |
| - AsyncTexImage2DParams late_bind_define_params_ ; |
| - |
| - explicit AsyncTransferStateStub(GLuint texture_id); |
| - virtual ~AsyncTransferStateStub(); |
| - DISALLOW_COPY_AND_ASSIGN(AsyncTransferStateStub); |
| -}; |
| +class GLSurface; |
| +class TransferStateInternalStub; |
| +class ScopedSafeSharedMemory; |
| // Class which handles async pixel transfers (as a fallback). |
| // This class just does the uploads synchronously. |
|
Sami
2013/03/07 16:57:19
Please update this comment. Maybe the class could
reveman
2013/03/07 20:21:04
Updated the comment.
I think there's some cleanup
|
| -class AsyncPixelTransferDelegateStub : public AsyncPixelTransferDelegate { |
| +class AsyncPixelTransferDelegateStub : public AsyncPixelTransferDelegate, |
| + public base::SupportsWeakPtr<AsyncPixelTransferDelegateStub> { |
| public: |
| static scoped_ptr<AsyncPixelTransferDelegate> |
| Create(gfx::GLContext* context); |
| @@ -48,17 +40,46 @@ class AsyncPixelTransferDelegateStub : public AsyncPixelTransferDelegate { |
| const AsyncTexSubImage2DParams& tex_params, |
| const AsyncMemoryParams& mem_params) OVERRIDE; |
| virtual void WaitForTransferCompletion( |
| - AsyncPixelTransferState* state) OVERRIDE; |
| + AsyncPixelTransferState* transfer_state) OVERRIDE; |
| virtual uint32 GetTextureUploadCount() OVERRIDE; |
| virtual base::TimeDelta GetTotalTextureUploadTime() OVERRIDE; |
| + virtual void ProcessPendingTransfers() OVERRIDE; |
| + virtual bool HasPendingTransfers() OVERRIDE; |
| + |
| private: |
| + struct Transfer { |
| + Transfer(TransferStateInternalStub* state, const base::Closure& task); |
| + ~Transfer(); |
| + |
| + scoped_refptr<TransferStateInternalStub> state; |
| + base::Closure task; |
| + std::queue<base::Closure> notifications; |
| + }; |
| + |
| // implement AsyncPixelTransferDelegate: |
| virtual AsyncPixelTransferState* |
| CreateRawPixelTransferState(GLuint texture_id) OVERRIDE; |
| + void PerformNotifyCompletion( |
| + AsyncMemoryParams mem_params, |
| + ScopedSafeSharedMemory* safe_shared_memory, |
| + const CompletionCallback& callback); |
| + void PerformAsyncTexImage2D( |
| + scoped_refptr<TransferStateInternalStub> state, |
| + AsyncTexImage2DParams tex_params, |
| + AsyncMemoryParams mem_params, |
| + ScopedSafeSharedMemory* safe_shared_memory); |
| + void PerformAsyncTexSubImage2D( |
| + scoped_refptr<TransferStateInternalStub> state, |
| + AsyncTexSubImage2DParams tex_params, |
| + AsyncMemoryParams mem_params, |
| + ScopedSafeSharedMemory* safe_shared_memory); |
| + |
| int texture_upload_count_; |
| base::TimeDelta total_texture_upload_time_; |
| + std::list<Transfer> transfers_; |
| + |
| DISALLOW_COPY_AND_ASSIGN(AsyncPixelTransferDelegateStub); |
| }; |