Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | 1 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 2 // found in the LICENSE file. |
| 4 | 3 |
| 5 #ifndef CONTENT_COMMON_GPU_GPU_COMMAND_BUFFER_STUB_H_ | 4 #ifndef CONTENT_COMMON_GPU_GPU_COMMAND_BUFFER_STUB_H_ |
| 6 #define CONTENT_COMMON_GPU_GPU_COMMAND_BUFFER_STUB_H_ | 5 #define CONTENT_COMMON_GPU_GPU_COMMAND_BUFFER_STUB_H_ |
| 7 #pragma once | 6 #pragma once |
| 8 | 7 |
| 9 #if defined(ENABLE_GPU) | 8 #if defined(ENABLE_GPU) |
| 10 | 9 |
| 11 #include <string> | 10 #include <string> |
| 12 #include <vector> | 11 #include <vector> |
| 13 | 12 |
| 14 #include "base/id_map.h" | 13 #include "base/id_map.h" |
| 15 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
| 15 #include "content/common/gpu/gpu_memory_management.h" | |
| 16 #include "content/common/gpu/media/gpu_video_decode_accelerator.h" | 16 #include "content/common/gpu/media/gpu_video_decode_accelerator.h" |
| 17 #include "gpu/command_buffer/common/constants.h" | 17 #include "gpu/command_buffer/common/constants.h" |
| 18 #include "gpu/command_buffer/service/command_buffer_service.h" | 18 #include "gpu/command_buffer/service/command_buffer_service.h" |
| 19 #include "gpu/command_buffer/service/context_group.h" | 19 #include "gpu/command_buffer/service/context_group.h" |
| 20 #include "gpu/command_buffer/service/gpu_scheduler.h" | 20 #include "gpu/command_buffer/service/gpu_scheduler.h" |
| 21 #include "ipc/ipc_channel.h" | 21 #include "ipc/ipc_channel.h" |
| 22 #include "ipc/ipc_message.h" | 22 #include "ipc/ipc_message.h" |
| 23 #include "ui/gfx/gl/gl_context.h" | 23 #include "ui/gfx/gl/gl_context.h" |
| 24 #include "ui/gfx/gl/gl_surface.h" | 24 #include "ui/gfx/gl/gl_surface.h" |
| 25 #include "ui/gfx/gl/gpu_preference.h" | 25 #include "ui/gfx/gl/gpu_preference.h" |
| 26 #include "ui/gfx/native_widget_types.h" | 26 #include "ui/gfx/native_widget_types.h" |
| 27 #include "ui/gfx/size.h" | 27 #include "ui/gfx/size.h" |
| 28 #include "ui/gfx/surface/transport_dib.h" | 28 #include "ui/gfx/surface/transport_dib.h" |
| 29 | 29 |
| 30 #if defined(OS_MACOSX) | 30 #if defined(OS_MACOSX) |
| 31 #include "ui/gfx/surface/accelerated_surface_mac.h" | 31 #include "ui/gfx/surface/accelerated_surface_mac.h" |
| 32 #endif | 32 #endif |
| 33 | 33 |
| 34 class GpuChannel; | 34 class GpuChannel; |
| 35 class GpuWatchdog; | 35 class GpuWatchdog; |
| 36 | 36 |
| 37 class GpuCommandBufferStub | 37 class GpuCommandBufferStub |
| 38 : public IPC::Channel::Listener, | 38 : public IPC::Channel::Listener, |
| 39 public IPC::Message::Sender, | 39 public IPC::Message::Sender, |
| 40 public GpuMemoryManageableCommandBufferStub, | |
| 40 public base::SupportsWeakPtr<GpuCommandBufferStub> { | 41 public base::SupportsWeakPtr<GpuCommandBufferStub> { |
| 41 public: | 42 public: |
| 42 GpuCommandBufferStub( | 43 GpuCommandBufferStub( |
| 43 GpuChannel* channel, | 44 GpuChannel* channel, |
| 44 GpuCommandBufferStub* share_group, | 45 GpuCommandBufferStub* share_group, |
| 45 gfx::PluginWindowHandle handle, | 46 gfx::PluginWindowHandle handle, |
| 46 const gfx::Size& size, | 47 const gfx::Size& size, |
| 47 const gpu::gles2::DisallowedFeatures& disallowed_features, | 48 const gpu::gles2::DisallowedFeatures& disallowed_features, |
| 48 const std::string& allowed_extensions, | 49 const std::string& allowed_extensions, |
| 49 const std::vector<int32>& attribs, | 50 const std::vector<int32>& attribs, |
| 50 gfx::GpuPreference gpu_preference, | 51 gfx::GpuPreference gpu_preference, |
| 51 int32 route_id, | 52 int32 route_id, |
| 52 int32 surface_id, | 53 int32 surface_id, |
| 53 GpuWatchdog* watchdog, | 54 GpuWatchdog* watchdog, |
| 54 bool software); | 55 bool software); |
| 55 | 56 |
| 56 virtual ~GpuCommandBufferStub(); | 57 virtual ~GpuCommandBufferStub(); |
| 57 | 58 |
| 58 // IPC::Channel::Listener implementation: | 59 // IPC::Channel::Listener implementation: |
| 59 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 60 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
| 60 | 61 |
| 61 // IPC::Message::Sender implementation: | 62 // IPC::Message::Sender implementation: |
| 62 virtual bool Send(IPC::Message* msg) OVERRIDE; | 63 virtual bool Send(IPC::Message* msg) OVERRIDE; |
| 63 | 64 |
| 65 // GpuMemoryManageableCommandBufferStub implementation: | |
| 66 virtual const GpuSurfaceState& surface_state() OVERRIDE; | |
| 67 virtual const std::vector<int32>& affected_surface_ids() OVERRIDE; | |
| 68 virtual void SendMemoryAllocation( | |
| 69 const GpuMemoryAllocation& allocation) OVERRIDE; | |
| 70 | |
| 71 | |
| 64 // Whether this command buffer can currently handle IPC messages. | 72 // Whether this command buffer can currently handle IPC messages. |
| 65 bool IsScheduled(); | 73 bool IsScheduled(); |
| 66 | 74 |
| 67 // Whether this command buffer needs to be polled again in the future. | 75 // Whether this command buffer needs to be polled again in the future. |
| 68 bool HasMoreWork(); | 76 bool HasMoreWork(); |
| 69 | 77 |
| 70 // Set the swap interval according to the command line. | 78 // Set the swap interval according to the command line. |
| 71 void SetSwapInterval(); | 79 void SetSwapInterval(); |
| 72 | 80 |
| 73 gpu::gles2::GLES2Decoder* decoder() const { return decoder_.get(); } | 81 gpu::gles2::GLES2Decoder* decoder() const { return decoder_.get(); } |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 134 | 142 |
| 135 gfx::PluginWindowHandle handle_; | 143 gfx::PluginWindowHandle handle_; |
| 136 gfx::Size initial_size_; | 144 gfx::Size initial_size_; |
| 137 gpu::gles2::DisallowedFeatures disallowed_features_; | 145 gpu::gles2::DisallowedFeatures disallowed_features_; |
| 138 std::string allowed_extensions_; | 146 std::string allowed_extensions_; |
| 139 std::vector<int32> requested_attribs_; | 147 std::vector<int32> requested_attribs_; |
| 140 gfx::GpuPreference gpu_preference_; | 148 gfx::GpuPreference gpu_preference_; |
| 141 int32 route_id_; | 149 int32 route_id_; |
| 142 bool software_; | 150 bool software_; |
| 143 uint32 last_flush_count_; | 151 uint32 last_flush_count_; |
| 152 GpuSurfaceState surface_state_; | |
|
nduca
2012/01/31 06:53:47
Isn't there a surface_id_ on this class already? L
nduca
2012/01/31 06:53:47
The whole point of this structure is to have it be
mmocny
2012/01/31 18:54:57
Done.
mmocny
2012/01/31 18:54:57
GpuMemoryManager doesn't need to know about GLSurf
| |
| 153 std::vector<int32> affected_surface_ids_; | |
| 144 | 154 |
| 145 // Identifies the window for the rendering results on the browser side. | 155 // Identifies the window for the rendering results on the browser side. |
| 146 int32 surface_id_; | 156 int32 surface_id_; |
| 147 | 157 |
| 148 scoped_ptr<gpu::CommandBufferService> command_buffer_; | 158 scoped_ptr<gpu::CommandBufferService> command_buffer_; |
| 149 scoped_ptr<gpu::gles2::GLES2Decoder> decoder_; | 159 scoped_ptr<gpu::gles2::GLES2Decoder> decoder_; |
| 150 scoped_ptr<gpu::GpuScheduler> scheduler_; | 160 scoped_ptr<gpu::GpuScheduler> scheduler_; |
| 151 scoped_refptr<gfx::GLContext> context_; | 161 scoped_refptr<gfx::GLContext> context_; |
| 152 scoped_refptr<gfx::GLSurface> surface_; | 162 scoped_refptr<gfx::GLSurface> surface_; |
| 153 | 163 |
| 154 // SetParent may be called before Initialize, in which case we need to keep | 164 // SetParent may be called before Initialize, in which case we need to keep |
| 155 // around the parent stub, so that Initialize can set the parent correctly. | 165 // around the parent stub, so that Initialize can set the parent correctly. |
| 156 base::WeakPtr<GpuCommandBufferStub> parent_stub_for_initialization_; | 166 base::WeakPtr<GpuCommandBufferStub> parent_stub_for_initialization_; |
| 157 uint32 parent_texture_for_initialization_; | 167 uint32 parent_texture_for_initialization_; |
| 158 | 168 |
| 159 GpuWatchdog* watchdog_; | 169 GpuWatchdog* watchdog_; |
| 160 | 170 |
| 161 // Zero or more video decoders owned by this stub, keyed by their | 171 // Zero or more video decoders owned by this stub, keyed by their |
| 162 // decoder_route_id. | 172 // decoder_route_id. |
| 163 IDMap<GpuVideoDecodeAccelerator, IDMapOwnPointer> video_decoders_; | 173 IDMap<GpuVideoDecodeAccelerator, IDMapOwnPointer> video_decoders_; |
| 164 | 174 |
| 165 DISALLOW_COPY_AND_ASSIGN(GpuCommandBufferStub); | 175 DISALLOW_COPY_AND_ASSIGN(GpuCommandBufferStub); |
| 166 }; | 176 }; |
| 167 | 177 |
| 168 #endif // defined(ENABLE_GPU) | 178 #endif // defined(ENABLE_GPU) |
| 169 | 179 |
| 170 #endif // CONTENT_COMMON_GPU_GPU_COMMAND_BUFFER_STUB_H_ | 180 #endif // CONTENT_COMMON_GPU_GPU_COMMAND_BUFFER_STUB_H_ |
| OLD | NEW |