Chromium Code Reviews| Index: content/common/gpu/gpu_channel.h |
| diff --git a/content/common/gpu/gpu_channel.h b/content/common/gpu/gpu_channel.h |
| index c51baa800265f9682f39e30c18b98c3672629ba6..e191b6efe6f9d33bb1a87dcaef3202622300e162 100644 |
| --- a/content/common/gpu/gpu_channel.h |
| +++ b/content/common/gpu/gpu_channel.h |
| @@ -5,14 +5,15 @@ |
| #ifndef CONTENT_COMMON_GPU_GPU_CHANNEL_H_ |
| #define CONTENT_COMMON_GPU_GPU_CHANNEL_H_ |
| -#include <deque> |
| #include <string> |
| +#include "base/atomicops.h" |
| #include "base/containers/scoped_ptr_hash_map.h" |
| #include "base/memory/ref_counted.h" |
| #include "base/memory/scoped_ptr.h" |
| #include "base/memory/weak_ptr.h" |
| #include "base/process/process.h" |
| +#include "base/timer/timer.h" |
| #include "base/trace_event/memory_dump_provider.h" |
| #include "build/build_config.h" |
| #include "content/common/content_export.h" |
| @@ -50,9 +51,12 @@ class MessageFilter; |
| namespace content { |
| class GpuChannelManager; |
| class GpuChannelMessageFilter; |
| +class GpuChannelMessageQueue; |
| class GpuJpegDecodeAccelerator; |
| class GpuWatchdog; |
| +struct ChannelMessage; |
|
piman
2015/09/01 03:55:27
nit: GpuChannelMessage? ChannelMessage is unspecif
David Yen
2015/09/01 19:08:02
Done.
|
| + |
| // Encapsulates an IPC channel between the GPU process and one renderer |
| // process. On the renderer side there's a corresponding GpuChannelHost. |
| class CONTENT_EXPORT GpuChannel |
| @@ -95,6 +99,9 @@ class CONTENT_EXPORT GpuChannel |
| return io_task_runner_; |
| } |
| + // Process channel message from main thread. |
| + void ProcessMessage(uint32_t order_number, const IPC::Message& message); |
| + |
| // IPC::Listener implementation: |
| bool OnMessageReceived(const IPC::Message& msg) override; |
| void OnChannelError() override; |
| @@ -144,8 +151,7 @@ class CONTENT_EXPORT GpuChannel |
| gpu::PreemptionFlag* GetPreemptionFlag(); |
| - bool handle_messages_scheduled() const { return handle_messages_scheduled_; } |
| - uint64 messages_processed() const { return messages_processed_; } |
| + bool handle_messages_scheduled() const; |
| // If |preemption_flag->IsSet()|, any stub on this channel |
| // should stop issuing GL commands. Setting this to NULL stops deferral. |
| @@ -175,6 +181,10 @@ class CONTENT_EXPORT GpuChannel |
| return pending_valuebuffer_state_.get(); |
| } |
| + uint32_t GetCurrentOrderNum() const { return current_order_num_; } |
| + uint32_t GetProcessedOrderNum() const { return processed_order_num_; } |
| + uint32_t GetUnprocessedOrderNum() const; |
| + |
| protected: |
| // The message filter on the io thread. |
| scoped_refptr<GpuChannelMessageFilter> filter_; |
| @@ -184,6 +194,7 @@ class CONTENT_EXPORT GpuChannel |
| private: |
| friend class GpuChannelMessageFilter; |
| + friend class GpuChannelMessageQueue; |
| void OnDestroy(); |
| @@ -200,8 +211,8 @@ class CONTENT_EXPORT GpuChannel |
| void OnDestroyCommandBuffer(int32 route_id); |
| void OnCreateJpegDecoder(int32 route_id, IPC::Message* reply_msg); |
| - // Decrement the count of unhandled IPC messages and defer preemption. |
| - void MessageProcessed(); |
| + // Update processed order number and defer preemption. |
| + void MessageProcessed(uint32_t order_number); |
| // The lifetime of objects of this class is managed by a GpuChannelManager. |
| // The GpuChannelManager destroy all the GpuChannels that they own when they |
| @@ -216,8 +227,6 @@ class CONTENT_EXPORT GpuChannel |
| // Used to implement message routing functionality to CommandBuffer objects |
| MessageRouter router_; |
| - uint64 messages_processed_; |
| - |
| // Whether the processing of IPCs on this channel is stalled and we should |
| // preempt other GpuChannels. |
| scoped_refptr<gpu::PreemptionFlag> preempting_flag_; |
| @@ -226,7 +235,7 @@ class CONTENT_EXPORT GpuChannel |
| // commands (via their GpuScheduler) when preempted_flag_->IsSet() |
| scoped_refptr<gpu::PreemptionFlag> preempted_flag_; |
| - std::deque<IPC::Message*> deferred_messages_; |
| + scoped_refptr<GpuChannelMessageQueue> message_queue_; |
| // The id of the client who is on the other side of the channel. |
| int client_id_; |
| @@ -253,11 +262,15 @@ class CONTENT_EXPORT GpuChannel |
| gpu::gles2::DisallowedFeatures disallowed_features_; |
| GpuWatchdog* watchdog_; |
| bool software_; |
| - bool handle_messages_scheduled_; |
| - IPC::Message* currently_processing_message_; |
| + ChannelMessage* currently_processing_message_; |
| - size_t num_stubs_descheduled_; |
| + // Current IPC order number being processed. |
| + uint32_t current_order_num_; |
| + |
| + // Last finished IPC order number. |
| + uint32_t processed_order_num_; |
| + size_t num_stubs_descheduled_; |
| bool allow_future_sync_points_; |
| // Member variables should appear before the WeakPtrFactory, to ensure |