Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(465)

Unified Diff: ui/gl/async_pixel_transfer_delegate_stub.h

Issue 12040049: gpu: Implement idle async pixel transfers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address review feedback and make BindFinishedAsyncPixelTransfers() handle out of order async upload… Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..277cfe0d03e56b821ffc75068b29c7ee736c83e1 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 GLSurface;
+class TransferStateInternalStub;
+class ScopedSafeSharedMemory;
-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 which handles async pixel transfers (as a fallback).
-// This class just does the uploads synchronously.
-class AsyncPixelTransferDelegateStub : public AsyncPixelTransferDelegate {
+// Class which handles async pixel transfers in a platform
+// independent way.
+class AsyncPixelTransferDelegateStub : public AsyncPixelTransferDelegate,
+ public base::SupportsWeakPtr<AsyncPixelTransferDelegateStub> {
public:
static scoped_ptr<AsyncPixelTransferDelegate>
Create(gfx::GLContext* context);
@@ -48,17 +40,48 @@ 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 CanProcessPendingTransfers() OVERRIDE;
+
private:
+ struct Transfer {
+ Transfer(TransferStateInternalStub* state, const base::Closure& task);
+ ~Transfer();
+
+ scoped_refptr<TransferStateInternalStub> state;
+ base::Closure task;
+ std::queue<base::Closure> notifications;
+ };
+
+ void ProcessTransfer(Transfer& transfer);
+
// 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);
};

Powered by Google App Engine
This is Rietveld 408576698