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

Side by Side Diff: gpu/ipc/service/gpu_channel.h

Issue 1845563005: Refactor content/common/gpu into gpu/ipc/service (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Drop ref to deleted content_tests_gypi_values.content_unittests_ozone_sources Created 4 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
« no previous file with comments | « gpu/ipc/service/child_window_surface_win.cc ('k') | gpu/ipc/service/gpu_channel.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_CHANNEL_H_ 5 #ifndef GPU_IPC_SERVICE_GPU_CHANNEL_H_
6 #define CONTENT_COMMON_GPU_GPU_CHANNEL_H_ 6 #define GPU_IPC_SERVICE_GPU_CHANNEL_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
11 #include <string> 11 #include <string>
12 12
13 #include "base/containers/hash_tables.h" 13 #include "base/containers/hash_tables.h"
14 #include "base/containers/scoped_ptr_hash_map.h" 14 #include "base/containers/scoped_ptr_hash_map.h"
15 #include "base/macros.h" 15 #include "base/macros.h"
16 #include "base/memory/ref_counted.h" 16 #include "base/memory/ref_counted.h"
17 #include "base/memory/scoped_ptr.h" 17 #include "base/memory/scoped_ptr.h"
18 #include "base/memory/weak_ptr.h" 18 #include "base/memory/weak_ptr.h"
19 #include "base/process/process.h" 19 #include "base/process/process.h"
20 #include "base/threading/thread_checker.h" 20 #include "base/threading/thread_checker.h"
21 #include "base/trace_event/memory_dump_provider.h" 21 #include "base/trace_event/memory_dump_provider.h"
22 #include "build/build_config.h" 22 #include "build/build_config.h"
23 #include "content/common/content_export.h"
24 #include "content/common/gpu/gpu_command_buffer_stub.h"
25 #include "content/common/gpu/gpu_memory_manager.h"
26 #include "gpu/command_buffer/service/valuebuffer_manager.h" 23 #include "gpu/command_buffer/service/valuebuffer_manager.h"
24 #include "gpu/gpu_export.h"
27 #include "gpu/ipc/common/gpu_stream_constants.h" 25 #include "gpu/ipc/common/gpu_stream_constants.h"
26 #include "gpu/ipc/service/gpu_command_buffer_stub.h"
27 #include "gpu/ipc/service/gpu_memory_manager.h"
28 #include "ipc/ipc_sync_channel.h" 28 #include "ipc/ipc_sync_channel.h"
29 #include "ipc/message_router.h" 29 #include "ipc/message_router.h"
30 #include "ui/gfx/geometry/size.h" 30 #include "ui/gfx/geometry/size.h"
31 #include "ui/gfx/native_widget_types.h" 31 #include "ui/gfx/native_widget_types.h"
32 #include "ui/gl/gl_share_group.h" 32 #include "ui/gl/gl_share_group.h"
33 #include "ui/gl/gpu_preference.h" 33 #include "ui/gl/gpu_preference.h"
34 34
35 struct GPUCreateCommandBufferConfig; 35 struct GPUCreateCommandBufferConfig;
36 36
37 namespace base { 37 namespace base {
38 class WaitableEvent; 38 class WaitableEvent;
39 } 39 }
40 40
41 namespace gpu {
42 class PreemptionFlag;
43 class SyncPointOrderData;
44 class SyncPointManager;
45 union ValueState;
46 class ValueStateMap;
47 namespace gles2 {
48 class SubscriptionRefSet;
49 }
50 }
51
52 namespace IPC { 41 namespace IPC {
53 class MessageFilter; 42 class MessageFilter;
54 } 43 }
55 44
56 namespace content { 45 namespace gpu {
46
47 class PreemptionFlag;
48 class SyncPointOrderData;
49 class SyncPointManager;
50 union ValueState;
51 class ValueStateMap;
57 class GpuChannelManager; 52 class GpuChannelManager;
58 class GpuChannelMessageFilter; 53 class GpuChannelMessageFilter;
59 class GpuChannelMessageQueue; 54 class GpuChannelMessageQueue;
60 class GpuWatchdog; 55 class GpuWatchdog;
61 56
57 namespace gles2 {
58 class SubscriptionRefSet;
59 }
60
62 // Encapsulates an IPC channel between the GPU process and one renderer 61 // Encapsulates an IPC channel between the GPU process and one renderer
63 // process. On the renderer side there's a corresponding GpuChannelHost. 62 // process. On the renderer side there's a corresponding GpuChannelHost.
64 class CONTENT_EXPORT GpuChannel 63 class GPU_EXPORT GpuChannel
65 : public IPC::Listener, 64 : public IPC::Listener,
66 public IPC::Sender, 65 public IPC::Sender,
67 public gpu::gles2::SubscriptionRefSet::Observer { 66 public gles2::SubscriptionRefSet::Observer {
68 public: 67 public:
69 // Takes ownership of the renderer process handle. 68 // Takes ownership of the renderer process handle.
70 GpuChannel(GpuChannelManager* gpu_channel_manager, 69 GpuChannel(GpuChannelManager* gpu_channel_manager,
71 gpu::SyncPointManager* sync_point_manager, 70 SyncPointManager* sync_point_manager,
72 GpuWatchdog* watchdog, 71 GpuWatchdog* watchdog,
73 gfx::GLShareGroup* share_group, 72 gfx::GLShareGroup* share_group,
74 gpu::gles2::MailboxManager* mailbox_manager, 73 gles2::MailboxManager* mailbox_manager,
75 gpu::PreemptionFlag* preempting_flag, 74 PreemptionFlag* preempting_flag,
76 gpu::PreemptionFlag* preempted_flag, 75 PreemptionFlag* preempted_flag,
77 base::SingleThreadTaskRunner* task_runner, 76 base::SingleThreadTaskRunner* task_runner,
78 base::SingleThreadTaskRunner* io_task_runner, 77 base::SingleThreadTaskRunner* io_task_runner,
79 int32_t client_id, 78 int32_t client_id,
80 uint64_t client_tracing_id, 79 uint64_t client_tracing_id,
81 bool allow_view_command_buffers, 80 bool allow_view_command_buffers,
82 bool allow_real_time_streams); 81 bool allow_real_time_streams);
83 ~GpuChannel() override; 82 ~GpuChannel() override;
84 83
85 // Initializes the IPC channel. Caller takes ownership of the client FD in 84 // Initializes the IPC channel. Caller takes ownership of the client FD in
86 // the returned handle and is responsible for closing it. 85 // the returned handle and is responsible for closing it.
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 140
142 uint64_t GetMemoryUsage(); 141 uint64_t GetMemoryUsage();
143 142
144 scoped_refptr<gl::GLImage> CreateImageForGpuMemoryBuffer( 143 scoped_refptr<gl::GLImage> CreateImageForGpuMemoryBuffer(
145 const gfx::GpuMemoryBufferHandle& handle, 144 const gfx::GpuMemoryBufferHandle& handle,
146 const gfx::Size& size, 145 const gfx::Size& size,
147 gfx::BufferFormat format, 146 gfx::BufferFormat format,
148 uint32_t internalformat); 147 uint32_t internalformat);
149 148
150 void HandleUpdateValueState(unsigned int target, 149 void HandleUpdateValueState(unsigned int target,
151 const gpu::ValueState& state); 150 const ValueState& state);
152 151
153 GpuChannelMessageFilter* filter() const { return filter_.get(); } 152 GpuChannelMessageFilter* filter() const { return filter_.get(); }
154 153
155 // Visible for testing. 154 // Visible for testing.
156 const gpu::ValueStateMap* pending_valuebuffer_state() const { 155 const ValueStateMap* pending_valuebuffer_state() const {
157 return pending_valuebuffer_state_.get(); 156 return pending_valuebuffer_state_.get();
158 } 157 }
159 158
160 // Returns the global order number for the last processed IPC message. 159 // Returns the global order number for the last processed IPC message.
161 uint32_t GetProcessedOrderNum() const; 160 uint32_t GetProcessedOrderNum() const;
162 161
163 // Returns the global order number for the last unprocessed IPC message. 162 // Returns the global order number for the last unprocessed IPC message.
164 uint32_t GetUnprocessedOrderNum() const; 163 uint32_t GetUnprocessedOrderNum() const;
165 164
166 // Returns the shared sync point global order data for the stream. 165 // Returns the shared sync point global order data for the stream.
167 scoped_refptr<gpu::SyncPointOrderData> GetSyncPointOrderData( 166 scoped_refptr<SyncPointOrderData> GetSyncPointOrderData(
168 int32_t stream_id); 167 int32_t stream_id);
169 168
170 void PostHandleOutOfOrderMessage(const IPC::Message& message); 169 void PostHandleOutOfOrderMessage(const IPC::Message& message);
171 void PostHandleMessage(const scoped_refptr<GpuChannelMessageQueue>& queue); 170 void PostHandleMessage(const scoped_refptr<GpuChannelMessageQueue>& queue);
172 171
173 // Synchronously handle the message to make testing convenient. 172 // Synchronously handle the message to make testing convenient.
174 void HandleMessageForTesting(const IPC::Message& msg); 173 void HandleMessageForTesting(const IPC::Message& msg);
175 174
176 #if defined(OS_ANDROID) 175 #if defined(OS_ANDROID)
177 const GpuCommandBufferStub* GetOneStub() const; 176 const GpuCommandBufferStub* GetOneStub() const;
(...skipping 13 matching lines...) Expand all
191 190
192 // Some messages such as WaitForGetOffsetInRange and WaitForTokenInRange are 191 // Some messages such as WaitForGetOffsetInRange and WaitForTokenInRange are
193 // processed as soon as possible because the client is blocked until they 192 // processed as soon as possible because the client is blocked until they
194 // are completed. 193 // are completed.
195 void HandleOutOfOrderMessage(const IPC::Message& msg); 194 void HandleOutOfOrderMessage(const IPC::Message& msg);
196 195
197 void HandleMessageHelper(const IPC::Message& msg); 196 void HandleMessageHelper(const IPC::Message& msg);
198 197
199 scoped_refptr<GpuChannelMessageQueue> CreateStream( 198 scoped_refptr<GpuChannelMessageQueue> CreateStream(
200 int32_t stream_id, 199 int32_t stream_id,
201 gpu::GpuStreamPriority stream_priority); 200 GpuStreamPriority stream_priority);
202 201
203 scoped_refptr<GpuChannelMessageQueue> LookupStream(int32_t stream_id); 202 scoped_refptr<GpuChannelMessageQueue> LookupStream(int32_t stream_id);
204 203
205 void DestroyStreamIfNecessary( 204 void DestroyStreamIfNecessary(
206 const scoped_refptr<GpuChannelMessageQueue>& queue); 205 const scoped_refptr<GpuChannelMessageQueue>& queue);
207 206
208 void AddRouteToStream(int32_t route_id, int32_t stream_id); 207 void AddRouteToStream(int32_t route_id, int32_t stream_id);
209 void RemoveRouteFromStream(int32_t route_id); 208 void RemoveRouteFromStream(int32_t route_id);
210 209
211 // Message handlers for control messages. 210 // Message handlers for control messages.
212 void OnCreateCommandBuffer(gpu::SurfaceHandle surface_handle, 211 void OnCreateCommandBuffer(SurfaceHandle surface_handle,
213 const gfx::Size& size, 212 const gfx::Size& size,
214 const GPUCreateCommandBufferConfig& init_params, 213 const GPUCreateCommandBufferConfig& init_params,
215 int32_t route_id, 214 int32_t route_id,
216 bool* succeeded); 215 bool* succeeded);
217 void OnDestroyCommandBuffer(int32_t route_id); 216 void OnDestroyCommandBuffer(int32_t route_id);
218 void OnGetDriverBugWorkArounds( 217 void OnGetDriverBugWorkArounds(
219 std::vector<std::string>* gpu_driver_bug_workarounds); 218 std::vector<std::string>* gpu_driver_bug_workarounds);
220 219
221 // The lifetime of objects of this class is managed by a GpuChannelManager. 220 // The lifetime of objects of this class is managed by a GpuChannelManager.
222 // The GpuChannelManager destroy all the GpuChannels that they own when they 221 // The GpuChannelManager destroy all the GpuChannels that they own when they
223 // are destroyed. So a raw pointer is safe. 222 // are destroyed. So a raw pointer is safe.
224 GpuChannelManager* const gpu_channel_manager_; 223 GpuChannelManager* const gpu_channel_manager_;
225 224
226 // Sync point manager. Outlives the channel and is guaranteed to outlive the 225 // Sync point manager. Outlives the channel and is guaranteed to outlive the
227 // message loop. 226 // message loop.
228 gpu::SyncPointManager* const sync_point_manager_; 227 SyncPointManager* const sync_point_manager_;
229 228
230 scoped_ptr<IPC::SyncChannel> channel_; 229 scoped_ptr<IPC::SyncChannel> channel_;
231 230
232 IPC::Listener* unhandled_message_listener_; 231 IPC::Listener* unhandled_message_listener_;
233 232
234 // Uniquely identifies the channel within this GPU process. 233 // Uniquely identifies the channel within this GPU process.
235 std::string channel_id_; 234 std::string channel_id_;
236 235
237 // Used to implement message routing functionality to CommandBuffer objects 236 // Used to implement message routing functionality to CommandBuffer objects
238 IPC::MessageRouter router_; 237 IPC::MessageRouter router_;
239 238
240 // Whether the processing of IPCs on this channel is stalled and we should 239 // Whether the processing of IPCs on this channel is stalled and we should
241 // preempt other GpuChannels. 240 // preempt other GpuChannels.
242 scoped_refptr<gpu::PreemptionFlag> preempting_flag_; 241 scoped_refptr<PreemptionFlag> preempting_flag_;
243 242
244 // If non-NULL, all stubs on this channel should stop processing GL 243 // If non-NULL, all stubs on this channel should stop processing GL
245 // commands (via their CommandExecutor) when preempted_flag_->IsSet() 244 // commands (via their CommandExecutor) when preempted_flag_->IsSet()
246 scoped_refptr<gpu::PreemptionFlag> preempted_flag_; 245 scoped_refptr<PreemptionFlag> preempted_flag_;
247 246
248 // The id of the client who is on the other side of the channel. 247 // The id of the client who is on the other side of the channel.
249 const int32_t client_id_; 248 const int32_t client_id_;
250 249
251 // The tracing ID used for memory allocations associated with this client. 250 // The tracing ID used for memory allocations associated with this client.
252 const uint64_t client_tracing_id_; 251 const uint64_t client_tracing_id_;
253 252
254 // The task runners for the main thread and the io thread. 253 // The task runners for the main thread and the io thread.
255 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; 254 scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
256 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_; 255 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_;
257 256
258 // The share group that all contexts associated with a particular renderer 257 // The share group that all contexts associated with a particular renderer
259 // process use. 258 // process use.
260 scoped_refptr<gfx::GLShareGroup> share_group_; 259 scoped_refptr<gfx::GLShareGroup> share_group_;
261 260
262 scoped_refptr<gpu::gles2::MailboxManager> mailbox_manager_; 261 scoped_refptr<gles2::MailboxManager> mailbox_manager_;
263 262
264 scoped_refptr<gpu::gles2::SubscriptionRefSet> subscription_ref_set_; 263 scoped_refptr<gles2::SubscriptionRefSet> subscription_ref_set_;
265 264
266 scoped_refptr<gpu::ValueStateMap> pending_valuebuffer_state_; 265 scoped_refptr<ValueStateMap> pending_valuebuffer_state_;
267 266
268 gpu::gles2::DisallowedFeatures disallowed_features_; 267 gles2::DisallowedFeatures disallowed_features_;
269 GpuWatchdog* const watchdog_; 268 GpuWatchdog* const watchdog_;
270 269
271 // Map of stream id to appropriate message queue. 270 // Map of stream id to appropriate message queue.
272 base::hash_map<int32_t, scoped_refptr<GpuChannelMessageQueue>> streams_; 271 base::hash_map<int32_t, scoped_refptr<GpuChannelMessageQueue>> streams_;
273 272
274 // Multimap of stream id to route ids. 273 // Multimap of stream id to route ids.
275 base::hash_map<int32_t, int> streams_to_num_routes_; 274 base::hash_map<int32_t, int> streams_to_num_routes_;
276 275
277 // Map of route id to stream id; 276 // Map of route id to stream id;
278 base::hash_map<int32_t, int32_t> routes_to_streams_; 277 base::hash_map<int32_t, int32_t> routes_to_streams_;
(...skipping 16 matching lines...) Expand all
295 // - it counts and timestamps each message forwarded to the channel 294 // - it counts and timestamps each message forwarded to the channel
296 // so that we can preempt other channels if a message takes too long to 295 // so that we can preempt other channels if a message takes too long to
297 // process. To guarantee fairness, we must wait a minimum amount of time 296 // process. To guarantee fairness, we must wait a minimum amount of time
298 // before preempting and we limit the amount of time that we can preempt in 297 // before preempting and we limit the amount of time that we can preempt in
299 // one shot (see constants above). 298 // one shot (see constants above).
300 // - it handles the GpuCommandBufferMsg_InsertSyncPoint message on the IO 299 // - it handles the GpuCommandBufferMsg_InsertSyncPoint message on the IO
301 // thread, generating the sync point ID and responding immediately, and then 300 // thread, generating the sync point ID and responding immediately, and then
302 // posting a task to insert the GpuCommandBufferMsg_RetireSyncPoint message 301 // posting a task to insert the GpuCommandBufferMsg_RetireSyncPoint message
303 // into the channel's queue. 302 // into the channel's queue.
304 // - it generates mailbox names for clients of the GPU process on the IO thread. 303 // - it generates mailbox names for clients of the GPU process on the IO thread.
305 class GpuChannelMessageFilter : public IPC::MessageFilter { 304 class GPU_EXPORT GpuChannelMessageFilter : public IPC::MessageFilter {
306 public: 305 public:
307 GpuChannelMessageFilter(); 306 GpuChannelMessageFilter();
308 307
309 // IPC::MessageFilter implementation. 308 // IPC::MessageFilter implementation.
310 void OnFilterAdded(IPC::Sender* sender) override; 309 void OnFilterAdded(IPC::Sender* sender) override;
311 void OnFilterRemoved() override; 310 void OnFilterRemoved() override;
312 void OnChannelConnected(int32_t peer_pid) override; 311 void OnChannelConnected(int32_t peer_pid) override;
313 void OnChannelError() override; 312 void OnChannelError() override;
314 void OnChannelClosing() override; 313 void OnChannelClosing() override;
315 bool OnMessageReceived(const IPC::Message& message) override; 314 bool OnMessageReceived(const IPC::Message& message) override;
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 353
355 private: 354 private:
356 DISALLOW_COPY_AND_ASSIGN(GpuChannelMessage); 355 DISALLOW_COPY_AND_ASSIGN(GpuChannelMessage);
357 }; 356 };
358 357
359 class GpuChannelMessageQueue 358 class GpuChannelMessageQueue
360 : public base::RefCountedThreadSafe<GpuChannelMessageQueue> { 359 : public base::RefCountedThreadSafe<GpuChannelMessageQueue> {
361 public: 360 public:
362 static scoped_refptr<GpuChannelMessageQueue> Create( 361 static scoped_refptr<GpuChannelMessageQueue> Create(
363 int32_t stream_id, 362 int32_t stream_id,
364 gpu::GpuStreamPriority stream_priority, 363 GpuStreamPriority stream_priority,
365 GpuChannel* channel, 364 GpuChannel* channel,
366 const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner, 365 const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner,
367 const scoped_refptr<gpu::PreemptionFlag>& preempting_flag, 366 const scoped_refptr<PreemptionFlag>& preempting_flag,
368 const scoped_refptr<gpu::PreemptionFlag>& preempted_flag, 367 const scoped_refptr<PreemptionFlag>& preempted_flag,
369 gpu::SyncPointManager* sync_point_manager); 368 SyncPointManager* sync_point_manager);
370 369
371 void Disable(); 370 void Disable();
372 void DisableIO(); 371 void DisableIO();
373 372
374 int32_t stream_id() const { return stream_id_; } 373 int32_t stream_id() const { return stream_id_; }
375 gpu::GpuStreamPriority stream_priority() const { return stream_priority_; } 374 GpuStreamPriority stream_priority() const { return stream_priority_; }
376 375
377 bool IsScheduled() const; 376 bool IsScheduled() const;
378 void OnRescheduled(bool scheduled); 377 void OnRescheduled(bool scheduled);
379 378
380 bool HasQueuedMessages() const; 379 bool HasQueuedMessages() const;
381 380
382 base::TimeTicks GetNextMessageTimeTick() const; 381 base::TimeTicks GetNextMessageTimeTick() const;
383 382
384 scoped_refptr<gpu::SyncPointOrderData> GetSyncPointOrderData(); 383 scoped_refptr<SyncPointOrderData> GetSyncPointOrderData();
385 384
386 // Returns the global order number for the last unprocessed IPC message. 385 // Returns the global order number for the last unprocessed IPC message.
387 uint32_t GetUnprocessedOrderNum() const; 386 uint32_t GetUnprocessedOrderNum() const;
388 387
389 // Returns the global order number for the last unprocessed IPC message. 388 // Returns the global order number for the last unprocessed IPC message.
390 uint32_t GetProcessedOrderNum() const; 389 uint32_t GetProcessedOrderNum() const;
391 390
392 // Should be called before a message begins to be processed. Returns false if 391 // Should be called before a message begins to be processed. Returns false if
393 // there are no messages to process. 392 // there are no messages to process.
394 const GpuChannelMessage* BeginMessageProcessing(); 393 const GpuChannelMessage* BeginMessageProcessing();
(...skipping 19 matching lines...) Expand all
414 // We are currently preempting (i.e. no stub is descheduled). 413 // We are currently preempting (i.e. no stub is descheduled).
415 PREEMPTING, 414 PREEMPTING,
416 // We would like to preempt, but some stub is descheduled. 415 // We would like to preempt, but some stub is descheduled.
417 WOULD_PREEMPT_DESCHEDULED, 416 WOULD_PREEMPT_DESCHEDULED,
418 }; 417 };
419 418
420 friend class base::RefCountedThreadSafe<GpuChannelMessageQueue>; 419 friend class base::RefCountedThreadSafe<GpuChannelMessageQueue>;
421 420
422 GpuChannelMessageQueue( 421 GpuChannelMessageQueue(
423 int32_t stream_id, 422 int32_t stream_id,
424 gpu::GpuStreamPriority stream_priority, 423 GpuStreamPriority stream_priority,
425 GpuChannel* channel, 424 GpuChannel* channel,
426 const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner, 425 const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner,
427 const scoped_refptr<gpu::PreemptionFlag>& preempting_flag, 426 const scoped_refptr<PreemptionFlag>& preempting_flag,
428 const scoped_refptr<gpu::PreemptionFlag>& preempted_flag, 427 const scoped_refptr<PreemptionFlag>& preempted_flag,
429 gpu::SyncPointManager* sync_point_manager); 428 SyncPointManager* sync_point_manager);
430 ~GpuChannelMessageQueue(); 429 ~GpuChannelMessageQueue();
431 430
432 void UpdatePreemptionState(); 431 void UpdatePreemptionState();
433 void UpdatePreemptionStateHelper(); 432 void UpdatePreemptionStateHelper();
434 433
435 void UpdateStateIdle(); 434 void UpdateStateIdle();
436 void UpdateStateWaiting(); 435 void UpdateStateWaiting();
437 void UpdateStateChecking(); 436 void UpdateStateChecking();
438 void UpdateStatePreempting(); 437 void UpdateStatePreempting();
439 void UpdateStateWouldPreemptDescheduled(); 438 void UpdateStateWouldPreemptDescheduled();
440 439
441 void TransitionToIdle(); 440 void TransitionToIdle();
442 void TransitionToWaiting(); 441 void TransitionToWaiting();
443 void TransitionToChecking(); 442 void TransitionToChecking();
444 void TransitionToPreempting(); 443 void TransitionToPreempting();
445 void TransitionToWouldPreemptDescheduled(); 444 void TransitionToWouldPreemptDescheduled();
446 445
447 bool ShouldTransitionToIdle() const; 446 bool ShouldTransitionToIdle() const;
448 447
449 const int32_t stream_id_; 448 const int32_t stream_id_;
450 const gpu::GpuStreamPriority stream_priority_; 449 const GpuStreamPriority stream_priority_;
451 450
452 // These can be accessed from both IO and main threads and are protected by 451 // These can be accessed from both IO and main threads and are protected by
453 // |channel_lock_|. 452 // |channel_lock_|.
454 bool enabled_; 453 bool enabled_;
455 bool scheduled_; 454 bool scheduled_;
456 GpuChannel* const channel_; 455 GpuChannel* const channel_;
457 std::deque<scoped_ptr<GpuChannelMessage>> channel_messages_; 456 std::deque<scoped_ptr<GpuChannelMessage>> channel_messages_;
458 mutable base::Lock channel_lock_; 457 mutable base::Lock channel_lock_;
459 458
460 // The following are accessed on the IO thread only. 459 // The following are accessed on the IO thread only.
461 // No lock is necessary for preemption state because it's only accessed on the 460 // No lock is necessary for preemption state because it's only accessed on the
462 // IO thread. 461 // IO thread.
463 PreemptionState preemption_state_; 462 PreemptionState preemption_state_;
464 // Maximum amount of time that we can spend in PREEMPTING. 463 // Maximum amount of time that we can spend in PREEMPTING.
465 // It is reset when we transition to IDLE. 464 // It is reset when we transition to IDLE.
466 base::TimeDelta max_preemption_time_; 465 base::TimeDelta max_preemption_time_;
467 // This timer is used and runs tasks on the IO thread. 466 // This timer is used and runs tasks on the IO thread.
468 scoped_ptr<base::OneShotTimer> timer_; 467 scoped_ptr<base::OneShotTimer> timer_;
469 base::ThreadChecker io_thread_checker_; 468 base::ThreadChecker io_thread_checker_;
470 469
471 // Keeps track of sync point related state such as message order numbers. 470 // Keeps track of sync point related state such as message order numbers.
472 scoped_refptr<gpu::SyncPointOrderData> sync_point_order_data_; 471 scoped_refptr<SyncPointOrderData> sync_point_order_data_;
473 472
474 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_; 473 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_;
475 scoped_refptr<gpu::PreemptionFlag> preempting_flag_; 474 scoped_refptr<PreemptionFlag> preempting_flag_;
476 scoped_refptr<gpu::PreemptionFlag> preempted_flag_; 475 scoped_refptr<PreemptionFlag> preempted_flag_;
477 gpu::SyncPointManager* const sync_point_manager_; 476 SyncPointManager* const sync_point_manager_;
478 477
479 DISALLOW_COPY_AND_ASSIGN(GpuChannelMessageQueue); 478 DISALLOW_COPY_AND_ASSIGN(GpuChannelMessageQueue);
480 }; 479 };
481 480
482 } // namespace content 481 } // namespace gpu
483 482
484 #endif // CONTENT_COMMON_GPU_GPU_CHANNEL_H_ 483 #endif // GPU_IPC_SERVICE_GPU_CHANNEL_H_
OLDNEW
« no previous file with comments | « gpu/ipc/service/child_window_surface_win.cc ('k') | gpu/ipc/service/gpu_channel.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698