Chromium Code Reviews| 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 GPU_IPC_SERVICE_GPU_CHANNEL_H_ | 5 #ifndef GPU_IPC_SERVICE_GPU_CHANNEL_H_ |
| 6 #define GPU_IPC_SERVICE_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 <memory> | 11 #include <memory> |
| 12 #include <string> | 12 #include <string> |
| 13 #include <unordered_map> | 13 #include <unordered_map> |
| 14 | 14 |
| 15 #include "base/containers/hash_tables.h" | 15 #include "base/containers/hash_tables.h" |
| 16 #include "base/macros.h" | 16 #include "base/macros.h" |
| 17 #include "base/memory/ref_counted.h" | 17 #include "base/memory/ref_counted.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 "gpu/command_buffer/common/gpu_stream_constants.h" | |
| 23 #include "gpu/command_buffer/service/sync_point_manager.h" | 24 #include "gpu/command_buffer/service/sync_point_manager.h" |
| 24 #include "gpu/gpu_export.h" | 25 #include "gpu/gpu_export.h" |
| 25 #include "gpu/ipc/common/gpu_stream_constants.h" | |
| 26 #include "gpu/ipc/service/gpu_command_buffer_stub.h" | 26 #include "gpu/ipc/service/gpu_command_buffer_stub.h" |
| 27 #include "gpu/ipc/service/gpu_memory_manager.h" | 27 #include "gpu/ipc/service/gpu_memory_manager.h" |
| 28 #include "ipc/ipc_sender.h" | 28 #include "ipc/ipc_sender.h" |
| 29 #include "ipc/ipc_sync_channel.h" | 29 #include "ipc/ipc_sync_channel.h" |
| 30 #include "ipc/message_router.h" | 30 #include "ipc/message_router.h" |
| 31 #include "ui/gfx/geometry/size.h" | 31 #include "ui/gfx/geometry/size.h" |
| 32 #include "ui/gfx/native_widget_types.h" | 32 #include "ui/gfx/native_widget_types.h" |
| 33 #include "ui/gl/gl_share_group.h" | 33 #include "ui/gl/gl_share_group.h" |
| 34 #include "ui/gl/gpu_preference.h" | 34 #include "ui/gl/gpu_preference.h" |
| 35 | 35 |
| 36 struct GPUCreateCommandBufferConfig; | 36 struct GPUCreateCommandBufferConfig; |
| 37 | 37 |
| 38 namespace base { | 38 namespace base { |
| 39 class WaitableEvent; | 39 class WaitableEvent; |
| 40 } | 40 } |
| 41 | 41 |
| 42 namespace gpu { | 42 namespace gpu { |
| 43 | 43 |
| 44 class PreemptionFlag; | 44 class PreemptionFlag; |
| 45 class Scheduler; | |
| 45 class SyncPointManager; | 46 class SyncPointManager; |
| 46 class GpuChannelManager; | 47 class GpuChannelManager; |
| 47 class GpuChannelMessageFilter; | 48 class GpuChannelMessageFilter; |
| 48 class GpuChannelMessageQueue; | 49 class GpuChannelMessageQueue; |
| 49 class GpuWatchdogThread; | 50 class GpuWatchdogThread; |
| 50 | 51 |
| 51 class GPU_EXPORT FilteredSender : public IPC::Sender { | 52 class GPU_EXPORT FilteredSender : public IPC::Sender { |
| 52 public: | 53 public: |
| 53 FilteredSender(); | 54 FilteredSender(); |
| 54 ~FilteredSender() override; | 55 ~FilteredSender() override; |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 75 | 76 |
| 76 DISALLOW_COPY_AND_ASSIGN(SyncChannelFilteredSender); | 77 DISALLOW_COPY_AND_ASSIGN(SyncChannelFilteredSender); |
| 77 }; | 78 }; |
| 78 | 79 |
| 79 // Encapsulates an IPC channel between the GPU process and one renderer | 80 // Encapsulates an IPC channel between the GPU process and one renderer |
| 80 // process. On the renderer side there's a corresponding GpuChannelHost. | 81 // process. On the renderer side there's a corresponding GpuChannelHost. |
| 81 class GPU_EXPORT GpuChannel : public IPC::Listener, public FilteredSender { | 82 class GPU_EXPORT GpuChannel : public IPC::Listener, public FilteredSender { |
| 82 public: | 83 public: |
| 83 // Takes ownership of the renderer process handle. | 84 // Takes ownership of the renderer process handle. |
| 84 GpuChannel(GpuChannelManager* gpu_channel_manager, | 85 GpuChannel(GpuChannelManager* gpu_channel_manager, |
| 86 Scheduler* scheduler, | |
| 85 SyncPointManager* sync_point_manager, | 87 SyncPointManager* sync_point_manager, |
| 86 GpuWatchdogThread* watchdog, | 88 GpuWatchdogThread* watchdog, |
| 87 scoped_refptr<gl::GLShareGroup> share_group, | 89 scoped_refptr<gl::GLShareGroup> share_group, |
| 88 scoped_refptr<gles2::MailboxManager> mailbox_manager, | 90 scoped_refptr<gles2::MailboxManager> mailbox_manager, |
| 89 scoped_refptr<PreemptionFlag> preempting_flag, | 91 scoped_refptr<PreemptionFlag> preempting_flag, |
| 90 scoped_refptr<PreemptionFlag> preempted_flag, | 92 scoped_refptr<PreemptionFlag> preempted_flag, |
| 91 scoped_refptr<base::SingleThreadTaskRunner> task_runner, | 93 scoped_refptr<base::SingleThreadTaskRunner> task_runner, |
| 92 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner, | 94 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner, |
| 93 int32_t client_id, | 95 int32_t client_id, |
| 94 uint64_t client_tracing_id, | 96 uint64_t client_tracing_id, |
| 95 bool is_gpu_host); | 97 bool is_gpu_host); |
| 96 ~GpuChannel() override; | 98 ~GpuChannel() override; |
| 97 | 99 |
| 98 // The IPC channel cannot be passed in the constructor because it needs a | 100 // The IPC channel cannot be passed in the constructor because it needs a |
| 99 // listener. The listener is the GpuChannel and must be constructed first. | 101 // listener. The listener is the GpuChannel and must be constructed first. |
| 100 void Init(std::unique_ptr<FilteredSender> channel); | 102 void Init(std::unique_ptr<FilteredSender> channel); |
| 101 | 103 |
| 104 base::WeakPtr<GpuChannel> AsWeakPtr(); | |
| 105 | |
| 102 void SetUnhandledMessageListener(IPC::Listener* listener); | 106 void SetUnhandledMessageListener(IPC::Listener* listener); |
| 103 | 107 |
| 104 // Get the GpuChannelManager that owns this channel. | 108 // Get the GpuChannelManager that owns this channel. |
| 105 GpuChannelManager* gpu_channel_manager() const { | 109 GpuChannelManager* gpu_channel_manager() const { |
| 106 return gpu_channel_manager_; | 110 return gpu_channel_manager_; |
| 107 } | 111 } |
| 108 | 112 |
| 113 Scheduler* scheduler() const { return scheduler_; } | |
| 114 | |
| 109 SyncPointManager* sync_point_manager() const { return sync_point_manager_; } | 115 SyncPointManager* sync_point_manager() const { return sync_point_manager_; } |
| 110 | 116 |
| 111 GpuWatchdogThread* watchdog() const { return watchdog_; } | 117 GpuWatchdogThread* watchdog() const { return watchdog_; } |
| 112 | 118 |
| 113 const scoped_refptr<GpuChannelMessageFilter>& filter() const { | 119 const scoped_refptr<GpuChannelMessageFilter>& filter() const { |
| 114 return filter_; | 120 return filter_; |
| 115 } | 121 } |
| 116 | 122 |
| 117 const scoped_refptr<gles2::MailboxManager>& mailbox_manager() const { | 123 const scoped_refptr<gles2::MailboxManager>& mailbox_manager() const { |
| 118 return mailbox_manager_; | 124 return mailbox_manager_; |
| 119 } | 125 } |
| 120 | 126 |
| 121 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner() const { | 127 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner() const { |
| 122 return task_runner_; | 128 return task_runner_; |
| 123 } | 129 } |
| 124 | 130 |
| 125 const scoped_refptr<PreemptionFlag>& preempted_flag() const { | 131 const scoped_refptr<PreemptionFlag>& preempted_flag() const { |
| 126 return preempted_flag_; | 132 return preempted_flag_; |
| 127 } | 133 } |
| 128 | 134 |
| 129 base::ProcessId GetClientPID() const; | 135 base::ProcessId GetClientPID() const; |
| 130 | 136 |
| 131 int client_id() const { return client_id_; } | 137 int client_id() const { return client_id_; } |
| 132 | 138 |
| 133 uint64_t client_tracing_id() const { return client_tracing_id_; } | 139 uint64_t client_tracing_id() const { return client_tracing_id_; } |
| 134 | 140 |
| 135 base::WeakPtr<GpuChannel> AsWeakPtr(); | |
| 136 | |
| 137 const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner() const { | 141 const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner() const { |
| 138 return io_task_runner_; | 142 return io_task_runner_; |
| 139 } | 143 } |
| 140 | 144 |
| 141 FilteredSender* channel_for_testing() const { return channel_.get(); } | 145 FilteredSender* channel_for_testing() const { return channel_.get(); } |
| 142 | 146 |
| 143 // IPC::Listener implementation: | 147 // IPC::Listener implementation: |
| 144 bool OnMessageReceived(const IPC::Message& msg) override; | 148 bool OnMessageReceived(const IPC::Message& msg) override; |
| 145 void OnChannelConnected(int32_t peer_pid) override; | 149 void OnChannelConnected(int32_t peer_pid) override; |
| 146 void OnChannelError() override; | 150 void OnChannelError() override; |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 173 | 177 |
| 174 uint64_t GetMemoryUsage(); | 178 uint64_t GetMemoryUsage(); |
| 175 | 179 |
| 176 scoped_refptr<gl::GLImage> CreateImageForGpuMemoryBuffer( | 180 scoped_refptr<gl::GLImage> CreateImageForGpuMemoryBuffer( |
| 177 const gfx::GpuMemoryBufferHandle& handle, | 181 const gfx::GpuMemoryBufferHandle& handle, |
| 178 const gfx::Size& size, | 182 const gfx::Size& size, |
| 179 gfx::BufferFormat format, | 183 gfx::BufferFormat format, |
| 180 uint32_t internalformat, | 184 uint32_t internalformat, |
| 181 SurfaceHandle surface_handle); | 185 SurfaceHandle surface_handle); |
| 182 | 186 |
| 187 void HandleMessage(const IPC::Message& msg); | |
| 188 | |
| 183 // Handle messages enqueued in |message_queue_|. | 189 // Handle messages enqueued in |message_queue_|. |
| 184 void HandleMessageOnQueue(); | 190 void HandleMessageOnQueue(); |
| 185 | 191 |
| 186 // Some messages such as WaitForGetOffsetInRange and WaitForTokenInRange are | 192 // Some messages such as WaitForGetOffsetInRange and WaitForTokenInRange are |
| 187 // processed as soon as possible because the client is blocked until they | 193 // processed as soon as possible because the client is blocked until they |
| 188 // are completed. | 194 // are completed. |
| 189 void HandleOutOfOrderMessage(const IPC::Message& msg); | 195 void HandleOutOfOrderMessage(const IPC::Message& msg); |
| 190 | 196 |
| 191 #if defined(OS_ANDROID) | 197 #if defined(OS_ANDROID) |
| 192 const GpuCommandBufferStub* GetOneStub() const; | 198 const GpuCommandBufferStub* GetOneStub() const; |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 217 base::ProcessId peer_pid_ = base::kNullProcessId; | 223 base::ProcessId peer_pid_ = base::kNullProcessId; |
| 218 | 224 |
| 219 scoped_refptr<GpuChannelMessageQueue> message_queue_; | 225 scoped_refptr<GpuChannelMessageQueue> message_queue_; |
| 220 | 226 |
| 221 // The message filter on the io thread. | 227 // The message filter on the io thread. |
| 222 scoped_refptr<GpuChannelMessageFilter> filter_; | 228 scoped_refptr<GpuChannelMessageFilter> filter_; |
| 223 | 229 |
| 224 // Map of routing id to command buffer stub. | 230 // Map of routing id to command buffer stub. |
| 225 std::unordered_map<int32_t, std::unique_ptr<GpuCommandBufferStub>> stubs_; | 231 std::unordered_map<int32_t, std::unique_ptr<GpuCommandBufferStub>> stubs_; |
| 226 | 232 |
| 233 // Map of stream id to scheduler sequence id. | |
| 234 std::map<int32_t, SequenceId> stream_sequences_; | |
| 235 | |
| 227 // The lifetime of objects of this class is managed by a GpuChannelManager. | 236 // The lifetime of objects of this class is managed by a GpuChannelManager. |
| 228 // The GpuChannelManager destroy all the GpuChannels that they own when they | 237 // The GpuChannelManager destroy all the GpuChannels that they own when they |
| 229 // are destroyed. So a raw pointer is safe. | 238 // are destroyed. So a raw pointer is safe. |
| 230 GpuChannelManager* const gpu_channel_manager_; | 239 GpuChannelManager* const gpu_channel_manager_; |
| 231 | 240 |
| 241 Scheduler* const scheduler_; | |
| 242 | |
| 232 // Sync point manager. Outlives the channel and is guaranteed to outlive the | 243 // Sync point manager. Outlives the channel and is guaranteed to outlive the |
| 233 // message loop. | 244 // message loop. |
| 234 SyncPointManager* const sync_point_manager_; | 245 SyncPointManager* const sync_point_manager_; |
| 235 | 246 |
| 236 IPC::Listener* unhandled_message_listener_ = nullptr; | 247 IPC::Listener* unhandled_message_listener_ = nullptr; |
| 237 | 248 |
| 238 // Used to implement message routing functionality to CommandBuffer objects | 249 // Used to implement message routing functionality to CommandBuffer objects |
| 239 IPC::MessageRouter router_; | 250 IPC::MessageRouter router_; |
| 240 | 251 |
| 241 // Whether the processing of IPCs on this channel is stalled and we should | 252 // Whether the processing of IPCs on this channel is stalled and we should |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 270 // any WeakPtrs to Controller are invalidated before its members variable's | 281 // any WeakPtrs to Controller are invalidated before its members variable's |
| 271 // destructors are executed, rendering them invalid. | 282 // destructors are executed, rendering them invalid. |
| 272 base::WeakPtrFactory<GpuChannel> weak_factory_; | 283 base::WeakPtrFactory<GpuChannel> weak_factory_; |
| 273 | 284 |
| 274 DISALLOW_COPY_AND_ASSIGN(GpuChannel); | 285 DISALLOW_COPY_AND_ASSIGN(GpuChannel); |
| 275 }; | 286 }; |
| 276 | 287 |
| 277 // This filter does three things: | 288 // This filter does three things: |
| 278 // - it counts and timestamps each message forwarded to the channel | 289 // - it counts and timestamps each message forwarded to the channel |
| 279 // so that we can preempt other channels if a message takes too long to | 290 // so that we can preempt other channels if a message takes too long to |
| 280 // process. To guarantee fairness, we must wait a minimum amount of time | 291 // process. To guarantee fairness, we must wait a minimum amount of time |
|
vmiura
2017/05/04 21:27:37
Is this preemption description still valid?
sunnyps
2017/05/10 23:15:15
I moved the filter and message queue to gpu_channe
| |
| 281 // before preempting and we limit the amount of time that we can preempt in | 292 // before preempting and we limit the amount of time that we can preempt in |
| 282 // one shot (see constants above). | 293 // one shot (see constants above). |
| 283 // - it handles the GpuCommandBufferMsg_InsertSyncPoint message on the IO | 294 // - it handles the GpuCommandBufferMsg_InsertSyncPoint message on the IO |
| 284 // thread, generating the sync point ID and responding immediately, and then | 295 // thread, generating the sync point ID and responding immediately, and then |
| 285 // posting a task to insert the GpuCommandBufferMsg_RetireSyncPoint message | 296 // posting a task to insert the GpuCommandBufferMsg_RetireSyncPoint message |
| 286 // into the channel's queue. | 297 // into the channel's queue. |
| 287 // - it generates mailbox names for clients of the GPU process on the IO thread. | 298 // - it generates mailbox names for clients of the GPU process on the IO thread. |
| 288 class GPU_EXPORT GpuChannelMessageFilter : public IPC::MessageFilter { | 299 class GPU_EXPORT GpuChannelMessageFilter : public IPC::MessageFilter { |
| 289 public: | 300 public: |
| 290 GpuChannelMessageFilter( | 301 GpuChannelMessageFilter( |
| 291 GpuChannel* gpu_channel, | 302 GpuChannel* gpu_channel, |
| 303 Scheduler* scheduler, | |
| 292 scoped_refptr<GpuChannelMessageQueue> message_queue, | 304 scoped_refptr<GpuChannelMessageQueue> message_queue, |
| 293 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner); | 305 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner); |
| 294 | 306 |
| 307 // Methods called on main thread. | |
| 295 void Destroy(); | 308 void Destroy(); |
| 296 | 309 |
| 310 // Called when scheduler is enabled. | |
| 311 void AddRoute(int32_t route_id, SequenceId sequence_id); | |
| 312 void RemoveRoute(int32_t route_id); | |
| 313 | |
| 314 // Methods called on IO thread. | |
| 297 // IPC::MessageFilter implementation. | 315 // IPC::MessageFilter implementation. |
| 298 void OnFilterAdded(IPC::Channel* channel) override; | 316 void OnFilterAdded(IPC::Channel* channel) override; |
| 299 void OnFilterRemoved() override; | 317 void OnFilterRemoved() override; |
| 300 void OnChannelConnected(int32_t peer_pid) override; | 318 void OnChannelConnected(int32_t peer_pid) override; |
| 301 void OnChannelError() override; | 319 void OnChannelError() override; |
| 302 void OnChannelClosing() override; | 320 void OnChannelClosing() override; |
| 303 bool OnMessageReceived(const IPC::Message& message) override; | 321 bool OnMessageReceived(const IPC::Message& message) override; |
| 304 | 322 |
| 305 void AddChannelFilter(scoped_refptr<IPC::MessageFilter> filter); | 323 void AddChannelFilter(scoped_refptr<IPC::MessageFilter> filter); |
| 306 void RemoveChannelFilter(scoped_refptr<IPC::MessageFilter> filter); | 324 void RemoveChannelFilter(scoped_refptr<IPC::MessageFilter> filter); |
| 307 | 325 |
| 308 bool Send(IPC::Message* message); | 326 bool Send(IPC::Message* message); |
| 309 | 327 |
| 310 private: | 328 private: |
| 311 ~GpuChannelMessageFilter() override; | 329 ~GpuChannelMessageFilter() override; |
| 312 | 330 |
| 313 bool MessageErrorHandler(const IPC::Message& message, const char* error_msg); | 331 bool MessageErrorHandler(const IPC::Message& message, const char* error_msg); |
| 314 | 332 |
| 315 IPC::Channel* ipc_channel_ = nullptr; | 333 IPC::Channel* ipc_channel_ = nullptr; |
| 316 base::ProcessId peer_pid_ = base::kNullProcessId; | 334 base::ProcessId peer_pid_ = base::kNullProcessId; |
| 317 std::vector<scoped_refptr<IPC::MessageFilter>> channel_filters_; | 335 std::vector<scoped_refptr<IPC::MessageFilter>> channel_filters_; |
| 318 | 336 |
| 319 GpuChannel* gpu_channel_ = nullptr; | 337 GpuChannel* gpu_channel_ = nullptr; |
| 338 // Map of route id to scheduler sequence id. | |
| 339 std::map<int32_t, SequenceId> route_sequences_; | |
| 320 base::Lock gpu_channel_lock_; | 340 base::Lock gpu_channel_lock_; |
| 321 | 341 |
| 342 Scheduler* scheduler_; | |
| 322 scoped_refptr<GpuChannelMessageQueue> message_queue_; | 343 scoped_refptr<GpuChannelMessageQueue> message_queue_; |
| 323 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_; | 344 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_; |
| 324 | 345 |
| 325 DISALLOW_COPY_AND_ASSIGN(GpuChannelMessageFilter); | 346 DISALLOW_COPY_AND_ASSIGN(GpuChannelMessageFilter); |
| 326 }; | 347 }; |
| 327 | 348 |
| 328 struct GpuChannelMessage { | 349 struct GpuChannelMessage { |
| 329 IPC::Message message; | 350 IPC::Message message; |
| 330 uint32_t order_number; | 351 uint32_t order_number; |
| 331 base::TimeTicks time_received; | 352 base::TimeTicks time_received; |
| 332 | 353 |
| 333 GpuChannelMessage(const IPC::Message& msg, | 354 GpuChannelMessage(const IPC::Message& msg, |
| 334 uint32_t order_num, | 355 uint32_t order_num, |
| 335 base::TimeTicks ts) | 356 base::TimeTicks ts) |
| 336 : message(msg), order_number(order_num), time_received(ts) {} | 357 : message(msg), order_number(order_num), time_received(ts) {} |
| 337 | 358 |
| 338 private: | 359 private: |
| 339 DISALLOW_COPY_AND_ASSIGN(GpuChannelMessage); | 360 DISALLOW_COPY_AND_ASSIGN(GpuChannelMessage); |
| 340 }; | 361 }; |
| 341 | 362 |
| 342 class GpuChannelMessageQueue | 363 class GpuChannelMessageQueue |
| 343 : public base::RefCountedThreadSafe<GpuChannelMessageQueue> { | 364 : public base::RefCountedThreadSafe<GpuChannelMessageQueue> { |
| 344 public: | 365 public: |
| 345 GpuChannelMessageQueue( | 366 GpuChannelMessageQueue( |
| 346 GpuChannel* channel, | 367 GpuChannel* channel, |
| 368 scoped_refptr<SyncPointOrderData> sync_point_order_data, | |
| 347 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, | 369 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, |
| 348 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner, | 370 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner, |
| 349 scoped_refptr<PreemptionFlag> preempting_flag, | 371 scoped_refptr<PreemptionFlag> preempting_flag, |
| 350 scoped_refptr<PreemptionFlag> preempted_flag, | 372 scoped_refptr<PreemptionFlag> preempted_flag); |
| 351 SyncPointManager* sync_point_manager); | |
| 352 | 373 |
| 353 void Destroy(); | 374 void Destroy(); |
| 354 | 375 |
| 355 SequenceId sequence_id() const { | 376 SequenceId sequence_id() const { |
| 356 return sync_point_order_data_->sequence_id(); | 377 return sync_point_order_data_->sequence_id(); |
| 357 } | 378 } |
| 358 | 379 |
| 359 bool IsScheduled() const; | 380 bool IsScheduled() const; |
| 360 void SetScheduled(bool scheduled); | 381 void SetScheduled(bool scheduled); |
| 361 | 382 |
| 362 bool HasQueuedMessages() const; | |
| 363 | |
| 364 // Should be called before a message begins to be processed. Returns false if | 383 // Should be called before a message begins to be processed. Returns false if |
| 365 // there are no messages to process. | 384 // there are no messages to process. |
| 366 const GpuChannelMessage* BeginMessageProcessing(); | 385 const GpuChannelMessage* BeginMessageProcessing(); |
| 367 // Should be called if a message began processing but did not finish. | 386 // Should be called if a message began processing but did not finish. |
| 368 void PauseMessageProcessing(); | 387 void PauseMessageProcessing(); |
| 369 // Should be called if a message is completely processed. Returns true if | 388 // Should be called if a message is completely processed. Returns true if |
| 370 // there are more messages to process. | 389 // there are more messages to process. |
| 371 void FinishMessageProcessing(); | 390 void FinishMessageProcessing(); |
| 372 | 391 |
| 373 void PushBackMessage(const IPC::Message& message); | 392 void PushBackMessage(const IPC::Message& message); |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 431 std::unique_ptr<base::OneShotTimer> timer_; | 450 std::unique_ptr<base::OneShotTimer> timer_; |
| 432 base::ThreadChecker io_thread_checker_; | 451 base::ThreadChecker io_thread_checker_; |
| 433 | 452 |
| 434 // Keeps track of sync point related state such as message order numbers. | 453 // Keeps track of sync point related state such as message order numbers. |
| 435 scoped_refptr<SyncPointOrderData> sync_point_order_data_; | 454 scoped_refptr<SyncPointOrderData> sync_point_order_data_; |
| 436 | 455 |
| 437 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_; | 456 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_; |
| 438 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_; | 457 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_; |
| 439 scoped_refptr<PreemptionFlag> preempting_flag_; | 458 scoped_refptr<PreemptionFlag> preempting_flag_; |
| 440 scoped_refptr<PreemptionFlag> preempted_flag_; | 459 scoped_refptr<PreemptionFlag> preempted_flag_; |
| 441 SyncPointManager* const sync_point_manager_; | |
| 442 | 460 |
| 443 DISALLOW_COPY_AND_ASSIGN(GpuChannelMessageQueue); | 461 DISALLOW_COPY_AND_ASSIGN(GpuChannelMessageQueue); |
| 444 }; | 462 }; |
| 445 | 463 |
| 446 } // namespace gpu | 464 } // namespace gpu |
| 447 | 465 |
| 448 #endif // GPU_IPC_SERVICE_GPU_CHANNEL_H_ | 466 #endif // GPU_IPC_SERVICE_GPU_CHANNEL_H_ |
| OLD | NEW |