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

Unified Diff: gpu/ipc/service/gpu_channel.h

Issue 2772513005: gpu: Move out of order / control message handling to message filter. (Closed)
Patch Set: Created 3 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | gpu/ipc/service/gpu_channel.cc » ('j') | gpu/ipc/service/gpu_channel.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/ipc/service/gpu_channel.h
diff --git a/gpu/ipc/service/gpu_channel.h b/gpu/ipc/service/gpu_channel.h
index 5ec1e9d748b294d787e2556eb07626eb15810ac2..332db519da9d25d716743e5285d9dd4b93e86641 100644
--- a/gpu/ipc/service/gpu_channel.h
+++ b/gpu/ipc/service/gpu_channel.h
@@ -59,7 +59,9 @@ class GPU_EXPORT FilteredSender : public IPC::Sender {
// Encapsulates an IPC channel between the GPU process and one renderer
// process. On the renderer side there's a corresponding GpuChannelHost.
-class GPU_EXPORT GpuChannel : public IPC::Listener, public FilteredSender {
+class GPU_EXPORT GpuChannel : public IPC::Listener,
+ public FilteredSender,
+ public base::SupportsWeakPtr<GpuChannel> {
public:
// Takes ownership of the renderer process handle.
GpuChannel(GpuChannelManager* gpu_channel_manager,
@@ -110,12 +112,12 @@ class GPU_EXPORT GpuChannel : public IPC::Listener, public FilteredSender {
uint64_t client_tracing_id() const { return client_tracing_id_; }
- base::WeakPtr<GpuChannel> AsWeakPtr();
-
scoped_refptr<base::SingleThreadTaskRunner> io_task_runner() const {
return io_task_runner_;
}
+ void HandleMessageOnIOThread(const IPC::Message& msg);
+
// IPC::Listener implementation:
bool OnMessageReceived(const IPC::Message& msg) override;
void OnChannelConnected(int32_t peer_pid) override;
@@ -158,8 +160,8 @@ class GPU_EXPORT GpuChannel : public IPC::Listener, public FilteredSender {
GpuChannelMessageFilter* filter() const { return filter_.get(); }
+ void PostHandleMessageOnQueue();
void PostHandleOutOfOrderMessage(const IPC::Message& message);
- void PostHandleMessage();
// Synchronously handle the message to make testing convenient.
void HandleMessageForTesting(const IPC::Message& msg);
@@ -182,7 +184,7 @@ class GPU_EXPORT GpuChannel : public IPC::Listener, public FilteredSender {
bool OnControlMessageReceived(const IPC::Message& msg);
- void HandleMessage();
+ void HandleMessageOnQueue();
// Some messages such as WaitForGetOffsetInRange and WaitForTokenInRange are
// processed as soon as possible because the client is blocked until they
@@ -256,11 +258,6 @@ class GPU_EXPORT GpuChannel : public IPC::Listener, public FilteredSender {
base::ProcessId peer_pid_;
- // Member variables should appear before the WeakPtrFactory, to ensure
- // that any WeakPtrs to Controller are invalidated before its members
- // variable's destructors are executed, rendering them invalid.
piman 2017/03/24 04:31:40 I think we should keep this property. Using Suppor
sunnyps 2017/03/24 21:27:22 Done.
- base::WeakPtrFactory<GpuChannel> weak_factory_;
-
DISALLOW_COPY_AND_ASSIGN(GpuChannel);
};
@@ -277,8 +274,9 @@ class GPU_EXPORT GpuChannel : public IPC::Listener, public FilteredSender {
// - it generates mailbox names for clients of the GPU process on the IO thread.
class GPU_EXPORT GpuChannelMessageFilter : public IPC::MessageFilter {
public:
- explicit GpuChannelMessageFilter(
- scoped_refptr<GpuChannelMessageQueue> message_queue);
+ explicit GpuChannelMessageFilter(GpuChannel* gpu_channel);
+
+ void Destroy();
// IPC::MessageFilter implementation.
void OnFilterAdded(IPC::Channel* channel) override;
@@ -293,17 +291,16 @@ class GPU_EXPORT GpuChannelMessageFilter : public IPC::MessageFilter {
bool Send(IPC::Message* message);
- protected:
+ private:
~GpuChannelMessageFilter() override;
- private:
bool MessageErrorHandler(const IPC::Message& message, const char* error_msg);
- scoped_refptr<GpuChannelMessageQueue> message_queue_;
-
- IPC::Channel* channel_;
- base::ProcessId peer_pid_;
+ IPC::Channel* ipc_channel_ = nullptr;
+ base::ProcessId peer_pid_ = base::kNullProcessId;
std::vector<scoped_refptr<IPC::MessageFilter>> channel_filters_;
+ GpuChannel* gpu_channel_ = nullptr;
+ base::Lock lock_;
DISALLOW_COPY_AND_ASSIGN(GpuChannelMessageFilter);
};
@@ -332,8 +329,7 @@ class GpuChannelMessageQueue
scoped_refptr<PreemptionFlag> preempted_flag,
SyncPointManager* sync_point_manager);
- void Disable();
- void DisableIO();
+ void Destroy();
SequenceId sequence_id() const {
return sync_point_order_data_->sequence_id();
@@ -344,8 +340,6 @@ class GpuChannelMessageQueue
bool HasQueuedMessages() const;
- base::TimeTicks GetNextMessageTimeTick() const;
-
// Should be called before a message begins to be processed. Returns false if
// there are no messages to process.
const GpuChannelMessage* BeginMessageProcessing();
@@ -355,7 +349,7 @@ class GpuChannelMessageQueue
// there are more messages to process.
void FinishMessageProcessing();
- bool PushBackMessage(const IPC::Message& message);
+ void PushBackMessage(const IPC::Message& message);
private:
enum PreemptionState {
@@ -403,7 +397,6 @@ class GpuChannelMessageQueue
// These can be accessed from both IO and main threads and are protected by
// |channel_lock_|.
- bool enabled_;
bool scheduled_;
GpuChannel* const channel_;
std::deque<std::unique_ptr<GpuChannelMessage>> channel_messages_;
« no previous file with comments | « no previous file | gpu/ipc/service/gpu_channel.cc » ('j') | gpu/ipc/service/gpu_channel.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698