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/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" |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 | 119 |
120 DCHECK(internal::g_core); | 120 DCHECK(internal::g_core); |
121 ScopedMessagePipeHandle rv( | 121 ScopedMessagePipeHandle rv( |
122 MessagePipeHandle(internal::g_core->AddDispatcher(dispatcher))); | 122 MessagePipeHandle(internal::g_core->AddDispatcher(dispatcher))); |
123 | 123 |
124 scoped_ptr<ChannelInfo> channel_info(new ChannelInfo()); | 124 scoped_ptr<ChannelInfo> channel_info(new ChannelInfo()); |
125 // We'll have to set |channel_info->channel| on the I/O thread. | 125 // We'll have to set |channel_info->channel| on the I/O thread. |
126 channel_info->channel_thread_task_runner = io_thread_task_runner; | 126 channel_info->channel_thread_task_runner = io_thread_task_runner; |
127 | 127 |
128 if (rv.is_valid()) { | 128 if (rv.is_valid()) { |
129 io_thread_task_runner->PostTask(FROM_HERE, | 129 io_thread_task_runner->PostTask( |
130 base::Bind(&CreateChannelHelper, | 130 FROM_HERE, |
131 base::Passed(&platform_handle), | 131 base::Bind(&CreateChannelHelper, base::Passed(&platform_handle), |
132 base::Passed(&channel_info), | 132 base::Passed(&channel_info), channel_endpoint, callback, |
133 channel_endpoint, | 133 callback_thread_task_runner)); |
134 callback, | |
135 callback_thread_task_runner)); | |
136 } else { | 134 } else { |
137 (callback_thread_task_runner.get() ? callback_thread_task_runner | 135 (callback_thread_task_runner.get() ? callback_thread_task_runner |
138 : io_thread_task_runner) | 136 : io_thread_task_runner) |
139 ->PostTask(FROM_HERE, base::Bind(callback, channel_info.release())); | 137 ->PostTask(FROM_HERE, base::Bind(callback, channel_info.release())); |
140 } | 138 } |
141 | 139 |
142 return rv.Pass(); | 140 return rv.Pass(); |
143 } | 141 } |
144 | 142 |
145 void DestroyChannelOnIOThread(ChannelInfo* channel_info) { | 143 void DestroyChannelOnIOThread(ChannelInfo* channel_info) { |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 | 206 |
209 *platform_handle = | 207 *platform_handle = |
210 static_cast<system::PlatformHandleDispatcher*>(dispatcher.get()) | 208 static_cast<system::PlatformHandleDispatcher*>(dispatcher.get()) |
211 ->PassPlatformHandle() | 209 ->PassPlatformHandle() |
212 .Pass(); | 210 .Pass(); |
213 return MOJO_RESULT_OK; | 211 return MOJO_RESULT_OK; |
214 } | 212 } |
215 | 213 |
216 } // namespace embedder | 214 } // namespace embedder |
217 } // namespace mojo | 215 } // namespace mojo |
OLD | NEW |