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

Unified Diff: ipc/ipc_message_pipe_reader.cc

Issue 2181443002: Mojo C++ bindings: make ipc/ mojom targets to use STL string/vector types (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Make further change to array_traits_stl.h to make MSan build happy. Created 4 years, 4 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_message_pipe_reader.h ('k') | mojo/public/cpp/bindings/array_traits_stl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ipc/ipc_message_pipe_reader.cc
diff --git a/ipc/ipc_message_pipe_reader.cc b/ipc/ipc_message_pipe_reader.cc
index 8a2e7181c89a516342918671b1a3dfcdb2a9cc6d..8e00d5c7b272e1a4a9795ce8802844f4d3d12601 100644
--- a/ipc/ipc_message_pipe_reader.cc
+++ b/ipc/ipc_message_pipe_reader.cc
@@ -86,20 +86,20 @@ bool MessagePipeReader::Send(std::unique_ptr<Message> message) {
"MessagePipeReader::Send",
message->flags(),
TRACE_EVENT_FLAG_FLOW_OUT);
- mojo::Array<mojom::SerializedHandlePtr> handles(nullptr);
+ base::Optional<std::vector<mojom::SerializedHandlePtr>> handles;
MojoResult result = MOJO_RESULT_OK;
result = ChannelMojo::ReadFromMessageAttachmentSet(message.get(), &handles);
if (result != MOJO_RESULT_OK)
return false;
- mojo::Array<uint8_t> data(message->size());
+ std::vector<uint8_t> data(message->size());
std::copy(reinterpret_cast<const uint8_t*>(message->data()),
reinterpret_cast<const uint8_t*>(message->data()) + message->size(),
- &data[0]);
+ data.data());
MessageSerializer serializer;
mojom::ChannelProxy proxy(&serializer);
- proxy.Receive(std::move(data), std::move(handles));
+ proxy.Receive(data, std::move(handles));
mojo::Message* mojo_message = serializer.message();
size_t num_handles = mojo_message->handles()->size();
@@ -129,11 +129,11 @@ void MessagePipeReader::SetPeerPid(int32_t peer_pid) {
}
void MessagePipeReader::Receive(
- mojo::Array<uint8_t> data,
- mojo::Array<mojom::SerializedHandlePtr> handles) {
+ const std::vector<uint8_t>& data,
+ base::Optional<std::vector<mojom::SerializedHandlePtr>> handles) {
DCHECK_NE(peer_pid_, base::kNullProcessId);
Message message(
- data.size() == 0 ? "" : reinterpret_cast<const char*>(&data[0]),
+ data.empty() ? "" : reinterpret_cast<const char*>(data.data()),
static_cast<uint32_t>(data.size()));
message.set_sender_pid(peer_pid_);
@@ -153,7 +153,7 @@ void MessagePipeReader::Receive(
}
void MessagePipeReader::GetAssociatedInterface(
- const mojo::String& name,
+ const std::string& name,
mojom::GenericInterfaceAssociatedRequest request) {
DCHECK(thread_checker_.CalledOnValidThread());
if (delegate_)
« no previous file with comments | « ipc/ipc_message_pipe_reader.h ('k') | mojo/public/cpp/bindings/array_traits_stl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698