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 | 7 |
8 #include <deque> | 8 #include <deque> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 // GpuMemoryManagerClient implementation: | 90 // GpuMemoryManagerClient implementation: |
91 virtual gfx::Size GetSurfaceSize() const OVERRIDE; | 91 virtual gfx::Size GetSurfaceSize() const OVERRIDE; |
92 virtual gpu::gles2::MemoryTracker* GetMemoryTracker() const OVERRIDE; | 92 virtual gpu::gles2::MemoryTracker* GetMemoryTracker() const OVERRIDE; |
93 virtual void SetMemoryAllocation( | 93 virtual void SetMemoryAllocation( |
94 const GpuMemoryAllocation& allocation) OVERRIDE; | 94 const GpuMemoryAllocation& allocation) OVERRIDE; |
95 virtual bool GetTotalGpuMemory(size_t* bytes) OVERRIDE; | 95 virtual bool GetTotalGpuMemory(size_t* bytes) OVERRIDE; |
96 | 96 |
97 // Whether this command buffer can currently handle IPC messages. | 97 // Whether this command buffer can currently handle IPC messages. |
98 bool IsScheduled(); | 98 bool IsScheduled(); |
99 | 99 |
| 100 // If the command buffer is pre-empted and cannot process commands. |
| 101 bool IsPreempted() const { |
| 102 return scheduler_.get() && scheduler_->IsPreempted(); |
| 103 } |
| 104 |
100 // Whether there are commands in the buffer that haven't been processed. | 105 // Whether there are commands in the buffer that haven't been processed. |
101 bool HasUnprocessedCommands(); | 106 bool HasUnprocessedCommands(); |
102 | 107 |
103 // Delay an echo message until the command buffer has been rescheduled. | 108 // Delay an echo message until the command buffer has been rescheduled. |
104 void DelayEcho(IPC::Message*); | 109 void DelayEcho(IPC::Message*); |
105 | 110 |
106 gpu::gles2::GLES2Decoder* decoder() const { return decoder_.get(); } | 111 gpu::gles2::GLES2Decoder* decoder() const { return decoder_.get(); } |
107 gpu::GpuScheduler* scheduler() const { return scheduler_.get(); } | 112 gpu::GpuScheduler* scheduler() const { return scheduler_.get(); } |
108 GpuChannel* channel() const { return channel_; } | 113 GpuChannel* channel() const { return channel_; } |
109 | 114 |
(...skipping 13 matching lines...) Expand all Loading... |
123 | 128 |
124 gfx::GLSurface* surface() const { return surface_; } | 129 gfx::GLSurface* surface() const { return surface_; } |
125 | 130 |
126 void AddDestructionObserver(DestructionObserver* observer); | 131 void AddDestructionObserver(DestructionObserver* observer); |
127 void RemoveDestructionObserver(DestructionObserver* observer); | 132 void RemoveDestructionObserver(DestructionObserver* observer); |
128 | 133 |
129 // Associates a sync point to this stub. When the stub is destroyed, it will | 134 // Associates a sync point to this stub. When the stub is destroyed, it will |
130 // retire all sync points that haven't been previously retired. | 135 // retire all sync points that haven't been previously retired. |
131 void AddSyncPoint(uint32 sync_point); | 136 void AddSyncPoint(uint32 sync_point); |
132 | 137 |
133 void SetPreemptByCounter(scoped_refptr<gpu::RefCountedCounter> counter); | 138 void SetPreemptByFlag(scoped_refptr<gpu::PreemptionFlag> flag); |
134 | 139 |
135 private: | 140 private: |
136 GpuMemoryManager* GetMemoryManager(); | 141 GpuMemoryManager* GetMemoryManager(); |
137 bool MakeCurrent(); | 142 bool MakeCurrent(); |
138 void Destroy(); | 143 void Destroy(); |
139 | 144 |
140 // Cleans up and sends reply if OnInitialize failed. | 145 // Cleans up and sends reply if OnInitialize failed. |
141 void OnInitializeFailed(IPC::Message* reply_message); | 146 void OnInitializeFailed(IPC::Message* reply_message); |
142 | 147 |
143 // Message handlers: | 148 // Message handlers: |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 IDMap<GpuVideoDecodeAccelerator, IDMapOwnPointer> video_decoders_; | 242 IDMap<GpuVideoDecodeAccelerator, IDMapOwnPointer> video_decoders_; |
238 | 243 |
239 ObserverList<DestructionObserver> destruction_observers_; | 244 ObserverList<DestructionObserver> destruction_observers_; |
240 | 245 |
241 // A queue of sync points associated with this stub. | 246 // A queue of sync points associated with this stub. |
242 std::deque<uint32> sync_points_; | 247 std::deque<uint32> sync_points_; |
243 int sync_point_wait_count_; | 248 int sync_point_wait_count_; |
244 | 249 |
245 bool delayed_work_scheduled_; | 250 bool delayed_work_scheduled_; |
246 | 251 |
247 scoped_refptr<gpu::RefCountedCounter> preempt_by_counter_; | 252 scoped_refptr<gpu::PreemptionFlag> preemption_flag_; |
248 | 253 |
249 GURL active_url_; | 254 GURL active_url_; |
250 size_t active_url_hash_; | 255 size_t active_url_hash_; |
251 | 256 |
252 size_t total_gpu_memory_; | 257 size_t total_gpu_memory_; |
253 | 258 |
254 DISALLOW_COPY_AND_ASSIGN(GpuCommandBufferStub); | 259 DISALLOW_COPY_AND_ASSIGN(GpuCommandBufferStub); |
255 }; | 260 }; |
256 | 261 |
257 } // namespace content | 262 } // namespace content |
258 | 263 |
259 #endif // CONTENT_COMMON_GPU_GPU_COMMAND_BUFFER_STUB_H_ | 264 #endif // CONTENT_COMMON_GPU_GPU_COMMAND_BUFFER_STUB_H_ |
OLD | NEW |