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