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

Side by Side Diff: chrome/common/child_process_host.cc

Issue 403018: linux: use /proc/self/exe when exec'ing ourselves (Closed)
Patch Set: fixed test Created 11 years, 1 month 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
« no previous file with comments | « no previous file | chrome/common/chrome_constants.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 "chrome/common/child_process_host.h" 5 #include "chrome/common/child_process_host.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/file_path.h" 9 #include "base/file_path.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 86
87 // static 87 // static
88 FilePath ChildProcessHost::GetChildPath() { 88 FilePath ChildProcessHost::GetChildPath() {
89 FilePath child_path; 89 FilePath child_path;
90 90
91 child_path = CommandLine::ForCurrentProcess()->GetSwitchValuePath( 91 child_path = CommandLine::ForCurrentProcess()->GetSwitchValuePath(
92 switches::kBrowserSubprocessPath); 92 switches::kBrowserSubprocessPath);
93 if (!child_path.empty()) 93 if (!child_path.empty())
94 return child_path; 94 return child_path;
95 95
96 #if !defined(OS_MACOSX) 96 #if defined(OS_LINUX)
97 // On most platforms, the child executable is the same as the current 97 // Use /proc/self/exe rather than our known binary path so updates
98 // executable. 98 // can't swap out the binary from underneath us.
99 PathService::Get(base::FILE_EXE, &child_path); 99 child_path = FilePath("/proc/self/exe");
100 #else 100 #elif defined(OS_MACOSX)
101 // On the Mac, the child executable lives at a predefined location within 101 // On the Mac, the child executable lives at a predefined location within
102 // the app bundle's versioned directory. 102 // the app bundle's versioned directory.
103 child_path = chrome::GetVersionedDirectory(). 103 child_path = chrome::GetVersionedDirectory().
104 Append(chrome::kHelperProcessExecutablePath); 104 Append(chrome::kHelperProcessExecutablePath);
105 #endif // OS_MACOSX 105 #else
106 // On most platforms, the child executable is the same as the current
107 // executable.
108 PathService::Get(base::FILE_EXE, &child_path);
109 #endif
106 110
107 return child_path; 111 return child_path;
108 } 112 }
109 113
110 // static 114 // static
111 void ChildProcessHost::SetCrashReporterCommandLine(CommandLine* command_line) { 115 void ChildProcessHost::SetCrashReporterCommandLine(CommandLine* command_line) {
112 #if defined(USE_LINUX_BREAKPAD) 116 #if defined(USE_LINUX_BREAKPAD)
113 const bool unattended = (getenv("CHROME_HEADLESS") != NULL); 117 const bool unattended = (getenv("CHROME_HEADLESS") != NULL);
114 if (unattended || GoogleUpdateSettings::GetCollectStatsConsent()) { 118 if (unattended || GoogleUpdateSettings::GetCollectStatsConsent()) {
115 command_line->AppendSwitchWithValue(switches::kEnableCrashReporter, 119 command_line->AppendSwitchWithValue(switches::kEnableCrashReporter,
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 273
270 return *iterator_; 274 return *iterator_;
271 } while (true); 275 } while (true);
272 276
273 return NULL; 277 return NULL;
274 } 278 }
275 279
276 bool ChildProcessHost::Iterator::Done() { 280 bool ChildProcessHost::Iterator::Done() {
277 return iterator_ == Singleton<ChildProcessList>::get()->end(); 281 return iterator_ == Singleton<ChildProcessList>::get()->end();
278 } 282 }
OLDNEW
« no previous file with comments | « no previous file | chrome/common/chrome_constants.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698