Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef UI_GL_ASYNC_TASK_DELEGATE_H_ | |
| 6 #define UI_GL_ASYNC_TASK_DELEGATE_H_ | |
| 7 | |
| 8 #include "base/basictypes.h" | |
| 9 #include "build/build_config.h" | |
| 10 #include "ui/gl/gl_bindings.h" | |
| 11 | |
| 12 namespace base { | |
| 13 class SharedMemory; | |
|
greggman
2012/12/06 06:52:00
nit: don't intent inside namespaces
epenner
2012/12/08 03:15:04
Done.
| |
| 14 } | |
| 15 | |
| 16 namespace gfx { | |
| 17 | |
| 18 // AsyncPixelTransferState holds the resources required to do async | |
| 19 // transfers on one texture. It should stay alive for the lifetime | |
| 20 // of the texture to allow multiple transfers. | |
| 21 class AsyncPixelTransferState | |
| 22 : public base::RefCounted<AsyncPixelTransferState> { | |
| 23 public: | |
| 24 AsyncPixelTransferState() {} | |
| 25 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.
| |
| 26 | |
| 27 // Returns true if there is a transfer in progress. | |
| 28 virtual bool TransferIsInProgress() = 0; | |
| 29 | |
| 30 // Bind the async texture and perform any other custom binding. | |
| 31 // TODO(epenner): Android currently needs this to lazily bind | |
| 32 // a new EGLImage to the texture. We can get rid of this | |
| 33 // if we can make the textures context current during a | |
| 34 // 'completed' callback on the main thread. | |
| 35 virtual void BindTexture(GLenum target) = 0; | |
| 36 | |
| 37 private: | |
| 38 DISALLOW_COPY_AND_ASSIGN(AsyncPixelTransferState); | |
| 39 }; | |
| 40 | |
| 41 | |
| 42 class AsyncPixelTransferDelegate { | |
| 43 public: | |
| 44 // TODO: Should this be owned by a GPU process object? | |
| 45 // We only need one in the GPU process, so this is currently | |
| 46 // just a lazy instance. | |
| 47 static AsyncPixelTransferDelegate* Get(); | |
| 48 | |
| 49 virtual scoped_refptr<AsyncPixelTransferState> | |
| 50 CreatePixelTransferState(GLuint texture) = 0; | |
| 51 | |
| 52 virtual void AsyncNotifyCompletion( | |
| 53 const base::Closure& notify_task) = 0; | |
| 54 | |
| 55 virtual void AsyncTexImage2D( | |
| 56 AsyncPixelTransferState*, | |
| 57 GLenum target, | |
| 58 GLint level, | |
| 59 GLenum internal_format, | |
| 60 GLsizei width, | |
| 61 GLsizei height, | |
| 62 GLint border, | |
| 63 GLenum format, | |
| 64 GLenum type, | |
| 65 base::SharedMemory*, | |
| 66 uint32 shm_size, | |
| 67 uint32 shm_data_offset, | |
| 68 uint32 shm_data_size) = 0; | |
| 69 | |
| 70 virtual void AsyncTexSubImage2D( | |
| 71 AsyncPixelTransferState*, | |
| 72 GLenum target, | |
| 73 GLint level, | |
| 74 GLint xoffset, | |
| 75 GLint yoffset, | |
| 76 GLsizei width, | |
| 77 GLsizei height, | |
| 78 GLenum format, | |
| 79 GLenum type, | |
| 80 base::SharedMemory*, | |
| 81 uint32 shm_size, | |
| 82 uint32 shm_data_offset, | |
| 83 uint32 shm_data_size) = 0; | |
| 84 | |
| 85 protected: | |
| 86 AsyncPixelTransferDelegate() {} | |
| 87 virtual ~AsyncPixelTransferDelegate() {} | |
| 88 private: | |
| 89 DISALLOW_COPY_AND_ASSIGN(AsyncPixelTransferDelegate); | |
| 90 }; | |
| 91 | |
| 92 } // namespace gfx | |
| 93 | |
| 94 #endif // UI_GL_ASYNC_TASK_DELEGATE_H_ | |
| OLD | NEW |