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 11 matching lines...) Expand all Loading... |
22 #include "gpu/command_buffer/service/context_group.h" | 22 #include "gpu/command_buffer/service/context_group.h" |
23 #include "gpu/command_buffer/service/gpu_scheduler.h" | 23 #include "gpu/command_buffer/service/gpu_scheduler.h" |
24 #include "ipc/ipc_listener.h" | 24 #include "ipc/ipc_listener.h" |
25 #include "ipc/ipc_sender.h" | 25 #include "ipc/ipc_sender.h" |
26 #include "media/base/video_decoder_config.h" | 26 #include "media/base/video_decoder_config.h" |
27 #include "ui/gfx/native_widget_types.h" | 27 #include "ui/gfx/native_widget_types.h" |
28 #include "ui/gfx/size.h" | 28 #include "ui/gfx/size.h" |
29 #include "ui/gl/gl_surface.h" | 29 #include "ui/gl/gl_surface.h" |
30 #include "ui/gl/gpu_preference.h" | 30 #include "ui/gl/gpu_preference.h" |
31 #include "ui/surface/transport_dib.h" | 31 #include "ui/surface/transport_dib.h" |
| 32 #include "webkit/compositor_bindings/web_latency_info_impl.h" |
32 | 33 |
33 #if defined(OS_MACOSX) | 34 #if defined(OS_MACOSX) |
34 #include "ui/surface/accelerated_surface_mac.h" | 35 #include "ui/surface/accelerated_surface_mac.h" |
35 #endif | 36 #endif |
36 | 37 |
37 namespace gpu { | 38 namespace gpu { |
38 namespace gles2 { | 39 namespace gles2 { |
39 class ImageManager; | 40 class ImageManager; |
40 class MailboxManager; | 41 class MailboxManager; |
41 } | 42 } |
(...skipping 13 matching lines...) Expand all Loading... |
55 public: | 56 public: |
56 class DestructionObserver { | 57 class DestructionObserver { |
57 public: | 58 public: |
58 // Called in Destroy(), before the context/surface are released. | 59 // Called in Destroy(), before the context/surface are released. |
59 virtual void OnWillDestroyStub(GpuCommandBufferStub* stub) = 0; | 60 virtual void OnWillDestroyStub(GpuCommandBufferStub* stub) = 0; |
60 | 61 |
61 protected: | 62 protected: |
62 virtual ~DestructionObserver() {} | 63 virtual ~DestructionObserver() {} |
63 }; | 64 }; |
64 | 65 |
| 66 typedef base::Callback<void(const cc::LatencyInfo&)> |
| 67 LatencyInfoCallback; |
| 68 |
65 GpuCommandBufferStub( | 69 GpuCommandBufferStub( |
66 GpuChannel* channel, | 70 GpuChannel* channel, |
67 GpuCommandBufferStub* share_group, | 71 GpuCommandBufferStub* share_group, |
68 const gfx::GLSurfaceHandle& handle, | 72 const gfx::GLSurfaceHandle& handle, |
69 gpu::gles2::MailboxManager* mailbox_manager, | 73 gpu::gles2::MailboxManager* mailbox_manager, |
70 gpu::gles2::ImageManager* image_manager, | 74 gpu::gles2::ImageManager* image_manager, |
71 const gfx::Size& size, | 75 const gfx::Size& size, |
72 const gpu::gles2::DisallowedFeatures& disallowed_features, | 76 const gpu::gles2::DisallowedFeatures& disallowed_features, |
73 const std::string& allowed_extensions, | 77 const std::string& allowed_extensions, |
74 const std::vector<int32>& attribs, | 78 const std::vector<int32>& attribs, |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 | 129 |
126 void AddDestructionObserver(DestructionObserver* observer); | 130 void AddDestructionObserver(DestructionObserver* observer); |
127 void RemoveDestructionObserver(DestructionObserver* observer); | 131 void RemoveDestructionObserver(DestructionObserver* observer); |
128 | 132 |
129 // Associates a sync point to this stub. When the stub is destroyed, it will | 133 // 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. | 134 // retire all sync points that haven't been previously retired. |
131 void AddSyncPoint(uint32 sync_point); | 135 void AddSyncPoint(uint32 sync_point); |
132 | 136 |
133 void SetPreemptByCounter(scoped_refptr<gpu::RefCountedCounter> counter); | 137 void SetPreemptByCounter(scoped_refptr<gpu::RefCountedCounter> counter); |
134 | 138 |
| 139 void SetLatencyInfoCallback(const LatencyInfoCallback& callback); |
| 140 |
| 141 void SetLatencyInfo(const cc::LatencyInfo& latency_info); |
| 142 |
135 private: | 143 private: |
136 GpuMemoryManager* GetMemoryManager(); | 144 GpuMemoryManager* GetMemoryManager(); |
137 bool MakeCurrent(); | 145 bool MakeCurrent(); |
138 void Destroy(); | 146 void Destroy(); |
139 | 147 |
140 // Cleans up and sends reply if OnInitialize failed. | 148 // Cleans up and sends reply if OnInitialize failed. |
141 void OnInitializeFailed(IPC::Message* reply_message); | 149 void OnInitializeFailed(IPC::Message* reply_message); |
142 | 150 |
143 // Message handlers: | 151 // Message handlers: |
144 void OnInitialize(base::SharedMemoryHandle shared_state_shm, | 152 void OnInitialize(base::SharedMemoryHandle shared_state_shm, |
(...skipping 29 matching lines...) Expand all Loading... |
174 void OnSignalSyncPoint(uint32 sync_point, uint32 id); | 182 void OnSignalSyncPoint(uint32 sync_point, uint32 id); |
175 void OnSignalSyncPointAck(uint32 id); | 183 void OnSignalSyncPointAck(uint32 id); |
176 | 184 |
177 void OnReceivedClientManagedMemoryStats(const GpuManagedMemoryStats& stats); | 185 void OnReceivedClientManagedMemoryStats(const GpuManagedMemoryStats& stats); |
178 void OnSetClientHasMemoryAllocationChangedCallback(bool); | 186 void OnSetClientHasMemoryAllocationChangedCallback(bool); |
179 | 187 |
180 void OnReschedule(); | 188 void OnReschedule(); |
181 | 189 |
182 void OnCommandProcessed(); | 190 void OnCommandProcessed(); |
183 void OnParseError(); | 191 void OnParseError(); |
| 192 void OnSetLatencyInfo(const cc::LatencyInfo& latency_info); |
184 | 193 |
185 void ReportState(); | 194 void ReportState(); |
186 | 195 |
187 // Wrapper for GpuScheduler::PutChanged that sets the crash report URL. | 196 // Wrapper for GpuScheduler::PutChanged that sets the crash report URL. |
188 void PutChanged(); | 197 void PutChanged(); |
189 | 198 |
190 // Poll the command buffer to execute work. | 199 // Poll the command buffer to execute work. |
191 void PollWork(); | 200 void PollWork(); |
192 | 201 |
193 // Whether this command buffer needs to be polled again in the future. | 202 // Whether this command buffer needs to be polled again in the future. |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 ObserverList<DestructionObserver> destruction_observers_; | 246 ObserverList<DestructionObserver> destruction_observers_; |
238 | 247 |
239 // A queue of sync points associated with this stub. | 248 // A queue of sync points associated with this stub. |
240 std::deque<uint32> sync_points_; | 249 std::deque<uint32> sync_points_; |
241 int sync_point_wait_count_; | 250 int sync_point_wait_count_; |
242 | 251 |
243 bool delayed_work_scheduled_; | 252 bool delayed_work_scheduled_; |
244 | 253 |
245 scoped_refptr<gpu::RefCountedCounter> preempt_by_counter_; | 254 scoped_refptr<gpu::RefCountedCounter> preempt_by_counter_; |
246 | 255 |
| 256 LatencyInfoCallback latency_info_callback_; |
| 257 |
247 GURL active_url_; | 258 GURL active_url_; |
248 size_t active_url_hash_; | 259 size_t active_url_hash_; |
249 | 260 |
250 size_t total_gpu_memory_; | 261 size_t total_gpu_memory_; |
251 | 262 |
252 DISALLOW_COPY_AND_ASSIGN(GpuCommandBufferStub); | 263 DISALLOW_COPY_AND_ASSIGN(GpuCommandBufferStub); |
253 }; | 264 }; |
254 | 265 |
255 } // namespace content | 266 } // namespace content |
256 | 267 |
257 #endif // CONTENT_COMMON_GPU_GPU_COMMAND_BUFFER_STUB_H_ | 268 #endif // CONTENT_COMMON_GPU_GPU_COMMAND_BUFFER_STUB_H_ |
OLD | NEW |