Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(705)

Side by Side Diff: content/common/gpu/gpu_command_buffer_stub.h

Issue 11293121: Add latency measurement system (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: minor input event changes Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 10 matching lines...) Expand all
21 #include "gpu/command_buffer/service/context_group.h" 21 #include "gpu/command_buffer/service/context_group.h"
22 #include "gpu/command_buffer/service/gpu_scheduler.h" 22 #include "gpu/command_buffer/service/gpu_scheduler.h"
23 #include "ipc/ipc_listener.h" 23 #include "ipc/ipc_listener.h"
24 #include "ipc/ipc_sender.h" 24 #include "ipc/ipc_sender.h"
25 #include "media/base/video_decoder_config.h" 25 #include "media/base/video_decoder_config.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/gl/gl_surface.h" 28 #include "ui/gl/gl_surface.h"
29 #include "ui/gl/gpu_preference.h" 29 #include "ui/gl/gpu_preference.h"
30 #include "ui/surface/transport_dib.h" 30 #include "ui/surface/transport_dib.h"
31 #include "webkit/compositor_bindings/web_latency_info_impl.h"
31 32
32 #if defined(OS_MACOSX) 33 #if defined(OS_MACOSX)
33 #include "ui/surface/accelerated_surface_mac.h" 34 #include "ui/surface/accelerated_surface_mac.h"
34 #endif 35 #endif
35 36
36 namespace gpu { 37 namespace gpu {
37 namespace gles2 { 38 namespace gles2 {
38 class ImageManager; 39 class ImageManager;
39 class MailboxManager; 40 class MailboxManager;
40 } 41 }
(...skipping 14 matching lines...) Expand all
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 WebKit::WebLatencyInfoImpl&)>
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
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 WebKit::WebLatencyInfoImpl& 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(IPC::Message* reply_message); 152 void OnInitialize(IPC::Message* reply_message);
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 void OnSignalSyncPoint(uint32 sync_point, uint32 id); 186 void OnSignalSyncPoint(uint32 sync_point, uint32 id);
179 void OnSignalSyncPointAck(uint32 id); 187 void OnSignalSyncPointAck(uint32 id);
180 188
181 void OnReceivedClientManagedMemoryStats(const GpuManagedMemoryStats& stats); 189 void OnReceivedClientManagedMemoryStats(const GpuManagedMemoryStats& stats);
182 void OnSetClientHasMemoryAllocationChangedCallback(bool); 190 void OnSetClientHasMemoryAllocationChangedCallback(bool);
183 191
184 void OnReschedule(); 192 void OnReschedule();
185 193
186 void OnCommandProcessed(); 194 void OnCommandProcessed();
187 void OnParseError(); 195 void OnParseError();
196 void OnSetLatencyInfo(const WebKit::WebLatencyInfoImpl& latency_info);
188 197
189 void ReportState(); 198 void ReportState();
190 199
191 // Wrapper for GpuScheduler::PutChanged that sets the crash report URL. 200 // Wrapper for GpuScheduler::PutChanged that sets the crash report URL.
192 void PutChanged(); 201 void PutChanged();
193 202
194 // Poll the command buffer to execute work. 203 // Poll the command buffer to execute work.
195 void PollWork(); 204 void PollWork();
196 205
197 // Whether this command buffer needs to be polled again in the future. 206 // Whether this command buffer needs to be polled again in the future.
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 ObserverList<DestructionObserver> destruction_observers_; 248 ObserverList<DestructionObserver> destruction_observers_;
240 249
241 // A queue of sync points associated with this stub. 250 // A queue of sync points associated with this stub.
242 std::deque<uint32> sync_points_; 251 std::deque<uint32> sync_points_;
243 int sync_point_wait_count_; 252 int sync_point_wait_count_;
244 253
245 bool delayed_work_scheduled_; 254 bool delayed_work_scheduled_;
246 255
247 scoped_refptr<gpu::RefCountedCounter> preempt_by_counter_; 256 scoped_refptr<gpu::RefCountedCounter> preempt_by_counter_;
248 257
258 LatencyInfoCallback latency_info_callback_;
259
249 GURL active_url_; 260 GURL active_url_;
250 size_t active_url_hash_; 261 size_t active_url_hash_;
251 262
252 size_t total_gpu_memory_; 263 size_t total_gpu_memory_;
253 264
254 DISALLOW_COPY_AND_ASSIGN(GpuCommandBufferStub); 265 DISALLOW_COPY_AND_ASSIGN(GpuCommandBufferStub);
255 }; 266 };
256 267
257 } // namespace content 268 } // namespace content
258 269
259 #endif // CONTENT_COMMON_GPU_GPU_COMMAND_BUFFER_STUB_H_ 270 #endif // CONTENT_COMMON_GPU_GPU_COMMAND_BUFFER_STUB_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698