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

Unified Diff: ui/gl/async_pixel_transfer_delegate.h

Issue 11428140: gpu: Add async pixel transfer interface, stub and tests. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Added memory dup/mmap Created 8 years 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.h
diff --git a/ui/gl/async_pixel_transfer_delegate.h b/ui/gl/async_pixel_transfer_delegate.h
new file mode 100644
index 0000000000000000000000000000000000000000..646a6c857c72b0610b4fa2cd86d4a12a86c294ea
--- /dev/null
+++ b/ui/gl/async_pixel_transfer_delegate.h
@@ -0,0 +1,94 @@
+// Copyright (c) 2011 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_H_
+#define UI_GL_ASYNC_TASK_DELEGATE_H_
+
+#include "base/basictypes.h"
+#include "build/build_config.h"
+#include "ui/gl/gl_bindings.h"
+
+namespace base {
+ class SharedMemory;
greggman 2012/12/06 06:52:00 nit: don't intent inside namespaces
epenner 2012/12/08 03:15:04 Done.
+}
+
+namespace gfx {
+
+// AsyncPixelTransferState holds the resources required to do async
+// transfers on one texture. It should stay alive for the lifetime
+// of the texture to allow multiple transfers.
+class AsyncPixelTransferState
+ : public base::RefCounted<AsyncPixelTransferState> {
+ public:
+ AsyncPixelTransferState() {}
+ virtual ~AsyncPixelTransferState() {};
reveman 2012/12/06 16:01:39 nit: destructor of ref counted class should not be
epenner 2012/12/08 03:15:04 Done.
+
+ // Returns true if there is a transfer in progress.
+ virtual bool TransferIsInProgress() = 0;
+
+ // Bind the async texture and perform any other custom binding.
+ // TODO(epenner): Android currently needs this to lazily bind
+ // a new EGLImage to the texture. We can get rid of this
+ // if we can make the textures context current during a
+ // 'completed' callback on the main thread.
+ virtual void BindTexture(GLenum target) = 0;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(AsyncPixelTransferState);
+};
+
+
+class AsyncPixelTransferDelegate {
+ public:
+ // TODO: Should this be owned by a GPU process object?
+ // We only need one in the GPU process, so this is currently
+ // just a lazy instance.
+ static AsyncPixelTransferDelegate* Get();
+
+ virtual scoped_refptr<AsyncPixelTransferState>
+ CreatePixelTransferState(GLuint texture) = 0;
+
+ virtual void AsyncNotifyCompletion(
+ const base::Closure& notify_task) = 0;
+
+ virtual void AsyncTexImage2D(
+ AsyncPixelTransferState*,
+ GLenum target,
+ GLint level,
+ GLenum internal_format,
+ GLsizei width,
+ GLsizei height,
+ GLint border,
+ GLenum format,
+ GLenum type,
+ base::SharedMemory*,
+ uint32 shm_size,
+ uint32 shm_data_offset,
+ uint32 shm_data_size) = 0;
+
+ virtual void AsyncTexSubImage2D(
+ AsyncPixelTransferState*,
+ GLenum target,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLenum type,
+ base::SharedMemory*,
+ uint32 shm_size,
+ uint32 shm_data_offset,
+ uint32 shm_data_size) = 0;
+
+ protected:
+ AsyncPixelTransferDelegate() {}
+ virtual ~AsyncPixelTransferDelegate() {}
+ private:
+ DISALLOW_COPY_AND_ASSIGN(AsyncPixelTransferDelegate);
+};
+
+} // namespace gfx
+
+#endif // UI_GL_ASYNC_TASK_DELEGATE_H_

Powered by Google App Engine
This is Rietveld 408576698