| 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 "shell/app_child_process.h" | 5 #include "shell/app_child_process.h" |
| 6 | 6 |
| 7 #include <unistd.h> | 7 #include <unistd.h> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 | 77 |
| 78 // AppContext ------------------------------------------------------------------ | 78 // AppContext ------------------------------------------------------------------ |
| 79 | 79 |
| 80 class AppChildControllerImpl; | 80 class AppChildControllerImpl; |
| 81 | 81 |
| 82 // Should be created and initialized on the main thread. | 82 // Should be created and initialized on the main thread. |
| 83 class AppContext : public embedder::ProcessDelegate { | 83 class AppContext : public embedder::ProcessDelegate { |
| 84 public: | 84 public: |
| 85 AppContext() | 85 AppContext() |
| 86 : io_thread_("io_thread"), controller_thread_("controller_thread") {} | 86 : io_thread_("io_thread"), controller_thread_("controller_thread") {} |
| 87 ~AppContext() {} | 87 ~AppContext() override {} |
| 88 | 88 |
| 89 void Init() { | 89 void Init() { |
| 90 // Initialize Mojo before starting any threads. | 90 // Initialize Mojo before starting any threads. |
| 91 embedder::Init(make_scoped_ptr(new embedder::SimplePlatformSupport())); | 91 embedder::Init(make_scoped_ptr(new embedder::SimplePlatformSupport())); |
| 92 | 92 |
| 93 // Create and start our I/O thread. | 93 // Create and start our I/O thread. |
| 94 base::Thread::Options io_thread_options(base::MessageLoop::TYPE_IO, 0); | 94 base::Thread::Options io_thread_options(base::MessageLoop::TYPE_IO, 0); |
| 95 CHECK(io_thread_.StartWithOptions(io_thread_options)); | 95 CHECK(io_thread_.StartWithOptions(io_thread_options)); |
| 96 io_runner_ = io_thread_.message_loop_proxy().get(); | 96 io_runner_ = io_thread_.message_loop_proxy().get(); |
| 97 CHECK(io_runner_.get()); | 97 CHECK(io_runner_.get()); |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 base::Bind(&AppChildControllerImpl::Init, base::Unretained(&app_context), | 288 base::Bind(&AppChildControllerImpl::Init, base::Unretained(&app_context), |
| 289 base::Passed(platform_channel()), blocker.GetUnblocker())); | 289 base::Passed(platform_channel()), blocker.GetUnblocker())); |
| 290 // This will block, then run whatever the controller wants. | 290 // This will block, then run whatever the controller wants. |
| 291 blocker.Block(); | 291 blocker.Block(); |
| 292 | 292 |
| 293 app_context.Shutdown(); | 293 app_context.Shutdown(); |
| 294 } | 294 } |
| 295 | 295 |
| 296 } // namespace shell | 296 } // namespace shell |
| 297 } // namespace mojo | 297 } // namespace mojo |
| OLD | NEW |