Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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/child_process_launcher.h" | 5 #include "content/browser/child_process_launcher.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
| 10 #include "base/i18n/icu_util.h" | 10 #include "base/i18n/icu_util.h" |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 64 static bool done_first_launch = false; | 64 static bool done_first_launch = false; |
| 65 if (done_first_launch) { | 65 if (done_first_launch) { |
| 66 UMA_HISTOGRAM_TIMES("MPArch.ChildProcessLaunchSubsequent", launch_time); | 66 UMA_HISTOGRAM_TIMES("MPArch.ChildProcessLaunchSubsequent", launch_time); |
| 67 } else { | 67 } else { |
| 68 UMA_HISTOGRAM_TIMES("MPArch.ChildProcessLaunchFirst", launch_time); | 68 UMA_HISTOGRAM_TIMES("MPArch.ChildProcessLaunchFirst", launch_time); |
| 69 done_first_launch = true; | 69 done_first_launch = true; |
| 70 } | 70 } |
| 71 } | 71 } |
| 72 | 72 |
| 73 #if defined(OS_ANDROID) | 73 #if defined(OS_ANDROID) |
| 74 // TODO(sievers): Remove this by defining better what happens on what | 74 // TODO(sievers): Remove this by defining better what happens on what |
|
Yaron
2015/09/16 01:20:16
Remove TODO
Jaekyun Seok (inactive)
2015/09/16 01:46:48
Done.
| |
| 75 // thread in the corresponding Java code. | 75 // thread in the corresponding Java code. |
| 76 void OnChildProcessStartedAndroid(const NotifyCallback& callback, | 76 void OnChildProcessStartedAndroid(const NotifyCallback& callback, |
| 77 BrowserThread::ID client_thread_id, | 77 BrowserThread::ID client_thread_id, |
| 78 const base::TimeTicks begin_launch_time, | 78 const base::TimeTicks begin_launch_time, |
| 79 base::ScopedFD ipcfd, | 79 base::ScopedFD ipcfd, |
| 80 base::ProcessHandle handle) { | 80 base::ProcessHandle handle) { |
| 81 // This can be called on the launcher thread or UI thread. | 81 // This will be called on the launcher thread. |
| 82 base::TimeDelta launch_time = base::TimeTicks::Now() - begin_launch_time; | 82 base::TimeDelta launch_time = base::TimeTicks::Now() - begin_launch_time; |
| 83 BrowserThread::PostTask( | 83 RecordHistogramsOnLauncherThread(launch_time); |
| 84 BrowserThread::PROCESS_LAUNCHER, FROM_HERE, | |
| 85 base::Bind(&RecordHistogramsOnLauncherThread, launch_time)); | |
| 86 | 84 |
| 87 base::Closure callback_on_client_thread( | 85 base::Closure callback_on_client_thread( |
| 88 base::Bind(callback, false, base::Passed(&ipcfd), | 86 base::Bind(callback, false, base::Passed(&ipcfd), |
| 89 base::Passed(base::Process(handle)))); | 87 base::Passed(base::Process(handle)))); |
| 90 if (BrowserThread::CurrentlyOn(client_thread_id)) { | 88 if (BrowserThread::CurrentlyOn(client_thread_id)) { |
| 91 callback_on_client_thread.Run(); | 89 callback_on_client_thread.Run(); |
| 92 } else { | 90 } else { |
| 93 BrowserThread::PostTask( | 91 BrowserThread::PostTask( |
| 94 client_thread_id, FROM_HERE, callback_on_client_thread); | 92 client_thread_id, FROM_HERE, callback_on_client_thread); |
| 95 } | 93 } |
| (...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 545 } | 543 } |
| 546 | 544 |
| 547 ChildProcessLauncher::Client* ChildProcessLauncher::ReplaceClientForTest( | 545 ChildProcessLauncher::Client* ChildProcessLauncher::ReplaceClientForTest( |
| 548 Client* client) { | 546 Client* client) { |
| 549 Client* ret = client_; | 547 Client* ret = client_; |
| 550 client_ = client; | 548 client_ = client; |
| 551 return ret; | 549 return ret; |
| 552 } | 550 } |
| 553 | 551 |
| 554 } // namespace content | 552 } // namespace content |
| OLD | NEW |