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

Side by Side Diff: ipc/ipc_message_pipe_reader.h

Issue 2455823002: Support generic synchronization against an IPC::Channel (Closed)
Patch Set: . Created 4 years, 1 month 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 IPC_IPC_MESSAGE_PIPE_READER_H_ 5 #ifndef IPC_IPC_MESSAGE_PIPE_READER_H_
6 #define IPC_IPC_MESSAGE_PIPE_READER_H_ 6 #define IPC_IPC_MESSAGE_PIPE_READER_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 bool IsValid() { return sender_; } 79 bool IsValid() { return sender_; }
80 80
81 // Sends an IPC::Message to the other end of the pipe. Safe to call from any 81 // Sends an IPC::Message to the other end of the pipe. Safe to call from any
82 // thread. 82 // thread.
83 bool Send(std::unique_ptr<Message> message); 83 bool Send(std::unique_ptr<Message> message);
84 84
85 // Requests an associated interface from the other end of the pipe. 85 // Requests an associated interface from the other end of the pipe.
86 void GetRemoteInterface(const std::string& name, 86 void GetRemoteInterface(const std::string& name,
87 mojo::ScopedInterfaceEndpointHandle handle); 87 mojo::ScopedInterfaceEndpointHandle handle);
88 88
89 // Sends an Event to be signalled ASAP from the other side of the channel.
90 void SendEventToSignal(mojo::common::mojom::EventPtr event);
91
89 base::ProcessId GetPeerPid() const { return peer_pid_; } 92 base::ProcessId GetPeerPid() const { return peer_pid_; }
90 93
91 mojom::Channel* sender() const { return sender_.get(); } 94 mojom::Channel* sender() const { return sender_.get(); }
92 95
93 protected: 96 protected:
94 void OnPipeClosed(); 97 void OnPipeClosed();
95 void OnPipeError(MojoResult error); 98 void OnPipeError(MojoResult error);
96 99
97 private: 100 private:
98 // mojom::Channel: 101 // mojom::Channel:
99 void SetPeerPid(int32_t peer_pid) override; 102 void SetPeerPid(int32_t peer_pid) override;
100 void Receive( 103 void Receive(
101 const std::vector<uint8_t>& data, 104 const std::vector<uint8_t>& data,
102 base::Optional<std::vector<mojom::SerializedHandlePtr>> handles) override; 105 base::Optional<std::vector<mojom::SerializedHandlePtr>> handles) override;
103 void GetAssociatedInterface( 106 void GetAssociatedInterface(
104 const std::string& name, 107 const std::string& name,
105 mojom::GenericInterfaceAssociatedRequest request) override; 108 mojom::GenericInterfaceAssociatedRequest request) override;
109 void SignalEvent(mojo::common::mojom::EventPtr event) override;
106 110
107 // |delegate_| is null once the message pipe is closed. 111 // |delegate_| is null once the message pipe is closed.
108 Delegate* delegate_; 112 Delegate* delegate_;
109 base::ProcessId peer_pid_ = base::kNullProcessId; 113 base::ProcessId peer_pid_ = base::kNullProcessId;
110 mojom::ChannelAssociatedPtr sender_; 114 mojom::ChannelAssociatedPtr sender_;
111 mojo::AssociatedBinding<mojom::Channel> binding_; 115 mojo::AssociatedBinding<mojom::Channel> binding_;
112 base::ThreadChecker thread_checker_; 116 base::ThreadChecker thread_checker_;
113 117
114 DISALLOW_COPY_AND_ASSIGN(MessagePipeReader); 118 DISALLOW_COPY_AND_ASSIGN(MessagePipeReader);
115 }; 119 };
116 120
117 } // namespace internal 121 } // namespace internal
118 } // namespace IPC 122 } // namespace IPC
119 123
120 #endif // IPC_IPC_MESSAGE_PIPE_READER_H_ 124 #endif // IPC_IPC_MESSAGE_PIPE_READER_H_
OLDNEW
« 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