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

Unified Diff: ipc/ipc_message_pipe_reader.h

Issue 2163633003: Support early associated interface binding on ChannelMojo (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@explicit-channel-ipc-task-runner
Patch Set: . Created 4 years, 5 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 | « ipc/ipc_channel_proxy.cc ('k') | ipc/ipc_message_pipe_reader.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ipc/ipc_message_pipe_reader.h
diff --git a/ipc/ipc_message_pipe_reader.h b/ipc/ipc_message_pipe_reader.h
index 5aec4407aaef45842c397d4402e846ba9f4dbd8c..e6a2a137a0a39930266c1400977befb13d10c51a 100644
--- a/ipc/ipc_message_pipe_reader.h
+++ b/ipc/ipc_message_pipe_reader.h
@@ -13,6 +13,7 @@
#include "base/atomicops.h"
#include "base/compiler_specific.h"
#include "base/macros.h"
+#include "base/process/process_handle.h"
#include "base/threading/thread_checker.h"
#include "ipc/ipc.mojom.h"
#include "ipc/ipc_export.h"
@@ -47,6 +48,7 @@ class IPC_EXPORT MessagePipeReader : public NON_EXPORTED_BASE(mojom::Channel) {
public:
class Delegate {
public:
+ virtual void OnPeerPidReceived() = 0;
virtual void OnMessageReceived(const Message& message) = 0;
virtual void OnPipeError() = 0;
virtual void OnAssociatedInterfaceRequest(
@@ -54,21 +56,6 @@ class IPC_EXPORT MessagePipeReader : public NON_EXPORTED_BASE(mojom::Channel) {
mojo::ScopedInterfaceEndpointHandle handle) = 0;
};
- // Delay the object deletion using the current message loop.
- // This is intended to used by MessagePipeReader owners.
- class DelayedDeleter {
- public:
- typedef std::default_delete<MessagePipeReader> DefaultType;
-
- static void DeleteNow(MessagePipeReader* ptr) { delete ptr; }
-
- DelayedDeleter() {}
- explicit DelayedDeleter(const DefaultType&) {}
- DelayedDeleter& operator=(const DefaultType&) { return *this; }
-
- void operator()(MessagePipeReader* ptr) const;
- };
-
// Builds a reader that reads messages from |receive_handle| and lets
// |delegate| know.
//
@@ -82,7 +69,6 @@ class IPC_EXPORT MessagePipeReader : public NON_EXPORTED_BASE(mojom::Channel) {
MessagePipeReader(mojo::MessagePipeHandle pipe,
mojom::ChannelAssociatedPtr sender,
mojo::AssociatedInterfaceRequest<mojom::Channel> receiver,
- base::ProcessId peer_pid,
Delegate* delegate);
~MessagePipeReader() override;
@@ -108,6 +94,7 @@ class IPC_EXPORT MessagePipeReader : public NON_EXPORTED_BASE(mojom::Channel) {
private:
// mojom::Channel:
+ void SetPeerPid(int32_t peer_pid) override;
void Receive(mojo::Array<uint8_t> data,
mojo::Array<mojom::SerializedHandlePtr> handles) override;
void GetAssociatedInterface(
@@ -116,7 +103,7 @@ class IPC_EXPORT MessagePipeReader : public NON_EXPORTED_BASE(mojom::Channel) {
// |delegate_| is null once the message pipe is closed.
Delegate* delegate_;
- base::ProcessId peer_pid_;
+ base::ProcessId peer_pid_ = base::kNullProcessId;
mojom::ChannelAssociatedPtr sender_;
mojo::AssociatedBinding<mojom::Channel> binding_;
« no previous file with comments | « ipc/ipc_channel_proxy.cc ('k') | ipc/ipc_message_pipe_reader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698