Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(244)

Side by Side Diff: content/browser/child_process_launcher.cc

Issue 1307793003: Execute operations of ChildProcessLauncher on launcher thread (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Apply Yaron's comments Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 static bool done_first_launch = false; 63 static bool done_first_launch = false;
64 if (done_first_launch) { 64 if (done_first_launch) {
65 UMA_HISTOGRAM_TIMES("MPArch.ChildProcessLaunchSubsequent", launch_time); 65 UMA_HISTOGRAM_TIMES("MPArch.ChildProcessLaunchSubsequent", launch_time);
66 } else { 66 } else {
67 UMA_HISTOGRAM_TIMES("MPArch.ChildProcessLaunchFirst", launch_time); 67 UMA_HISTOGRAM_TIMES("MPArch.ChildProcessLaunchFirst", launch_time);
68 done_first_launch = true; 68 done_first_launch = true;
69 } 69 }
70 } 70 }
71 71
72 #if defined(OS_ANDROID) 72 #if defined(OS_ANDROID)
73 // TODO(sievers): Remove this by defining better what happens on what
74 // thread in the corresponding Java code.
75 void OnChildProcessStartedAndroid(const NotifyCallback& callback, 73 void OnChildProcessStartedAndroid(const NotifyCallback& callback,
76 BrowserThread::ID client_thread_id, 74 BrowserThread::ID client_thread_id,
77 const base::TimeTicks begin_launch_time, 75 const base::TimeTicks begin_launch_time,
78 base::ScopedFD ipcfd, 76 base::ScopedFD ipcfd,
79 base::ProcessHandle handle) { 77 base::ProcessHandle handle) {
80 // This can be called on the launcher thread or UI thread. 78 // This will be called on the launcher thread.
81 base::TimeDelta launch_time = base::TimeTicks::Now() - begin_launch_time; 79 base::TimeDelta launch_time = base::TimeTicks::Now() - begin_launch_time;
82 BrowserThread::PostTask( 80 RecordHistogramsOnLauncherThread(launch_time);
83 BrowserThread::PROCESS_LAUNCHER, FROM_HERE,
84 base::Bind(&RecordHistogramsOnLauncherThread, launch_time));
85 81
86 base::Closure callback_on_client_thread( 82 base::Closure callback_on_client_thread(
87 base::Bind(callback, false, base::Passed(&ipcfd), 83 base::Bind(callback, false, base::Passed(&ipcfd),
88 base::Passed(base::Process(handle)))); 84 base::Passed(base::Process(handle))));
89 if (BrowserThread::CurrentlyOn(client_thread_id)) { 85 if (BrowserThread::CurrentlyOn(client_thread_id)) {
90 callback_on_client_thread.Run(); 86 callback_on_client_thread.Run();
91 } else { 87 } else {
92 BrowserThread::PostTask( 88 BrowserThread::PostTask(
93 client_thread_id, FROM_HERE, callback_on_client_thread); 89 client_thread_id, FROM_HERE, callback_on_client_thread);
94 } 90 }
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after
544 } 540 }
545 541
546 ChildProcessLauncher::Client* ChildProcessLauncher::ReplaceClientForTest( 542 ChildProcessLauncher::Client* ChildProcessLauncher::ReplaceClientForTest(
547 Client* client) { 543 Client* client) {
548 Client* ret = client_; 544 Client* ret = client_;
549 client_ = client; 545 client_ = client;
550 return ret; 546 return ret;
551 } 547 }
552 548
553 } // namespace content 549 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698