| 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/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
| 10 #include "base/location.h" | 10 #include "base/location.h" |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/memory/scoped_ptr.h" | |
| 13 #include "base/task_runner.h" | 12 #include "base/task_runner.h" |
| 14 #include "mojo/edk/embedder/embedder_internal.h" | 13 #include "mojo/edk/embedder/embedder_internal.h" |
| 15 #include "mojo/edk/embedder/master_process_delegate.h" | 14 #include "mojo/edk/embedder/master_process_delegate.h" |
| 16 #include "mojo/edk/embedder/platform_support.h" | 15 #include "mojo/edk/embedder/platform_support.h" |
| 17 #include "mojo/edk/embedder/process_delegate.h" | 16 #include "mojo/edk/embedder/process_delegate.h" |
| 18 #include "mojo/edk/embedder/slave_process_delegate.h" | 17 #include "mojo/edk/embedder/slave_process_delegate.h" |
| 19 #include "mojo/edk/system/channel.h" | 18 #include "mojo/edk/system/channel.h" |
| 20 #include "mojo/edk/system/channel_manager.h" | 19 #include "mojo/edk/system/channel_manager.h" |
| 21 #include "mojo/edk/system/configuration.h" | 20 #include "mojo/edk/system/configuration.h" |
| 22 #include "mojo/edk/system/core.h" | 21 #include "mojo/edk/system/core.h" |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 base::Unretained(process_delegate))); | 74 base::Unretained(process_delegate))); |
| 76 DCHECK(ok); | 75 DCHECK(ok); |
| 77 } | 76 } |
| 78 | 77 |
| 79 } // namespace | 78 } // namespace |
| 80 | 79 |
| 81 Configuration* GetConfiguration() { | 80 Configuration* GetConfiguration() { |
| 82 return system::GetMutableConfiguration(); | 81 return system::GetMutableConfiguration(); |
| 83 } | 82 } |
| 84 | 83 |
| 85 void Init(scoped_ptr<PlatformSupport> platform_support) { | 84 void Init(std::unique_ptr<PlatformSupport> platform_support) { |
| 86 DCHECK(platform_support); | 85 DCHECK(platform_support); |
| 87 | 86 |
| 88 DCHECK(!internal::g_platform_support); | 87 DCHECK(!internal::g_platform_support); |
| 89 internal::g_platform_support = platform_support.release(); | 88 internal::g_platform_support = platform_support.release(); |
| 90 | 89 |
| 91 DCHECK(!internal::g_core); | 90 DCHECK(!internal::g_core); |
| 92 internal::g_core = new system::Core(internal::g_platform_support); | 91 internal::g_core = new system::Core(internal::g_platform_support); |
| 93 } | 92 } |
| 94 | 93 |
| 95 MojoResult AsyncWait(MojoHandle handle, | 94 MojoResult AsyncWait(MojoHandle handle, |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 const base::Callback<void(ChannelInfo*)>& did_create_channel_callback, | 256 const base::Callback<void(ChannelInfo*)>& did_create_channel_callback, |
| 258 scoped_refptr<base::TaskRunner> did_create_channel_runner) { | 257 scoped_refptr<base::TaskRunner> did_create_channel_runner) { |
| 259 DCHECK(platform_handle.is_valid()); | 258 DCHECK(platform_handle.is_valid()); |
| 260 DCHECK(!did_create_channel_callback.is_null()); | 259 DCHECK(!did_create_channel_callback.is_null()); |
| 261 DCHECK(internal::g_ipc_support); | 260 DCHECK(internal::g_ipc_support); |
| 262 | 261 |
| 263 system::ChannelManager* channel_manager = | 262 system::ChannelManager* channel_manager = |
| 264 internal::g_ipc_support->channel_manager(); | 263 internal::g_ipc_support->channel_manager(); |
| 265 | 264 |
| 266 system::ChannelId channel_id = MakeChannelId(); | 265 system::ChannelId channel_id = MakeChannelId(); |
| 267 scoped_ptr<ChannelInfo> channel_info(new ChannelInfo(channel_id)); | 266 std::unique_ptr<ChannelInfo> channel_info(new ChannelInfo(channel_id)); |
| 268 scoped_refptr<system::MessagePipeDispatcher> dispatcher = | 267 scoped_refptr<system::MessagePipeDispatcher> dispatcher = |
| 269 channel_manager->CreateChannel( | 268 channel_manager->CreateChannel( |
| 270 channel_id, platform_handle.Pass(), | 269 channel_id, platform_handle.Pass(), |
| 271 base::Bind(did_create_channel_callback, | 270 base::Bind(did_create_channel_callback, |
| 272 base::Unretained(channel_info.release())), | 271 base::Unretained(channel_info.release())), |
| 273 did_create_channel_runner); | 272 did_create_channel_runner); |
| 274 | 273 |
| 275 ScopedMessagePipeHandle rv( | 274 ScopedMessagePipeHandle rv( |
| 276 MessagePipeHandle(internal::g_core->AddDispatcher(dispatcher))); | 275 MessagePipeHandle(internal::g_core->AddDispatcher(dispatcher))); |
| 277 CHECK(rv.is_valid()); | 276 CHECK(rv.is_valid()); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 314 DCHECK(channel_info); | 313 DCHECK(channel_info); |
| 315 DCHECK(internal::g_ipc_support); | 314 DCHECK(internal::g_ipc_support); |
| 316 | 315 |
| 317 system::ChannelManager* channel_manager = | 316 system::ChannelManager* channel_manager = |
| 318 internal::g_ipc_support->channel_manager(); | 317 internal::g_ipc_support->channel_manager(); |
| 319 channel_manager->WillShutdownChannel(channel_info->channel_id); | 318 channel_manager->WillShutdownChannel(channel_info->channel_id); |
| 320 } | 319 } |
| 321 | 320 |
| 322 } // namespace embedder | 321 } // namespace embedder |
| 323 } // namespace mojo | 322 } // namespace mojo |
| OLD | NEW |