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 26 matching lines...) Expand all Loading... |
37 scoped_refptr<system::Channel> channel = | 37 scoped_refptr<system::Channel> channel = |
38 new system::Channel(internal::g_core->platform_support()); | 38 new system::Channel(internal::g_core->platform_support()); |
39 if (!channel->Init(system::RawChannel::Create(platform_handle.Pass()))) { | 39 if (!channel->Init(system::RawChannel::Create(platform_handle.Pass()))) { |
40 // This is very unusual (e.g., maybe |platform_handle| was invalid or we | 40 // This is very unusual (e.g., maybe |platform_handle| was invalid or we |
41 // reached some system resource limit). | 41 // reached some system resource limit). |
42 LOG(ERROR) << "Channel::Init() failed"; | 42 LOG(ERROR) << "Channel::Init() failed"; |
43 // Return null, since |Shutdown()| shouldn't be called in this case. | 43 // Return null, since |Shutdown()| shouldn't be called in this case. |
44 return 0; | 44 return 0; |
45 } | 45 } |
46 | 46 |
47 channel->AttachAndRunEndpoint(channel_endpoint, true); | 47 channel->SetBootstrapEndpoint(channel_endpoint); |
48 | 48 |
49 DCHECK(internal::g_channel_manager); | 49 DCHECK(internal::g_channel_manager); |
50 return internal::g_channel_manager->AddChannel( | 50 return internal::g_channel_manager->AddChannel( |
51 channel, base::MessageLoopProxy::current()); | 51 channel, base::MessageLoopProxy::current()); |
52 } | 52 } |
53 | 53 |
54 // Helper for |CreateChannel()|. Called on the channel creation thread. | 54 // Helper for |CreateChannel()|. Called on the channel creation thread. |
55 void CreateChannelHelper( | 55 void CreateChannelHelper( |
56 ScopedPlatformHandle platform_handle, | 56 ScopedPlatformHandle platform_handle, |
57 scoped_ptr<ChannelInfo> channel_info, | 57 scoped_ptr<ChannelInfo> channel_info, |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 | 203 |
204 *platform_handle = | 204 *platform_handle = |
205 static_cast<system::PlatformHandleDispatcher*>(dispatcher.get()) | 205 static_cast<system::PlatformHandleDispatcher*>(dispatcher.get()) |
206 ->PassPlatformHandle() | 206 ->PassPlatformHandle() |
207 .Pass(); | 207 .Pass(); |
208 return MOJO_RESULT_OK; | 208 return MOJO_RESULT_OK; |
209 } | 209 } |
210 | 210 |
211 } // namespace embedder | 211 } // namespace embedder |
212 } // namespace mojo | 212 } // namespace mojo |
OLD | NEW |