| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // This API is consistent with other OpenGL setup APIs like window's WGL | 5 // This API is consistent with other OpenGL setup APIs like window's WGL |
| 6 // and pepper's PGL. This API is used to manage OpenGL RendererGLContexts in the | 6 // and pepper's PGL. This API is used to manage OpenGL RendererGLContexts in the |
| 7 // Chrome renderer process in a way that is consistent with other platforms. | 7 // Chrome renderer process in a way that is consistent with other platforms. |
| 8 | 8 |
| 9 #ifndef CONTENT_RENDERER_GPU_RENDERER_GL_CONTEXT_H_ | 9 #ifndef CONTENT_RENDERER_GPU_RENDERER_GL_CONTEXT_H_ |
| 10 #define CONTENT_RENDERER_GPU_RENDERER_GL_CONTEXT_H_ | 10 #define CONTENT_RENDERER_GPU_RENDERER_GL_CONTEXT_H_ |
| 11 #pragma once | 11 #pragma once |
| 12 | 12 |
| 13 #include "base/callback_old.h" | 13 #include "base/callback_old.h" |
| 14 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
| 15 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
| 16 #include "base/memory/weak_ptr.h" | 16 #include "base/memory/weak_ptr.h" |
| 17 #include "base/threading/non_thread_safe.h" |
| 17 #include "build/build_config.h" | 18 #include "build/build_config.h" |
| 18 #include "ui/gfx/native_widget_types.h" | 19 #include "ui/gfx/native_widget_types.h" |
| 19 #include "ui/gfx/size.h" | 20 #include "ui/gfx/size.h" |
| 20 | 21 |
| 21 class GpuChannelHost; | 22 class GpuChannelHost; |
| 22 class MessageLoop; | |
| 23 class CommandBufferProxy; | 23 class CommandBufferProxy; |
| 24 class GURL; | 24 class GURL; |
| 25 class Task; | 25 class Task; |
| 26 class TransportTextureHost; | 26 class TransportTextureHost; |
| 27 | 27 |
| 28 namespace gpu { | 28 namespace gpu { |
| 29 namespace gles2 { | 29 namespace gles2 { |
| 30 class GLES2CmdHelper; | 30 class GLES2CmdHelper; |
| 31 class GLES2Implementation; | 31 class GLES2Implementation; |
| 32 } | 32 } |
| 33 } | 33 } |
| 34 | 34 |
| 35 class RendererGLContext : public base::SupportsWeakPtr<RendererGLContext> { | 35 class RendererGLContext : public base::SupportsWeakPtr<RendererGLContext>, |
| 36 public base::NonThreadSafe { |
| 36 public: | 37 public: |
| 37 // These are the same error codes as used by EGL. | 38 // These are the same error codes as used by EGL. |
| 38 enum Error { | 39 enum Error { |
| 39 SUCCESS = 0x3000, | 40 SUCCESS = 0x3000, |
| 40 NOT_INITIALIZED = 0x3001, | 41 NOT_INITIALIZED = 0x3001, |
| 41 BAD_ATTRIBUTE = 0x3004, | 42 BAD_ATTRIBUTE = 0x3004, |
| 42 BAD_RendererGLContext = 0x3006, | 43 BAD_RendererGLContext = 0x3006, |
| 43 CONTEXT_LOST = 0x300E | 44 CONTEXT_LOST = 0x300E |
| 44 }; | 45 }; |
| 45 | 46 |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 scoped_refptr<GpuChannelHost> channel_; | 193 scoped_refptr<GpuChannelHost> channel_; |
| 193 base::WeakPtr<RendererGLContext> parent_; | 194 base::WeakPtr<RendererGLContext> parent_; |
| 194 scoped_ptr<Callback1<ContextLostReason>::Type> context_lost_callback_; | 195 scoped_ptr<Callback1<ContextLostReason>::Type> context_lost_callback_; |
| 195 uint32 parent_texture_id_; | 196 uint32 parent_texture_id_; |
| 196 CommandBufferProxy* command_buffer_; | 197 CommandBufferProxy* command_buffer_; |
| 197 gpu::gles2::GLES2CmdHelper* gles2_helper_; | 198 gpu::gles2::GLES2CmdHelper* gles2_helper_; |
| 198 int32 transfer_buffer_id_; | 199 int32 transfer_buffer_id_; |
| 199 gpu::gles2::GLES2Implementation* gles2_implementation_; | 200 gpu::gles2::GLES2Implementation* gles2_implementation_; |
| 200 Error last_error_; | 201 Error last_error_; |
| 201 int frame_number_; | 202 int frame_number_; |
| 202 #ifndef NDEBUG | |
| 203 // Used to assert that this object is used on a single thread. | |
| 204 MessageLoop* message_loop_; | |
| 205 #endif | |
| 206 | 203 |
| 207 DISALLOW_COPY_AND_ASSIGN(RendererGLContext); | 204 DISALLOW_COPY_AND_ASSIGN(RendererGLContext); |
| 208 }; | 205 }; |
| 209 | 206 |
| 210 #endif // CONTENT_RENDERER_GPU_RENDERER_GL_CONTEXT_H_ | 207 #endif // CONTENT_RENDERER_GPU_RENDERER_GL_CONTEXT_H_ |
| OLD | NEW |