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

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

Issue 223783006: Mojo: Make Channel take a RawChannel rather than creating it. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: spurious space Created 6 years, 8 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 | Annotate | Revision Log
« 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/system/channel.h" 11 #include "mojo/system/channel.h"
12 #include "mojo/system/core_impl.h" 12 #include "mojo/system/core_impl.h"
13 #include "mojo/system/message_pipe.h" 13 #include "mojo/system/message_pipe.h"
14 #include "mojo/system/message_pipe_dispatcher.h" 14 #include "mojo/system/message_pipe_dispatcher.h"
15 #include "mojo/system/raw_channel.h"
15 16
16 namespace mojo { 17 namespace mojo {
17 namespace embedder { 18 namespace embedder {
18 19
19 struct ChannelInfo { 20 struct ChannelInfo {
20 scoped_refptr<system::Channel> channel; 21 scoped_refptr<system::Channel> channel;
21 }; 22 };
22 23
23 static void CreateChannelOnIOThread( 24 static void CreateChannelOnIOThread(
24 ScopedPlatformHandle platform_handle, 25 ScopedPlatformHandle platform_handle,
25 scoped_refptr<system::MessagePipe> message_pipe, 26 scoped_refptr<system::MessagePipe> message_pipe,
26 DidCreateChannelCallback callback, 27 DidCreateChannelCallback callback,
27 scoped_refptr<base::TaskRunner> callback_thread_task_runner) { 28 scoped_refptr<base::TaskRunner> callback_thread_task_runner) {
28 CHECK(platform_handle.is_valid()); 29 CHECK(platform_handle.is_valid());
29 30
30 scoped_ptr<ChannelInfo> channel_info(new ChannelInfo); 31 scoped_ptr<ChannelInfo> channel_info(new ChannelInfo);
31 32
32 // Create and initialize a |system::Channel|. 33 // Create and initialize a |system::Channel|.
33 channel_info->channel = new system::Channel(); 34 channel_info->channel = new system::Channel();
34 bool success = channel_info->channel->Init(platform_handle.Pass()); 35 bool success = channel_info->channel->Init(
36 system::RawChannel::Create(platform_handle.Pass()));
35 DCHECK(success); 37 DCHECK(success);
36 38
37 // Attach the message pipe endpoint. 39 // Attach the message pipe endpoint.
38 system::MessageInTransit::EndpointId endpoint_id = 40 system::MessageInTransit::EndpointId endpoint_id =
39 channel_info->channel->AttachMessagePipeEndpoint(message_pipe, 1); 41 channel_info->channel->AttachMessagePipeEndpoint(message_pipe, 1);
40 DCHECK_EQ(endpoint_id, system::Channel::kBootstrapEndpointId); 42 DCHECK_EQ(endpoint_id, system::Channel::kBootstrapEndpointId);
41 channel_info->channel->RunMessagePipeEndpoint( 43 channel_info->channel->RunMessagePipeEndpoint(
42 system::Channel::kBootstrapEndpointId, 44 system::Channel::kBootstrapEndpointId,
43 system::Channel::kBootstrapEndpointId); 45 system::Channel::kBootstrapEndpointId);
44 46
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 87
86 void DestroyChannelOnIOThread(ChannelInfo* channel_info) { 88 void DestroyChannelOnIOThread(ChannelInfo* channel_info) {
87 DCHECK(channel_info); 89 DCHECK(channel_info);
88 DCHECK(channel_info->channel.get()); 90 DCHECK(channel_info->channel.get());
89 channel_info->channel->Shutdown(); 91 channel_info->channel->Shutdown();
90 delete channel_info; 92 delete channel_info;
91 } 93 }
92 94
93 } // namespace embedder 95 } // namespace embedder
94 } // namespace mojo 96 } // 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