OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |