OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 // This class works with command lines: building and parsing. | 5 // This class works with command lines: building and parsing. |
6 // Switches can optionally have a value attached using an equals sign, | 6 // Switches can optionally have a value attached using an equals sign, |
7 // as in "-switch=value". Arguments that aren't prefixed with a | 7 // as in "-switch=value". Arguments that aren't prefixed with a |
8 // switch prefix are considered "loose parameters". Switch names are | 8 // switch prefix are considered "loose parameters". Switch names are |
9 // case-insensitive. An argument of "--" will terminate switch | 9 // case-insensitive. An argument of "--" will terminate switch |
10 // parsing, causing everything after to be considered as loose | 10 // parsing, causing everything after to be considered as loose |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 // Uninit and free the current process's command line. | 48 // Uninit and free the current process's command line. |
49 static void Reset(); | 49 static void Reset(); |
50 | 50 |
51 // Initialize the current process CommandLine singleton. On Windows, | 51 // Initialize the current process CommandLine singleton. On Windows, |
52 // ignores its arguments (we instead parse GetCommandLineW() | 52 // ignores its arguments (we instead parse GetCommandLineW() |
53 // directly) because we don't trust the CRT's parsing of the command | 53 // directly) because we don't trust the CRT's parsing of the command |
54 // line, but it still must be called to set up the command line. | 54 // line, but it still must be called to set up the command line. |
55 static void Init(int argc, const char* const* argv); | 55 static void Init(int argc, const char* const* argv); |
56 static void Init(const std::vector<std::string>& argv); | 56 static void Init(const std::vector<std::string>& argv); |
57 | 57 |
| 58 #if defined(OS_LINUX) || defined(OS_FREEBSD) |
| 59 // Sets the current process' arguments that show in "ps" etc. to those |
| 60 // in |current_process_commandline_|. Used by the zygote host so that |
| 61 // renderers show up with --type=renderer. |
| 62 static void SetProcTitle(); |
| 63 |
| 64 // Needed to support SetProcTitle() on Linux. Should be called by main(). |
| 65 static void SetTrueArgv(char** argv); |
| 66 #endif |
| 67 |
58 // Destroys the current process CommandLine singleton. This is necessary if | 68 // Destroys the current process CommandLine singleton. This is necessary if |
59 // you want to reset the base library to its initial state (for example in an | 69 // you want to reset the base library to its initial state (for example in an |
60 // outer library that needs to be able to terminate, and be re-initialized). | 70 // outer library that needs to be able to terminate, and be re-initialized). |
61 // If Init is called only once, e.g. in main(), calling Terminate() is not | 71 // If Init is called only once, e.g. in main(), calling Terminate() is not |
62 // necessary. | 72 // necessary. |
63 static void Terminate(); | 73 static void Terminate(); |
64 | 74 |
65 // Get the singleton CommandLine representing the current process's | 75 // Get the singleton CommandLine representing the current process's |
66 // command line. | 76 // command line. |
67 static const CommandLine* ForCurrentProcess() { | 77 static const CommandLine* ForCurrentProcess() { |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 std::vector<StringType> loose_values_; | 193 std::vector<StringType> loose_values_; |
184 | 194 |
185 // We allow copy constructors, because a common pattern is to grab a | 195 // We allow copy constructors, because a common pattern is to grab a |
186 // copy of the current process's command line and then add some | 196 // copy of the current process's command line and then add some |
187 // flags to it. E.g.: | 197 // flags to it. E.g.: |
188 // CommandLine cl(*CommandLine::ForCurrentProcess()); | 198 // CommandLine cl(*CommandLine::ForCurrentProcess()); |
189 // cl.AppendSwitch(...); | 199 // cl.AppendSwitch(...); |
190 }; | 200 }; |
191 | 201 |
192 #endif // BASE_COMMAND_LINE_H_ | 202 #endif // BASE_COMMAND_LINE_H_ |
OLD | NEW |