| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #ifndef CHROME_GPU_GPU_COMMAND_BUFFER_STUB_H_ | 5 #ifndef CHROME_GPU_GPU_COMMAND_BUFFER_STUB_H_ |
| 6 #define CHROME_GPU_GPU_COMMAND_BUFFER_STUB_H_ | 6 #define CHROME_GPU_GPU_COMMAND_BUFFER_STUB_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #if defined(ENABLE_GPU) | 9 #if defined(ENABLE_GPU) |
| 10 | 10 |
| 11 #include <vector> | 11 #include <vector> |
| 12 #include <string> | 12 #include <string> |
| 13 | 13 |
| 14 #include "base/process.h" | 14 #include "base/process.h" |
| 15 #include "base/weak_ptr.h" | 15 #include "base/weak_ptr.h" |
| 16 #include "gpu/command_buffer/service/command_buffer_service.h" | 16 #include "gpu/command_buffer/service/command_buffer_service.h" |
| 17 #include "gpu/command_buffer/service/gpu_processor.h" | 17 #include "gpu/command_buffer/service/gpu_processor.h" |
| 18 #include "ipc/ipc_channel.h" | 18 #include "ipc/ipc_channel.h" |
| 19 #include "ipc/ipc_message.h" | 19 #include "ipc/ipc_message.h" |
| 20 #include "ui/gfx/native_widget_types.h" | 20 #include "ui/gfx/native_widget_types.h" |
| 21 #include "ui/gfx/size.h" | 21 #include "ui/gfx/size.h" |
| 22 | 22 |
| 23 class GpuChannel; | 23 class GpuChannel; |
| 24 | 24 |
| 25 class GpuCommandBufferStub | 25 class GpuCommandBufferStub |
| 26 : public IPC::Channel::Listener, | 26 : public IPC::Channel::Listener, |
| 27 public IPC::Message::Sender, | 27 public IPC::Message::Sender, |
| 28 public base::SupportsWeakPtr<GpuCommandBufferStub> { | 28 public base::SupportsWeakPtr<GpuCommandBufferStub> { |
| 29 public: | 29 public: |
| 30 GpuCommandBufferStub(GpuChannel* channel, | 30 GpuCommandBufferStub( |
| 31 gfx::PluginWindowHandle handle, | 31 GpuChannel* channel, |
| 32 GpuCommandBufferStub* parent, | 32 gfx::PluginWindowHandle handle, |
| 33 const gfx::Size& size, | 33 GpuCommandBufferStub* parent, |
| 34 const std::string& allowed_extensions, | 34 const gfx::Size& size, |
| 35 const std::vector<int32>& attribs, | 35 const gpu::gles2::DisallowedExtensions& disallowed_extensions, |
| 36 uint32 parent_texture_id, | 36 const std::string& allowed_extensions, |
| 37 int32 route_id, | 37 const std::vector<int32>& attribs, |
| 38 int32 renderer_id, | 38 uint32 parent_texture_id, |
| 39 int32 render_view_id); | 39 int32 route_id, |
| 40 int32 renderer_id, |
| 41 int32 render_view_id); |
| 40 | 42 |
| 41 virtual ~GpuCommandBufferStub(); | 43 virtual ~GpuCommandBufferStub(); |
| 42 | 44 |
| 43 // IPC::Channel::Listener implementation: | 45 // IPC::Channel::Listener implementation: |
| 44 virtual bool OnMessageReceived(const IPC::Message& message); | 46 virtual bool OnMessageReceived(const IPC::Message& message); |
| 45 | 47 |
| 46 // IPC::Message::Sender implementation: | 48 // IPC::Message::Sender implementation: |
| 47 virtual bool Send(IPC::Message* msg); | 49 virtual bool Send(IPC::Message* msg); |
| 48 | 50 |
| 49 // Get the GLContext associated with this object. | 51 // Get the GLContext associated with this object. |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 void ResizeCallback(gfx::Size size); | 101 void ResizeCallback(gfx::Size size); |
| 100 | 102 |
| 101 // The lifetime of objects of this class is managed by a GpuChannel. The | 103 // The lifetime of objects of this class is managed by a GpuChannel. The |
| 102 // GpuChannels destroy all the GpuCommandBufferStubs that they own when they | 104 // GpuChannels destroy all the GpuCommandBufferStubs that they own when they |
| 103 // are destroyed. So a raw pointer is safe. | 105 // are destroyed. So a raw pointer is safe. |
| 104 GpuChannel* channel_; | 106 GpuChannel* channel_; |
| 105 | 107 |
| 106 gfx::PluginWindowHandle handle_; | 108 gfx::PluginWindowHandle handle_; |
| 107 base::WeakPtr<GpuCommandBufferStub> parent_; | 109 base::WeakPtr<GpuCommandBufferStub> parent_; |
| 108 gfx::Size initial_size_; | 110 gfx::Size initial_size_; |
| 111 gpu::gles2::DisallowedExtensions disallowed_extensions_; |
| 109 std::string allowed_extensions_; | 112 std::string allowed_extensions_; |
| 110 std::vector<int32> requested_attribs_; | 113 std::vector<int32> requested_attribs_; |
| 111 uint32 parent_texture_id_; | 114 uint32 parent_texture_id_; |
| 112 int32 route_id_; | 115 int32 route_id_; |
| 113 | 116 |
| 114 #if defined(OS_WIN) | 117 #if defined(OS_WIN) |
| 115 HWND compositor_window_; | 118 HWND compositor_window_; |
| 116 #endif // defined(OS_WIN) | 119 #endif // defined(OS_WIN) |
| 117 | 120 |
| 118 // The following two fields are used on Mac OS X to identify the window | 121 // The following two fields are used on Mac OS X to identify the window |
| 119 // for the rendering results on the browser side. | 122 // for the rendering results on the browser side. |
| 120 int32 renderer_id_; | 123 int32 renderer_id_; |
| 121 int32 render_view_id_; | 124 int32 render_view_id_; |
| 122 | 125 |
| 123 scoped_ptr<gpu::CommandBufferService> command_buffer_; | 126 scoped_ptr<gpu::CommandBufferService> command_buffer_; |
| 124 scoped_ptr<gpu::GPUProcessor> processor_; | 127 scoped_ptr<gpu::GPUProcessor> processor_; |
| 125 | 128 |
| 126 DISALLOW_COPY_AND_ASSIGN(GpuCommandBufferStub); | 129 DISALLOW_COPY_AND_ASSIGN(GpuCommandBufferStub); |
| 127 }; | 130 }; |
| 128 | 131 |
| 129 #endif // defined(ENABLE_GPU) | 132 #endif // defined(ENABLE_GPU) |
| 130 | 133 |
| 131 #endif // CHROME_GPU_GPU_COMMAND_BUFFER_STUB_H_ | 134 #endif // CHROME_GPU_GPU_COMMAND_BUFFER_STUB_H_ |
| OLD | NEW |