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

Side by Side Diff: content/common/set_process_title.cc

Issue 803813003: Make callers of CommandLine use it via the base:: namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 12 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
« no previous file with comments | « content/common/input/input_event_stream_validator.cc ('k') | content/gpu/gpu_child_thread.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) 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/common/set_process_title.h" 5 #include "content/common/set_process_title.h"
6 6
7 #include "build/build_config.h" 7 #include "build/build_config.h"
8 8
9 #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_SOLARIS) 9 #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_SOLARIS)
10 #include <limits.h> 10 #include <limits.h>
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 title.resize(title.size() - kDeletedSuffix.size()); 63 title.resize(title.size() - kDeletedSuffix.size());
64 64
65 // PR_SET_NAME is available in Linux 2.6.9 and newer. 65 // PR_SET_NAME is available in Linux 2.6.9 and newer.
66 // When available at run time, this sets the short process name that shows 66 // When available at run time, this sets the short process name that shows
67 // when the full command line is not being displayed in most process 67 // when the full command line is not being displayed in most process
68 // listings. 68 // listings.
69 prctl(PR_SET_NAME, base::FilePath(title).BaseName().value().c_str()); 69 prctl(PR_SET_NAME, base::FilePath(title).BaseName().value().c_str());
70 } 70 }
71 #endif // defined(OS_LINUX) 71 #endif // defined(OS_LINUX)
72 72
73 const CommandLine* command_line = CommandLine::ForCurrentProcess(); 73 const base::CommandLine* command_line =
74 base::CommandLine::ForCurrentProcess();
74 for (size_t i = 1; i < command_line->argv().size(); ++i) { 75 for (size_t i = 1; i < command_line->argv().size(); ++i) {
75 if (!title.empty()) 76 if (!title.empty())
76 title += " "; 77 title += " ";
77 title += command_line->argv()[i]; 78 title += command_line->argv()[i];
78 } 79 }
79 // Disable prepending argv[0] with '-' if we prepended it ourselves above. 80 // Disable prepending argv[0] with '-' if we prepended it ourselves above.
80 setproctitle(have_argv0 ? "-%s" : "%s", title.c_str()); 81 setproctitle(have_argv0 ? "-%s" : "%s", title.c_str());
81 } 82 }
82 83
83 #else 84 #else
84 85
85 // All other systems (basically Windows & Mac) have no need or way to implement 86 // All other systems (basically Windows & Mac) have no need or way to implement
86 // this function. 87 // this function.
87 void SetProcessTitleFromCommandLine(const char** /* main_argv */) { 88 void SetProcessTitleFromCommandLine(const char** /* main_argv */) {
88 } 89 }
89 90
90 #endif 91 #endif
91 92
92 } // namespace content 93 } // namespace content
OLDNEW
« no previous file with comments | « content/common/input/input_event_stream_validator.cc ('k') | content/gpu/gpu_child_thread.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698