| 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 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 | 217 |
| 218 on_app_complete_ = on_app_complete; | 218 on_app_complete_ = on_app_complete; |
| 219 unblocker_.Unblock(base::Bind(&AppChildControllerImpl::StartAppOnMainThread, | 219 unblocker_.Unblock(base::Bind(&AppChildControllerImpl::StartAppOnMainThread, |
| 220 base::FilePath::FromUTF8Unsafe(app_path), | 220 base::FilePath::FromUTF8Unsafe(app_path), |
| 221 clean_app_path | 221 clean_app_path |
| 222 ? NativeApplicationCleanup::DELETE | 222 ? NativeApplicationCleanup::DELETE |
| 223 : NativeApplicationCleanup::DONT_DELETE, | 223 : NativeApplicationCleanup::DONT_DELETE, |
| 224 base::Passed(&application_request))); | 224 base::Passed(&application_request))); |
| 225 } | 225 } |
| 226 | 226 |
| 227 void ExitNow(int32_t exit_code) override { |
| 228 DVLOG(2) << "AppChildControllerImpl::ExitNow(" << exit_code << ")"; |
| 229 _exit(exit_code); |
| 230 } |
| 231 |
| 227 private: | 232 private: |
| 228 AppChildControllerImpl(AppContext* app_context, | 233 AppChildControllerImpl(AppContext* app_context, |
| 229 const Blocker::Unblocker& unblocker) | 234 const Blocker::Unblocker& unblocker) |
| 230 : app_context_(app_context), | 235 : app_context_(app_context), |
| 231 unblocker_(unblocker), | 236 unblocker_(unblocker), |
| 232 channel_info_(nullptr), | 237 channel_info_(nullptr), |
| 233 binding_(this) { | 238 binding_(this) { |
| 234 binding_.set_error_handler(this); | 239 binding_.set_error_handler(this); |
| 235 } | 240 } |
| 236 | 241 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 | 277 |
| 273 AppChildProcess::AppChildProcess() { | 278 AppChildProcess::AppChildProcess() { |
| 274 } | 279 } |
| 275 | 280 |
| 276 AppChildProcess::~AppChildProcess() { | 281 AppChildProcess::~AppChildProcess() { |
| 277 } | 282 } |
| 278 | 283 |
| 279 void AppChildProcess::Main() { | 284 void AppChildProcess::Main() { |
| 280 DVLOG(2) << "AppChildProcess::Main()"; | 285 DVLOG(2) << "AppChildProcess::Main()"; |
| 281 | 286 |
| 287 DCHECK(!base::MessageLoop::current()); |
| 288 |
| 282 AppContext app_context; | 289 AppContext app_context; |
| 283 app_context.Init(); | 290 app_context.Init(); |
| 284 | 291 |
| 285 Blocker blocker; | 292 Blocker blocker; |
| 286 app_context.controller_runner()->PostTask( | 293 app_context.controller_runner()->PostTask( |
| 287 FROM_HERE, | 294 FROM_HERE, |
| 288 base::Bind(&AppChildControllerImpl::Init, base::Unretained(&app_context), | 295 base::Bind(&AppChildControllerImpl::Init, base::Unretained(&app_context), |
| 289 base::Passed(platform_channel()), blocker.GetUnblocker())); | 296 base::Passed(platform_channel()), blocker.GetUnblocker())); |
| 290 // This will block, then run whatever the controller wants. | 297 // This will block, then run whatever the controller wants. |
| 291 blocker.Block(); | 298 blocker.Block(); |
| 292 | 299 |
| 293 app_context.Shutdown(); | 300 app_context.Shutdown(); |
| 294 } | 301 } |
| 295 | 302 |
| 296 } // namespace shell | 303 } // namespace shell |
| 297 } // namespace mojo | 304 } // namespace mojo |
| OLD | NEW |