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