| 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 #ifndef CONTENT_COMMON_GPU_GPU_COMMAND_BUFFER_STUB_H_ | 5 #ifndef CONTENT_COMMON_GPU_GPU_COMMAND_BUFFER_STUB_H_ |
| 6 #define CONTENT_COMMON_GPU_GPU_COMMAND_BUFFER_STUB_H_ | 6 #define CONTENT_COMMON_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 <string> | 11 #include <string> |
| 12 #include <vector> | 12 #include <vector> |
| 13 | 13 |
| 14 #include "base/id_map.h" | 14 #include "base/id_map.h" |
| 15 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
| 16 #include "base/task.h" | 16 #include "base/task.h" |
| 17 #include "content/common/gpu/media/gpu_video_decode_accelerator.h" | 17 #include "content/common/gpu/media/gpu_video_decode_accelerator.h" |
| 18 #include "gpu/command_buffer/common/constants.h" |
| 18 #include "gpu/command_buffer/service/command_buffer_service.h" | 19 #include "gpu/command_buffer/service/command_buffer_service.h" |
| 19 #include "gpu/command_buffer/service/context_group.h" | 20 #include "gpu/command_buffer/service/context_group.h" |
| 20 #include "gpu/command_buffer/service/gpu_scheduler.h" | 21 #include "gpu/command_buffer/service/gpu_scheduler.h" |
| 21 #include "ipc/ipc_channel.h" | 22 #include "ipc/ipc_channel.h" |
| 22 #include "ipc/ipc_message.h" | 23 #include "ipc/ipc_message.h" |
| 23 #include "ui/gfx/gl/gl_context.h" | 24 #include "ui/gfx/gl/gl_context.h" |
| 24 #include "ui/gfx/gl/gl_surface.h" | 25 #include "ui/gfx/gl/gl_surface.h" |
| 26 #include "ui/gfx/gl/gpu_preference.h" |
| 25 #include "ui/gfx/native_widget_types.h" | 27 #include "ui/gfx/native_widget_types.h" |
| 26 #include "ui/gfx/size.h" | 28 #include "ui/gfx/size.h" |
| 27 #include "ui/gfx/surface/transport_dib.h" | 29 #include "ui/gfx/surface/transport_dib.h" |
| 28 | 30 |
| 29 #if defined(OS_MACOSX) | 31 #if defined(OS_MACOSX) |
| 30 #include "ui/gfx/surface/accelerated_surface_mac.h" | 32 #include "ui/gfx/surface/accelerated_surface_mac.h" |
| 31 #endif | 33 #endif |
| 32 | 34 |
| 33 class GpuChannel; | 35 class GpuChannel; |
| 34 class GpuWatchdog; | 36 class GpuWatchdog; |
| 35 | 37 |
| 36 class GpuCommandBufferStub | 38 class GpuCommandBufferStub |
| 37 : public IPC::Channel::Listener, | 39 : public IPC::Channel::Listener, |
| 38 public IPC::Message::Sender, | 40 public IPC::Message::Sender, |
| 39 public base::SupportsWeakPtr<GpuCommandBufferStub> { | 41 public base::SupportsWeakPtr<GpuCommandBufferStub> { |
| 40 public: | 42 public: |
| 41 GpuCommandBufferStub( | 43 GpuCommandBufferStub( |
| 42 GpuChannel* channel, | 44 GpuChannel* channel, |
| 43 GpuCommandBufferStub* share_group, | 45 GpuCommandBufferStub* share_group, |
| 44 gfx::PluginWindowHandle handle, | 46 gfx::PluginWindowHandle handle, |
| 45 const gfx::Size& size, | 47 const gfx::Size& size, |
| 46 const gpu::gles2::DisallowedFeatures& disallowed_features, | 48 const gpu::gles2::DisallowedFeatures& disallowed_features, |
| 47 const std::string& allowed_extensions, | 49 const std::string& allowed_extensions, |
| 48 const std::vector<int32>& attribs, | 50 const std::vector<int32>& attribs, |
| 51 gfx::GpuPreference gpu_preference, |
| 49 int32 route_id, | 52 int32 route_id, |
| 50 int32 renderer_id, | 53 int32 renderer_id, |
| 51 int32 render_view_id, | 54 int32 render_view_id, |
| 52 GpuWatchdog* watchdog, | 55 GpuWatchdog* watchdog, |
| 53 bool software); | 56 bool software); |
| 54 | 57 |
| 55 virtual ~GpuCommandBufferStub(); | 58 virtual ~GpuCommandBufferStub(); |
| 56 | 59 |
| 57 // IPC::Channel::Listener implementation: | 60 // IPC::Channel::Listener implementation: |
| 58 virtual bool OnMessageReceived(const IPC::Message& message); | 61 virtual bool OnMessageReceived(const IPC::Message& message); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 71 | 74 |
| 72 // Identifies a particular renderer belonging to the same renderer process. | 75 // Identifies a particular renderer belonging to the same renderer process. |
| 73 int32 render_view_id() const { return render_view_id_; } | 76 int32 render_view_id() const { return render_view_id_; } |
| 74 | 77 |
| 75 // Identifies the various GpuCommandBufferStubs in the GPU process belonging | 78 // Identifies the various GpuCommandBufferStubs in the GPU process belonging |
| 76 // to the same renderer process. | 79 // to the same renderer process. |
| 77 int32 route_id() const { return route_id_; } | 80 int32 route_id() const { return route_id_; } |
| 78 | 81 |
| 79 void ViewResized(); | 82 void ViewResized(); |
| 80 | 83 |
| 84 gfx::GpuPreference gpu_preference() { return gpu_preference_; } |
| 85 |
| 81 private: | 86 private: |
| 82 void Destroy(); | 87 void Destroy(); |
| 83 | 88 |
| 84 // Cleans up and sends reply if OnInitialize failed. | 89 // Cleans up and sends reply if OnInitialize failed. |
| 85 void OnInitializeFailed(IPC::Message* reply_message); | 90 void OnInitializeFailed(IPC::Message* reply_message); |
| 86 | 91 |
| 87 // Message handlers: | 92 // Message handlers: |
| 88 void OnInitialize(base::SharedMemoryHandle ring_buffer, | 93 void OnInitialize(base::SharedMemoryHandle ring_buffer, |
| 89 int32 size, | 94 int32 size, |
| 90 IPC::Message* reply_message); | 95 IPC::Message* reply_message); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 GpuChannel* channel_; | 138 GpuChannel* channel_; |
| 134 | 139 |
| 135 // The group of contexts that share namespaces with this context. | 140 // The group of contexts that share namespaces with this context. |
| 136 scoped_refptr<gpu::gles2::ContextGroup> context_group_; | 141 scoped_refptr<gpu::gles2::ContextGroup> context_group_; |
| 137 | 142 |
| 138 gfx::PluginWindowHandle handle_; | 143 gfx::PluginWindowHandle handle_; |
| 139 gfx::Size initial_size_; | 144 gfx::Size initial_size_; |
| 140 gpu::gles2::DisallowedFeatures disallowed_features_; | 145 gpu::gles2::DisallowedFeatures disallowed_features_; |
| 141 std::string allowed_extensions_; | 146 std::string allowed_extensions_; |
| 142 std::vector<int32> requested_attribs_; | 147 std::vector<int32> requested_attribs_; |
| 148 gfx::GpuPreference gpu_preference_; |
| 143 int32 route_id_; | 149 int32 route_id_; |
| 144 bool software_; | 150 bool software_; |
| 145 uint32 last_flush_count_; | 151 uint32 last_flush_count_; |
| 146 | 152 |
| 147 // The following two fields are used on Mac OS X to identify the window | 153 // The following two fields are used on Mac OS X to identify the window |
| 148 // for the rendering results on the browser side. | 154 // for the rendering results on the browser side. |
| 149 int32 renderer_id_; | 155 int32 renderer_id_; |
| 150 int32 render_view_id_; | 156 int32 render_view_id_; |
| 151 | 157 |
| 152 scoped_ptr<gpu::CommandBufferService> command_buffer_; | 158 scoped_ptr<gpu::CommandBufferService> command_buffer_; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 167 IDMap<GpuVideoDecodeAccelerator, IDMapOwnPointer> video_decoders_; | 173 IDMap<GpuVideoDecodeAccelerator, IDMapOwnPointer> video_decoders_; |
| 168 | 174 |
| 169 ScopedRunnableMethodFactory<GpuCommandBufferStub> task_factory_; | 175 ScopedRunnableMethodFactory<GpuCommandBufferStub> task_factory_; |
| 170 | 176 |
| 171 DISALLOW_COPY_AND_ASSIGN(GpuCommandBufferStub); | 177 DISALLOW_COPY_AND_ASSIGN(GpuCommandBufferStub); |
| 172 }; | 178 }; |
| 173 | 179 |
| 174 #endif // defined(ENABLE_GPU) | 180 #endif // defined(ENABLE_GPU) |
| 175 | 181 |
| 176 #endif // CONTENT_COMMON_GPU_GPU_COMMAND_BUFFER_STUB_H_ | 182 #endif // CONTENT_COMMON_GPU_GPU_COMMAND_BUFFER_STUB_H_ |
| OLD | NEW |