Chromium Code Reviews| 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..356fd554f018479bd78082a9b997f5e48f89456a |
| --- /dev/null |
| +++ b/ui/gl/async_pixel_transfer_delegate.h |
| @@ -0,0 +1,84 @@ |
| +// 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 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> { |
|
apatrick_chromium
2012/12/04 20:59:22
RefCountedThreadSafe
epenner
2012/12/08 03:15:04
I haven't made this thread safe as the lifetime is
|
| + public: |
| + AsyncPixelTransferState() {} |
| + virtual ~AsyncPixelTransferState() {}; |
| + |
| + // 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*, |
|
apatrick_chromium
2012/12/04 20:59:22
nit: indentation is out by 2 spaces
epenner
2012/12/08 03:15:04
Done.
|
| + GLenum target, |
| + GLint level, |
| + GLenum internal_format, |
| + GLsizei width, |
| + GLsizei height, |
| + GLint border, |
| + GLenum format, |
| + GLenum type, |
| + const void* data) = 0; |
| + |
| + virtual void AsyncTexSubImage2D( |
| + AsyncPixelTransferState*, |
| + GLenum target, |
| + GLint level, |
| + GLint xoffset, |
| + GLint yoffset, |
| + GLsizei width, |
| + GLsizei height, |
| + GLenum format, |
| + GLenum type, |
| + const void* data) = 0; |
| + |
| + protected: |
| + AsyncPixelTransferDelegate() {} |
| + virtual ~AsyncPixelTransferDelegate() {} |
| + private: |
| + DISALLOW_COPY_AND_ASSIGN(AsyncPixelTransferDelegate); |
| +}; |
| + |
| +} // namespace gfx |
| + |
| +#endif // UI_GL_ASYNC_TASK_DELEGATE_H_ |