| 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 <unistd.h> | 5 #include <unistd.h> |
| 6 | 6 |
| 7 #include "base/at_exit.h" | 7 #include "base/at_exit.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/callback_helpers.h" | 9 #include "base/callback_helpers.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| 11 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
| 12 #include "base/location.h" | 12 #include "base/location.h" |
| 13 #include "base/logging.h" | 13 #include "base/logging.h" |
| 14 #include "base/macros.h" | 14 #include "base/macros.h" |
| 15 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
| 16 #include "base/memory/scoped_ptr.h" | 16 #include "base/memory/scoped_ptr.h" |
| 17 #include "base/message_loop/message_loop.h" | 17 #include "base/message_loop/message_loop.h" |
| 18 #include "base/single_thread_task_runner.h" | 18 #include "base/single_thread_task_runner.h" |
| 19 #include "base/synchronization/waitable_event.h" | 19 #include "base/synchronization/waitable_event.h" |
| 20 #include "base/thread_task_runner_handle.h" |
| 20 #include "base/threading/thread.h" | 21 #include "base/threading/thread.h" |
| 21 #include "base/threading/thread_checker.h" | 22 #include "base/threading/thread_checker.h" |
| 22 #include "mojo/common/message_pump_mojo.h" | 23 #include "mojo/common/message_pump_mojo.h" |
| 23 #include "mojo/edk/embedder/embedder.h" | 24 #include "mojo/edk/embedder/embedder.h" |
| 24 #include "mojo/edk/embedder/platform_channel_pair.h" | 25 #include "mojo/edk/embedder/platform_channel_pair.h" |
| 25 #include "mojo/edk/embedder/scoped_platform_handle.h" | 26 #include "mojo/edk/embedder/scoped_platform_handle.h" |
| 26 #include "mojo/edk/embedder/simple_platform_support.h" | 27 #include "mojo/edk/embedder/simple_platform_support.h" |
| 27 #include "mojo/edk/embedder/slave_process_delegate.h" | 28 #include "mojo/edk/embedder/slave_process_delegate.h" |
| 28 #include "mojo/public/cpp/system/core.h" | 29 #include "mojo/public/cpp/system/core.h" |
| 29 #include "shell/child_controller.mojom.h" | 30 #include "shell/child_controller.mojom.h" |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 DCHECK(!app_context->controller()); | 194 DCHECK(!app_context->controller()); |
| 194 | 195 |
| 195 scoped_ptr<ChildControllerImpl> impl( | 196 scoped_ptr<ChildControllerImpl> impl( |
| 196 new ChildControllerImpl(app_context, unblocker)); | 197 new ChildControllerImpl(app_context, unblocker)); |
| 197 | 198 |
| 198 mojo::ScopedMessagePipeHandle host_message_pipe( | 199 mojo::ScopedMessagePipeHandle host_message_pipe( |
| 199 mojo::embedder::CreateChannel( | 200 mojo::embedder::CreateChannel( |
| 200 platform_channel.Pass(), | 201 platform_channel.Pass(), |
| 201 base::Bind(&ChildControllerImpl::DidCreateChannel, | 202 base::Bind(&ChildControllerImpl::DidCreateChannel, |
| 202 base::Unretained(impl.get())), | 203 base::Unretained(impl.get())), |
| 203 base::MessageLoopProxy::current())); | 204 base::ThreadTaskRunnerHandle::Get())); |
| 204 | 205 |
| 205 impl->Bind(host_message_pipe.Pass()); | 206 impl->Bind(host_message_pipe.Pass()); |
| 206 | 207 |
| 207 app_context->set_controller(impl.Pass()); | 208 app_context->set_controller(impl.Pass()); |
| 208 } | 209 } |
| 209 | 210 |
| 210 void Bind(mojo::ScopedMessagePipeHandle handle) { | 211 void Bind(mojo::ScopedMessagePipeHandle handle) { |
| 211 binding_.Bind(handle.Pass()); | 212 binding_.Bind(handle.Pass()); |
| 212 } | 213 } |
| 213 | 214 |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 313 base::Bind(&shell::ChildControllerImpl::Init, | 314 base::Bind(&shell::ChildControllerImpl::Init, |
| 314 base::Unretained(&app_context), | 315 base::Unretained(&app_context), |
| 315 base::Passed(&platform_channel), blocker.GetUnblocker())); | 316 base::Passed(&platform_channel), blocker.GetUnblocker())); |
| 316 // This will block, then run whatever the controller wants. | 317 // This will block, then run whatever the controller wants. |
| 317 blocker.Block(); | 318 blocker.Block(); |
| 318 | 319 |
| 319 app_context.Shutdown(); | 320 app_context.Shutdown(); |
| 320 | 321 |
| 321 return 0; | 322 return 0; |
| 322 } | 323 } |
| OLD | NEW |