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

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: Add DCHECKs to ensure idle async uploads are only used with GL_TEXTURE_2D target 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
« no previous file with comments | « ui/gl/async_pixel_transfer_delegate_android.cc ('k') | ui/gl/async_pixel_transfer_delegate_idle.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..101c5264e5cc167c14d5b424b64d20eceb8ce587
--- /dev/null
+++ b/ui/gl/async_pixel_transfer_delegate_idle.h
@@ -0,0 +1,96 @@
+// 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 bool ProcessMorePendingTransfers() OVERRIDE;
+ virtual bool NeedsProcessMorePendingTransfers() OVERRIDE;
+
+ private:
+ struct Transfer {
+ Transfer(uint64 id, const base::Closure& task);
+ ~Transfer();
+
+ uint64 id;
+ 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(
+ AsyncTexImage2DParams tex_params,
+ AsyncMemoryParams mem_params,
+ const base::Closure& bind_callback,
+ ScopedSafeSharedMemory* safe_shared_memory,
+ GLuint texture_id);
+ void PerformAsyncTexSubImage2D(
+ AsyncTexSubImage2DParams tex_params,
+ AsyncMemoryParams mem_params,
+ ScopedSafeSharedMemory* safe_shared_memory,
+ GLuint texture_id);
+
+ int texture_upload_count_;
+ base::TimeDelta total_texture_upload_time_;
+
+ std::list<Transfer> transfers_;
+
+ DISALLOW_COPY_AND_ASSIGN(AsyncPixelTransferDelegateIdle);
+};
+
+} // namespace gfx
+
+#endif // UI_GL_ASYNC_TASK_DELEGATE_IDLE_H_
+
« no previous file with comments | « ui/gl/async_pixel_transfer_delegate_android.cc ('k') | ui/gl/async_pixel_transfer_delegate_idle.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698