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

Unified Diff: ui/gl/async_pixel_transfer_delegate_idle.h

Issue 12040049: gpu: Implement idle async pixel transfers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase 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_idle.h
diff --git a/ui/gl/async_pixel_transfer_delegate_idle.h b/ui/gl/async_pixel_transfer_delegate_idle.h
new file mode 100644
index 0000000000000000000000000000000000000000..fa8f43bc1bda82a6e6d5f9f0a29a0415a03f05a9
--- /dev/null
+++ b/ui/gl/async_pixel_transfer_delegate_idle.h
@@ -0,0 +1,97 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef UI_GL_ASYNC_TASK_DELEGATE_IDLE_H_
+#define UI_GL_ASYNC_TASK_DELEGATE_IDLE_H_
+
+#include <list>
+#include <queue>
+
+#include "base/callback.h"
+#include "ui/gl/async_pixel_transfer_delegate.h"
+
+namespace gfx {
+class GLSurface;
+class TransferStateInternalIdle;
+class ScopedSafeSharedMemory;
+
+// Class which handles async pixel transfers in a platform
+// independent way.
+class AsyncPixelTransferDelegateIdle : public AsyncPixelTransferDelegate,
+ public base::SupportsWeakPtr<AsyncPixelTransferDelegateIdle> {
+ public:
+ static scoped_ptr<AsyncPixelTransferDelegate>
+ Create(gfx::GLContext* context);
+
+ AsyncPixelTransferDelegateIdle();
+ virtual ~AsyncPixelTransferDelegateIdle();
+
+ // implement AsyncPixelTransferDelegate:
+ virtual bool BindCompletedAsyncTransfers() OVERRIDE;
+ virtual void AsyncNotifyCompletion(
+ const AsyncMemoryParams& mem_params,
+ const CompletionCallback& callback) OVERRIDE;
+ virtual void AsyncTexImage2D(
+ AsyncPixelTransferState* transfer_state,
+ const AsyncTexImage2DParams& tex_params,
+ const AsyncMemoryParams& mem_params,
+ const base::Closure& bind_callback) OVERRIDE;
+ virtual void AsyncTexSubImage2D(
+ AsyncPixelTransferState* transfer_state,
+ const AsyncTexSubImage2DParams& tex_params,
+ const AsyncMemoryParams& mem_params) OVERRIDE;
+ virtual void WaitForTransferCompletion(
+ AsyncPixelTransferState* transfer_state) OVERRIDE;
+ virtual uint32 GetTextureUploadCount() OVERRIDE;
+ virtual base::TimeDelta GetTotalTextureUploadTime() OVERRIDE;
+ virtual void ProcessPendingTransfers() OVERRIDE;
epenner 2013/03/13 18:58:01 Nit: This name sounds like it does all the transfe
reveman 2013/03/14 01:12:45 Now ProcessMorePendingTransfers.
+ virtual bool NeedsProcessPendingTransfers() OVERRIDE;
+
+ private:
+ struct Transfer {
+ Transfer(TransferStateInternalIdle* state, const base::Closure& task);
+ ~Transfer();
+
+ scoped_refptr<TransferStateInternalIdle> state;
epenner 2013/03/13 18:58:01 Can you confirm what happens if an AsyncPixelTrans
reveman 2013/03/14 01:12:45 oops, messed that up in my previous patch. I think
+ base::Closure task;
+ std::queue<base::Closure> notifications;
+ };
+
+ void ProcessTransfer(Transfer& transfer);
+
+ // implement AsyncPixelTransferDelegate:
+ virtual AsyncPixelTransferState*
+ CreateRawPixelTransferState(
+ GLuint texture_id,
+ const AsyncTexImage2DParams& define_params) OVERRIDE;
+
+ void PerformNotifyCompletion(
+ AsyncMemoryParams mem_params,
+ ScopedSafeSharedMemory* safe_shared_memory,
+ const CompletionCallback& callback);
+ void PerformAsyncTexImage2D(
+ scoped_refptr<TransferStateInternalIdle> state,
+ AsyncTexImage2DParams tex_params,
+ AsyncMemoryParams mem_params,
+ const base::Closure& bind_callback,
+ ScopedSafeSharedMemory* safe_shared_memory);
+ void PerformAsyncTexSubImage2D(
+ scoped_refptr<TransferStateInternalIdle> state,
+ AsyncTexSubImage2DParams tex_params,
+ AsyncMemoryParams mem_params,
+ ScopedSafeSharedMemory* safe_shared_memory);
+
+ int texture_upload_count_;
+ base::TimeDelta total_texture_upload_time_;
+
+ bool texture_dirty_;
+ std::list<Transfer> transfers_;
+
+ DISALLOW_COPY_AND_ASSIGN(AsyncPixelTransferDelegateIdle);
+};
+
+} // namespace gfx
+
+#endif // UI_GL_ASYNC_TASK_DELEGATE_IDLE_H_
+

Powered by Google App Engine
This is Rietveld 408576698