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

Side by Side Diff: mojo/embedder/embedder.cc

Issue 591573002: Mojo: Remove Channel::AttachMessagePipeEndpoint(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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 unified diff | Download patch
« no previous file with comments | « no previous file | mojo/system/channel.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 "mojo/embedder/embedder.h" 5 #include "mojo/embedder/embedder.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "mojo/embedder/platform_support.h" 11 #include "mojo/embedder/platform_support.h"
12 #include "mojo/system/channel.h" 12 #include "mojo/system/channel.h"
13 #include "mojo/system/channel_endpoint.h"
13 #include "mojo/system/core.h" 14 #include "mojo/system/core.h"
14 #include "mojo/system/entrypoints.h" 15 #include "mojo/system/entrypoints.h"
15 #include "mojo/system/message_in_transit.h" 16 #include "mojo/system/message_in_transit.h"
16 #include "mojo/system/message_pipe.h" 17 #include "mojo/system/message_pipe.h"
17 #include "mojo/system/message_pipe_dispatcher.h" 18 #include "mojo/system/message_pipe_dispatcher.h"
18 #include "mojo/system/platform_handle_dispatcher.h" 19 #include "mojo/system/platform_handle_dispatcher.h"
19 #include "mojo/system/raw_channel.h" 20 #include "mojo/system/raw_channel.h"
20 21
21 namespace mojo { 22 namespace mojo {
22 namespace embedder { 23 namespace embedder {
(...skipping 28 matching lines...) Expand all
51 // This is very unusual (e.g., maybe |platform_handle| was invalid or we 52 // This is very unusual (e.g., maybe |platform_handle| was invalid or we
52 // reached some system resource limit). 53 // reached some system resource limit).
53 LOG(ERROR) << "Channel::Init() failed"; 54 LOG(ERROR) << "Channel::Init() failed";
54 // Return null, since |Shutdown()| shouldn't be called in this case. 55 // Return null, since |Shutdown()| shouldn't be called in this case.
55 return scoped_refptr<system::Channel>(); 56 return scoped_refptr<system::Channel>();
56 } 57 }
57 // Once |Init()| has succeeded, we have to return |channel| (since 58 // Once |Init()| has succeeded, we have to return |channel| (since
58 // |Shutdown()| will have to be called on it). 59 // |Shutdown()| will have to be called on it).
59 60
60 // Attach the message pipe endpoint. 61 // Attach the message pipe endpoint.
61 system::MessageInTransit::EndpointId endpoint_id = 62 system::MessageInTransit::EndpointId endpoint_id = channel->AttachEndpoint(
62 channel->AttachMessagePipeEndpoint(message_pipe, 1); 63 make_scoped_refptr(new system::ChannelEndpoint(message_pipe.get(), 1)));
63 if (endpoint_id == system::MessageInTransit::kInvalidEndpointId) { 64 if (endpoint_id == system::MessageInTransit::kInvalidEndpointId) {
64 // This means that, e.g., the other endpoint of the message pipe was closed 65 // This means that, e.g., the other endpoint of the message pipe was closed
65 // first. But it's not necessarily an error per se. 66 // first. But it's not necessarily an error per se.
66 DVLOG(2) << "Channel::AttachMessagePipeEndpoint() failed"; 67 DVLOG(2) << "Channel::AttachEndpoint() failed";
67 return channel; 68 return channel;
68 } 69 }
69 CHECK_EQ(endpoint_id, system::Channel::kBootstrapEndpointId); 70 CHECK_EQ(endpoint_id, system::Channel::kBootstrapEndpointId);
70 71
71 if (!channel->RunMessagePipeEndpoint(system::Channel::kBootstrapEndpointId, 72 if (!channel->RunMessagePipeEndpoint(system::Channel::kBootstrapEndpointId,
72 system::Channel::kBootstrapEndpointId)) { 73 system::Channel::kBootstrapEndpointId)) {
73 // Currently, there's no reason for this to fail. 74 // Currently, there's no reason for this to fail.
74 NOTREACHED() << "Channel::RunMessagePipeEndpoint() failed"; 75 NOTREACHED() << "Channel::RunMessagePipeEndpoint() failed";
75 return channel; 76 return channel;
76 } 77 }
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 232
232 *platform_handle = 233 *platform_handle =
233 static_cast<system::PlatformHandleDispatcher*>(dispatcher.get()) 234 static_cast<system::PlatformHandleDispatcher*>(dispatcher.get())
234 ->PassPlatformHandle() 235 ->PassPlatformHandle()
235 .Pass(); 236 .Pass();
236 return MOJO_RESULT_OK; 237 return MOJO_RESULT_OK;
237 } 238 }
238 239
239 } // namespace embedder 240 } // namespace embedder
240 } // namespace mojo 241 } // namespace mojo
OLDNEW
« no previous file with comments | « no previous file | mojo/system/channel.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698