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

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

Issue 12614013: Plumb cc::LatencyInfo through command buffer and output surface (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 months 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>
11 11
12 #include "base/id_map.h" 12 #include "base/id_map.h"
13 #include "base/memory/weak_ptr.h" 13 #include "base/memory/weak_ptr.h"
14 #include "base/observer_list.h" 14 #include "base/observer_list.h"
15 #include "cc/latency_info.h"
15 #include "content/common/content_export.h" 16 #include "content/common/content_export.h"
16 #include "content/common/gpu/gpu_memory_allocation.h" 17 #include "content/common/gpu/gpu_memory_allocation.h"
17 #include "content/common/gpu/gpu_memory_manager.h" 18 #include "content/common/gpu/gpu_memory_manager.h"
18 #include "content/common/gpu/gpu_memory_manager_client.h" 19 #include "content/common/gpu/gpu_memory_manager_client.h"
19 #include "googleurl/src/gurl.h" 20 #include "googleurl/src/gurl.h"
20 #include "gpu/command_buffer/common/constants.h" 21 #include "gpu/command_buffer/common/constants.h"
21 #include "gpu/command_buffer/service/command_buffer_service.h" 22 #include "gpu/command_buffer/service/command_buffer_service.h"
22 #include "gpu/command_buffer/service/context_group.h" 23 #include "gpu/command_buffer/service/context_group.h"
23 #include "gpu/command_buffer/service/gpu_scheduler.h" 24 #include "gpu/command_buffer/service/gpu_scheduler.h"
24 #include "ipc/ipc_listener.h" 25 #include "ipc/ipc_listener.h"
(...skipping 26 matching lines...) Expand all
51 public: 52 public:
52 class DestructionObserver { 53 class DestructionObserver {
53 public: 54 public:
54 // Called in Destroy(), before the context/surface are released. 55 // Called in Destroy(), before the context/surface are released.
55 virtual void OnWillDestroyStub(GpuCommandBufferStub* stub) = 0; 56 virtual void OnWillDestroyStub(GpuCommandBufferStub* stub) = 0;
56 57
57 protected: 58 protected:
58 virtual ~DestructionObserver() {} 59 virtual ~DestructionObserver() {}
59 }; 60 };
60 61
62 typedef base::Callback<void(const cc::LatencyInfo&)>
63 LatencyInfoCallback;
64
61 GpuCommandBufferStub( 65 GpuCommandBufferStub(
62 GpuChannel* channel, 66 GpuChannel* channel,
63 GpuCommandBufferStub* share_group, 67 GpuCommandBufferStub* share_group,
64 const gfx::GLSurfaceHandle& handle, 68 const gfx::GLSurfaceHandle& handle,
65 gpu::gles2::MailboxManager* mailbox_manager, 69 gpu::gles2::MailboxManager* mailbox_manager,
66 gpu::gles2::ImageManager* image_manager, 70 gpu::gles2::ImageManager* image_manager,
67 const gfx::Size& size, 71 const gfx::Size& size,
68 const gpu::gles2::DisallowedFeatures& disallowed_features, 72 const gpu::gles2::DisallowedFeatures& disallowed_features,
69 const std::string& allowed_extensions, 73 const std::string& allowed_extensions,
70 const std::vector<int32>& attribs, 74 const std::vector<int32>& attribs,
(...skipping 54 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 SetPreemptByFlag(scoped_refptr<gpu::PreemptionFlag> flag); 137 void SetPreemptByFlag(scoped_refptr<gpu::PreemptionFlag> flag);
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 27 matching lines...) Expand all
172 bool OnWaitSyncPoint(uint32 sync_point); 180 bool OnWaitSyncPoint(uint32 sync_point);
173 void OnSyncPointRetired(); 181 void OnSyncPointRetired();
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 has_callback); 186 void OnSetClientHasMemoryAllocationChangedCallback(bool has_callback);
179 187
180 void OnCommandProcessed(); 188 void OnCommandProcessed();
181 void OnParseError(); 189 void OnParseError();
190 void OnSetLatencyInfo(const cc::LatencyInfo& latency_info);
182 191
183 void ReportState(); 192 void ReportState();
184 193
185 // Wrapper for GpuScheduler::PutChanged that sets the crash report URL. 194 // Wrapper for GpuScheduler::PutChanged that sets the crash report URL.
186 void PutChanged(); 195 void PutChanged();
187 196
188 // Poll the command buffer to execute work. 197 // Poll the command buffer to execute work.
189 void PollWork(); 198 void PollWork();
190 199
191 // Whether this command buffer needs to be polled again in the future. 200 // Whether this command buffer needs to be polled again in the future.
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
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::PreemptionFlag> preemption_flag_; 254 scoped_refptr<gpu::PreemptionFlag> preemption_flag_;
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_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698