OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 virtual ~GpuCommandBufferStubBase() {} | 63 virtual ~GpuCommandBufferStubBase() {} |
64 | 64 |
65 // Will not have surface state if this is an offscreen commandbuffer. | 65 // Will not have surface state if this is an offscreen commandbuffer. |
66 virtual bool client_has_memory_allocation_changed_callback() const = 0; | 66 virtual bool client_has_memory_allocation_changed_callback() const = 0; |
67 virtual bool has_surface_state() const = 0; | 67 virtual bool has_surface_state() const = 0; |
68 virtual const SurfaceState& surface_state() const = 0; | 68 virtual const SurfaceState& surface_state() const = 0; |
69 | 69 |
70 virtual bool IsInSameContextShareGroup( | 70 virtual bool IsInSameContextShareGroup( |
71 const GpuCommandBufferStubBase& other) const = 0; | 71 const GpuCommandBufferStubBase& other) const = 0; |
72 | 72 |
73 virtual void SendMemoryAllocationToProxy( | |
74 const GpuMemoryAllocation& allocation) = 0; | |
75 | |
76 virtual void SetMemoryAllocation( | 73 virtual void SetMemoryAllocation( |
77 const GpuMemoryAllocation& allocation) = 0; | 74 const GpuMemoryAllocation& allocation) = 0; |
78 }; | 75 }; |
79 | 76 |
80 class GpuCommandBufferStub | 77 class GpuCommandBufferStub |
81 : public GpuCommandBufferStubBase, | 78 : public GpuCommandBufferStubBase, |
82 public IPC::Channel::Listener, | 79 public IPC::Channel::Listener, |
83 public IPC::Message::Sender, | 80 public IPC::Message::Sender, |
84 public base::SupportsWeakPtr<GpuCommandBufferStub> { | 81 public base::SupportsWeakPtr<GpuCommandBufferStub> { |
85 public: | 82 public: |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 // GpuCommandBufferStubBase implementation: | 114 // GpuCommandBufferStubBase implementation: |
118 virtual bool client_has_memory_allocation_changed_callback() const OVERRIDE; | 115 virtual bool client_has_memory_allocation_changed_callback() const OVERRIDE; |
119 virtual bool has_surface_state() const OVERRIDE; | 116 virtual bool has_surface_state() const OVERRIDE; |
120 virtual const GpuCommandBufferStubBase::SurfaceState& surface_state() const | 117 virtual const GpuCommandBufferStubBase::SurfaceState& surface_state() const |
121 OVERRIDE; | 118 OVERRIDE; |
122 | 119 |
123 // Returns true iff |other| is in the same context share group as this stub. | 120 // Returns true iff |other| is in the same context share group as this stub. |
124 virtual bool IsInSameContextShareGroup( | 121 virtual bool IsInSameContextShareGroup( |
125 const GpuCommandBufferStubBase& other) const OVERRIDE; | 122 const GpuCommandBufferStubBase& other) const OVERRIDE; |
126 | 123 |
127 // Sends memory allocation limits to render process. | |
128 virtual void SendMemoryAllocationToProxy( | |
129 const GpuMemoryAllocation& allocation) OVERRIDE; | |
130 | |
131 // Sets buffer usage depending on Memory Allocation | 124 // Sets buffer usage depending on Memory Allocation |
132 virtual void SetMemoryAllocation( | 125 virtual void SetMemoryAllocation( |
133 const GpuMemoryAllocation& allocation) OVERRIDE; | 126 const GpuMemoryAllocation& allocation) OVERRIDE; |
134 | 127 |
135 // Whether this command buffer can currently handle IPC messages. | 128 // Whether this command buffer can currently handle IPC messages. |
136 bool IsScheduled(); | 129 bool IsScheduled(); |
137 | 130 |
138 // Whether this command buffer needs to be polled again in the future. | 131 // Whether this command buffer needs to be polled again in the future. |
139 bool HasMoreWork(); | 132 bool HasMoreWork(); |
140 | 133 |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 gfx::Size initial_size_; | 221 gfx::Size initial_size_; |
229 gpu::gles2::DisallowedFeatures disallowed_features_; | 222 gpu::gles2::DisallowedFeatures disallowed_features_; |
230 std::string allowed_extensions_; | 223 std::string allowed_extensions_; |
231 std::vector<int32> requested_attribs_; | 224 std::vector<int32> requested_attribs_; |
232 gfx::GpuPreference gpu_preference_; | 225 gfx::GpuPreference gpu_preference_; |
233 int32 route_id_; | 226 int32 route_id_; |
234 bool software_; | 227 bool software_; |
235 bool client_has_memory_allocation_changed_callback_; | 228 bool client_has_memory_allocation_changed_callback_; |
236 uint32 last_flush_count_; | 229 uint32 last_flush_count_; |
237 scoped_ptr<GpuCommandBufferStubBase::SurfaceState> surface_state_; | 230 scoped_ptr<GpuCommandBufferStubBase::SurfaceState> surface_state_; |
238 GpuMemoryAllocation allocation_; | |
239 | 231 |
240 scoped_ptr<gpu::CommandBufferService> command_buffer_; | 232 scoped_ptr<gpu::CommandBufferService> command_buffer_; |
241 scoped_ptr<gpu::gles2::GLES2Decoder> decoder_; | 233 scoped_ptr<gpu::gles2::GLES2Decoder> decoder_; |
242 scoped_ptr<gpu::GpuScheduler> scheduler_; | 234 scoped_ptr<gpu::GpuScheduler> scheduler_; |
243 scoped_refptr<gfx::GLContext> context_; | 235 scoped_refptr<gfx::GLContext> context_; |
244 scoped_refptr<gfx::GLSurface> surface_; | 236 scoped_refptr<gfx::GLSurface> surface_; |
245 | 237 |
246 // SetParent may be called before Initialize, in which case we need to keep | 238 // SetParent may be called before Initialize, in which case we need to keep |
247 // around the parent stub, so that Initialize can set the parent correctly. | 239 // around the parent stub, so that Initialize can set the parent correctly. |
248 base::WeakPtr<GpuCommandBufferStub> parent_stub_for_initialization_; | 240 base::WeakPtr<GpuCommandBufferStub> parent_stub_for_initialization_; |
249 uint32 parent_texture_for_initialization_; | 241 uint32 parent_texture_for_initialization_; |
250 | 242 |
251 GpuWatchdog* watchdog_; | 243 GpuWatchdog* watchdog_; |
252 | 244 |
253 std::deque<IPC::Message*> delayed_echos_; | 245 std::deque<IPC::Message*> delayed_echos_; |
254 | 246 |
255 // Zero or more video decoders owned by this stub, keyed by their | 247 // Zero or more video decoders owned by this stub, keyed by their |
256 // decoder_route_id. | 248 // decoder_route_id. |
257 IDMap<GpuVideoDecodeAccelerator, IDMapOwnPointer> video_decoders_; | 249 IDMap<GpuVideoDecodeAccelerator, IDMapOwnPointer> video_decoders_; |
258 | 250 |
259 ObserverList<DestructionObserver> destruction_observers_; | 251 ObserverList<DestructionObserver> destruction_observers_; |
260 | 252 |
261 DISALLOW_COPY_AND_ASSIGN(GpuCommandBufferStub); | 253 DISALLOW_COPY_AND_ASSIGN(GpuCommandBufferStub); |
262 }; | 254 }; |
263 | 255 |
264 #endif // defined(ENABLE_GPU) | 256 #endif // defined(ENABLE_GPU) |
265 | 257 |
266 #endif // CONTENT_COMMON_GPU_GPU_COMMAND_BUFFER_STUB_H_ | 258 #endif // CONTENT_COMMON_GPU_GPU_COMMAND_BUFFER_STUB_H_ |
OLD | NEW |