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

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, 8 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/memory/scoped_vector.h" 12 #include "base/memory/scoped_vector.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/debug/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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 128
125 void AddDestructionObserver(DestructionObserver* observer); 129 void AddDestructionObserver(DestructionObserver* observer);
126 void RemoveDestructionObserver(DestructionObserver* observer); 130 void RemoveDestructionObserver(DestructionObserver* observer);
127 131
128 // Associates a sync point to this stub. When the stub is destroyed, it will 132 // Associates a sync point to this stub. When the stub is destroyed, it will
129 // retire all sync points that haven't been previously retired. 133 // retire all sync points that haven't been previously retired.
130 void AddSyncPoint(uint32 sync_point); 134 void AddSyncPoint(uint32 sync_point);
131 135
132 void SetPreemptByFlag(scoped_refptr<gpu::PreemptionFlag> flag); 136 void SetPreemptByFlag(scoped_refptr<gpu::PreemptionFlag> flag);
133 137
138 void SetLatencyInfoCallback(const LatencyInfoCallback& callback);
139
134 private: 140 private:
135 GpuMemoryManager* GetMemoryManager(); 141 GpuMemoryManager* GetMemoryManager();
136 bool MakeCurrent(); 142 bool MakeCurrent();
137 void Destroy(); 143 void Destroy();
138 144
139 // Cleans up and sends reply if OnInitialize failed. 145 // Cleans up and sends reply if OnInitialize failed.
140 void OnInitializeFailed(IPC::Message* reply_message); 146 void OnInitializeFailed(IPC::Message* reply_message);
141 147
142 // Message handlers: 148 // Message handlers:
143 void OnInitialize(base::SharedMemoryHandle shared_state_shm, 149 void OnInitialize(base::SharedMemoryHandle shared_state_shm,
(...skipping 26 matching lines...) Expand all
170 bool OnWaitSyncPoint(uint32 sync_point); 176 bool OnWaitSyncPoint(uint32 sync_point);
171 void OnSyncPointRetired(); 177 void OnSyncPointRetired();
172 void OnSignalSyncPoint(uint32 sync_point, uint32 id); 178 void OnSignalSyncPoint(uint32 sync_point, uint32 id);
173 void OnSignalSyncPointAck(uint32 id); 179 void OnSignalSyncPointAck(uint32 id);
174 180
175 void OnReceivedClientManagedMemoryStats(const GpuManagedMemoryStats& stats); 181 void OnReceivedClientManagedMemoryStats(const GpuManagedMemoryStats& stats);
176 void OnSetClientHasMemoryAllocationChangedCallback(bool has_callback); 182 void OnSetClientHasMemoryAllocationChangedCallback(bool has_callback);
177 183
178 void OnCommandProcessed(); 184 void OnCommandProcessed();
179 void OnParseError(); 185 void OnParseError();
186 void OnSetLatencyInfo(const cc::LatencyInfo& latency_info);
180 187
181 void ReportState(); 188 void ReportState();
182 189
183 // Wrapper for GpuScheduler::PutChanged that sets the crash report URL. 190 // Wrapper for GpuScheduler::PutChanged that sets the crash report URL.
184 void PutChanged(); 191 void PutChanged();
185 192
186 // Poll the command buffer to execute work. 193 // Poll the command buffer to execute work.
187 void PollWork(); 194 void PollWork();
188 195
189 // Whether this command buffer needs to be polled again in the future. 196 // Whether this command buffer needs to be polled again in the future.
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 // A queue of sync points associated with this stub. 245 // A queue of sync points associated with this stub.
239 std::deque<uint32> sync_points_; 246 std::deque<uint32> sync_points_;
240 int sync_point_wait_count_; 247 int sync_point_wait_count_;
241 248
242 bool delayed_work_scheduled_; 249 bool delayed_work_scheduled_;
243 uint64 previous_messages_processed_; 250 uint64 previous_messages_processed_;
244 base::TimeTicks last_idle_time_; 251 base::TimeTicks last_idle_time_;
245 252
246 scoped_refptr<gpu::PreemptionFlag> preemption_flag_; 253 scoped_refptr<gpu::PreemptionFlag> preemption_flag_;
247 254
255 LatencyInfoCallback latency_info_callback_;
256
248 GURL active_url_; 257 GURL active_url_;
249 size_t active_url_hash_; 258 size_t active_url_hash_;
250 259
251 size_t total_gpu_memory_; 260 size_t total_gpu_memory_;
252 261
253 DISALLOW_COPY_AND_ASSIGN(GpuCommandBufferStub); 262 DISALLOW_COPY_AND_ASSIGN(GpuCommandBufferStub);
254 }; 263 };
255 264
256 } // namespace content 265 } // namespace content
257 266
258 #endif // CONTENT_COMMON_GPU_GPU_COMMAND_BUFFER_STUB_H_ 267 #endif // CONTENT_COMMON_GPU_GPU_COMMAND_BUFFER_STUB_H_
OLDNEW
« no previous file with comments | « content/common/gpu/client/command_buffer_proxy_impl.cc ('k') | content/common/gpu/gpu_command_buffer_stub.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698