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