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

Side by Side Diff: ipc/ipc_message_pipe_reader.cc

Issue 2493623002: Remove IPC::Endpoint. (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_message_pipe_reader.h ('k') | ipc/ipc_test_sink.h » ('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 #include "ipc/ipc_message_pipe_reader.h" 5 #include "ipc/ipc_message_pipe_reader.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 const std::string& name, 78 const std::string& name,
79 mojo::ScopedInterfaceEndpointHandle handle) { 79 mojo::ScopedInterfaceEndpointHandle handle) {
80 if (!sender_.is_bound()) 80 if (!sender_.is_bound())
81 return; 81 return;
82 mojom::GenericInterfaceAssociatedRequest request; 82 mojom::GenericInterfaceAssociatedRequest request;
83 request.Bind(std::move(handle)); 83 request.Bind(std::move(handle));
84 sender_->GetAssociatedInterface(name, std::move(request)); 84 sender_->GetAssociatedInterface(name, std::move(request));
85 } 85 }
86 86
87 void MessagePipeReader::SetPeerPid(int32_t peer_pid) { 87 void MessagePipeReader::SetPeerPid(int32_t peer_pid) {
88 peer_pid_ = peer_pid; 88 delegate_->OnPeerPidReceived(peer_pid);
89 delegate_->OnPeerPidReceived();
90 } 89 }
91 90
92 void MessagePipeReader::Receive( 91 void MessagePipeReader::Receive(
93 const std::vector<uint8_t>& data, 92 const std::vector<uint8_t>& data,
94 base::Optional<std::vector<mojom::SerializedHandlePtr>> handles) { 93 base::Optional<std::vector<mojom::SerializedHandlePtr>> handles) {
95 DCHECK_NE(peer_pid_, base::kNullProcessId);
96 Message message( 94 Message message(
97 data.empty() ? "" : reinterpret_cast<const char*>(data.data()), 95 data.empty() ? "" : reinterpret_cast<const char*>(data.data()),
98 static_cast<uint32_t>(data.size())); 96 static_cast<uint32_t>(data.size()));
99 message.set_sender_pid(peer_pid_);
100 97
101 DVLOG(4) << "Receive " << message.type() << ": " << message.size(); 98 DVLOG(4) << "Receive " << message.type() << ": " << message.size();
102 MojoResult write_result = 99 MojoResult write_result =
103 ChannelMojo::WriteToMessageAttachmentSet(std::move(handles), &message); 100 ChannelMojo::WriteToMessageAttachmentSet(std::move(handles), &message);
104 if (write_result != MOJO_RESULT_OK) { 101 if (write_result != MOJO_RESULT_OK) {
105 OnPipeError(write_result); 102 OnPipeError(write_result);
106 return; 103 return;
107 } 104 }
108 105
109 TRACE_EVENT_WITH_FLOW0(TRACE_DISABLED_BY_DEFAULT("ipc.flow"), 106 TRACE_EVENT_WITH_FLOW0(TRACE_DISABLED_BY_DEFAULT("ipc.flow"),
(...skipping 16 matching lines...) Expand all
126 123
127 Close(); 124 Close();
128 125
129 // NOTE: The delegate call below may delete |this|. 126 // NOTE: The delegate call below may delete |this|.
130 if (delegate_) 127 if (delegate_)
131 delegate_->OnPipeError(); 128 delegate_->OnPipeError();
132 } 129 }
133 130
134 } // namespace internal 131 } // namespace internal
135 } // namespace IPC 132 } // namespace IPC
OLDNEW
« no previous file with comments | « ipc/ipc_message_pipe_reader.h ('k') | ipc/ipc_test_sink.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698