OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/browser/utility_process_host_impl.h" | 5 #include "content/browser/utility_process_host_impl.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/base_switches.h" | 9 #include "base/base_switches.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
367 return true; | 367 return true; |
368 } | 368 } |
369 | 369 |
370 void UtilityProcessHostImpl::OnProcessLaunchFailed(int error_code) { | 370 void UtilityProcessHostImpl::OnProcessLaunchFailed(int error_code) { |
371 if (!client_.get()) | 371 if (!client_.get()) |
372 return; | 372 return; |
373 | 373 |
374 client_task_runner_->PostTask( | 374 client_task_runner_->PostTask( |
375 FROM_HERE, | 375 FROM_HERE, |
376 base::Bind(&UtilityProcessHostClient::OnProcessLaunchFailed, | 376 base::Bind(&UtilityProcessHostClient::OnProcessLaunchFailed, |
377 client_.get(), | 377 client_, |
378 error_code)); | 378 error_code)); |
379 } | 379 } |
380 | 380 |
381 void UtilityProcessHostImpl::OnProcessCrashed(int exit_code) { | 381 void UtilityProcessHostImpl::OnProcessCrashed(int exit_code) { |
382 if (!client_.get()) | 382 if (!client_.get()) |
383 return; | 383 return; |
384 | 384 |
385 client_task_runner_->PostTask( | 385 client_task_runner_->PostTask( |
386 FROM_HERE, | 386 FROM_HERE, |
387 base::Bind(&UtilityProcessHostClient::OnProcessCrashed, client_.get(), | 387 base::Bind(&UtilityProcessHostClient::OnProcessCrashed, client_, |
388 exit_code)); | 388 exit_code)); |
389 } | 389 } |
390 | 390 |
391 void UtilityProcessHostImpl::NotifyAndDelete(int error_code) { | 391 void UtilityProcessHostImpl::NotifyAndDelete(int error_code) { |
392 BrowserThread::PostTask( | 392 BrowserThread::PostTask( |
393 BrowserThread::IO, FROM_HERE, | 393 BrowserThread::IO, FROM_HERE, |
394 base::Bind(&UtilityProcessHostImpl::NotifyLaunchFailedAndDelete, | 394 base::Bind(&UtilityProcessHostImpl::NotifyLaunchFailedAndDelete, |
395 weak_ptr_factory_.GetWeakPtr(), | 395 weak_ptr_factory_.GetWeakPtr(), |
396 error_code)); | 396 error_code)); |
397 } | 397 } |
398 | 398 |
399 // static | 399 // static |
400 void UtilityProcessHostImpl::NotifyLaunchFailedAndDelete( | 400 void UtilityProcessHostImpl::NotifyLaunchFailedAndDelete( |
401 base::WeakPtr<UtilityProcessHostImpl> host, | 401 base::WeakPtr<UtilityProcessHostImpl> host, |
402 int error_code) { | 402 int error_code) { |
403 if (!host) | 403 if (!host) |
404 return; | 404 return; |
405 | 405 |
406 host->OnProcessLaunchFailed(error_code); | 406 host->OnProcessLaunchFailed(error_code); |
407 delete host.get(); | 407 delete host.get(); |
408 } | 408 } |
409 | 409 |
410 } // namespace content | 410 } // namespace content |
OLD | NEW |