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

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

Issue 898423002: Fix mojo::embedder::CreateChannel(). (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 10 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 | no next file » | 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/edk/embedder/embedder.h" 5 #include "mojo/edk/embedder/embedder.h"
6 6
7 #include "base/atomicops.h" 7 #include "base/atomicops.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/location.h" 9 #include "base/location.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 120
121 ScopedMessagePipeHandle CreateChannel( 121 ScopedMessagePipeHandle CreateChannel(
122 ScopedPlatformHandle platform_handle, 122 ScopedPlatformHandle platform_handle,
123 scoped_refptr<base::TaskRunner> io_thread_task_runner, 123 scoped_refptr<base::TaskRunner> io_thread_task_runner,
124 DidCreateChannelCallback callback, 124 DidCreateChannelCallback callback,
125 scoped_refptr<base::TaskRunner> callback_thread_task_runner) { 125 scoped_refptr<base::TaskRunner> callback_thread_task_runner) {
126 DCHECK(platform_handle.is_valid()); 126 DCHECK(platform_handle.is_valid());
127 DCHECK(io_thread_task_runner); 127 DCHECK(io_thread_task_runner);
128 DCHECK(!callback.is_null()); 128 DCHECK(!callback.is_null());
129 129
130 scoped_ptr<ChannelInfo> channel_info(new ChannelInfo(MakeChannelId())); 130 system::ChannelId channel_id = MakeChannelId();
131 scoped_ptr<ChannelInfo> channel_info(new ChannelInfo(channel_id));
131 scoped_refptr<system::MessagePipeDispatcher> dispatcher = 132 scoped_refptr<system::MessagePipeDispatcher> dispatcher =
132 internal::g_channel_manager->CreateChannel( 133 internal::g_channel_manager->CreateChannel(
133 channel_info->channel_id, platform_handle.Pass(), 134 channel_id, platform_handle.Pass(), io_thread_task_runner,
134 io_thread_task_runner,
135 base::Bind(callback, base::Unretained(channel_info.release())), 135 base::Bind(callback, base::Unretained(channel_info.release())),
136 callback_thread_task_runner); 136 callback_thread_task_runner);
137 137
138 ScopedMessagePipeHandle rv( 138 ScopedMessagePipeHandle rv(
139 MessagePipeHandle(internal::g_core->AddDispatcher(dispatcher))); 139 MessagePipeHandle(internal::g_core->AddDispatcher(dispatcher)));
140 CHECK(rv.is_valid()); 140 CHECK(rv.is_valid());
141 return rv; 141 return rv;
142 } 142 }
143 143
144 // TODO(vtl): Write tests for this. 144 // TODO(vtl): Write tests for this.
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 } 199 }
200 200
201 MojoResult AsyncWait(MojoHandle handle, 201 MojoResult AsyncWait(MojoHandle handle,
202 MojoHandleSignals signals, 202 MojoHandleSignals signals,
203 base::Callback<void(MojoResult)> callback) { 203 base::Callback<void(MojoResult)> callback) {
204 return internal::g_core->AsyncWait(handle, signals, callback); 204 return internal::g_core->AsyncWait(handle, signals, callback);
205 } 205 }
206 206
207 } // namespace embedder 207 } // namespace embedder
208 } // namespace mojo 208 } // namespace mojo
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698