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

Side by Side Diff: base/command_line.h

Issue 6002013: Move the SetProcTitle code out of base and into chrome/common. This is only... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 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 | Annotate | Revision Log
« no previous file with comments | « base/base.gypi ('k') | base/command_line.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) 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 saved as extra arguments. An argument of "--" 8 // switch prefix are saved as extra arguments. An argument of "--"
9 // will terminate switch parsing, causing everything after to be 9 // will terminate switch parsing, causing everything after to be
10 // considered as extra arguments. 10 // considered as extra arguments.
11 11
12 // There is a singleton read-only CommandLine that represents the command 12 // There is a singleton read-only CommandLine that represents the command
13 // line that the current process was started with. It must be initialized 13 // line that the current process was started with. It must be initialized
14 // in main() (or whatever the platform's equivalent function is). 14 // in main() (or whatever the platform's equivalent function is).
15 15
16 #ifndef BASE_COMMAND_LINE_H_ 16 #ifndef BASE_COMMAND_LINE_H_
17 #define BASE_COMMAND_LINE_H_ 17 #define BASE_COMMAND_LINE_H_
18 #pragma once 18 #pragma once
19 19
20 #include "build/build_config.h"
21
22 #include <map> 20 #include <map>
23 #include <string> 21 #include <string>
24 #include <vector> 22 #include <vector>
25 23
26 #include "base/basictypes.h" 24 #include "base/basictypes.h"
25 #include "build/build_config.h"
27 26
28 class FilePath; 27 class FilePath;
29 class InProcessBrowserTest; 28 class InProcessBrowserTest;
30 29
31 class CommandLine { 30 class CommandLine {
32 public: 31 public:
33 // A constructor for CommandLines that are used only to carry switches and 32 // A constructor for CommandLines that are used only to carry switches and
34 // arguments. 33 // arguments.
35 enum NoProgram { NO_PROGRAM }; 34 enum NoProgram { NO_PROGRAM };
36 explicit CommandLine(NoProgram no_program); 35 explicit CommandLine(NoProgram no_program);
(...skipping 22 matching lines...) Expand all
59 // Construct a new, empty command line. 58 // Construct a new, empty command line.
60 // |program| is the name of the program to run (aka argv[0]). 59 // |program| is the name of the program to run (aka argv[0]).
61 explicit CommandLine(const FilePath& program); 60 explicit CommandLine(const FilePath& program);
62 61
63 // Initialize the current process CommandLine singleton. On Windows, 62 // Initialize the current process CommandLine singleton. On Windows,
64 // ignores its arguments (we instead parse GetCommandLineW() 63 // ignores its arguments (we instead parse GetCommandLineW()
65 // directly) because we don't trust the CRT's parsing of the command 64 // directly) because we don't trust the CRT's parsing of the command
66 // line, but it still must be called to set up the command line. 65 // line, but it still must be called to set up the command line.
67 static void Init(int argc, const char* const* argv); 66 static void Init(int argc, const char* const* argv);
68 67
69 #if defined(OS_POSIX) && !defined(OS_MACOSX)
70 // Sets the current process' arguments that show in "ps" etc. to those
71 // in |current_process_commandline_|. Used by the zygote host so that
72 // renderers show up with --type=renderer.
73 static void SetProcTitle();
74 #endif
75
76 // Destroys the current process CommandLine singleton. This is necessary if 68 // Destroys the current process CommandLine singleton. This is necessary if
77 // 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
78 // 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).
79 // If Init is called only once, e.g. in main(), calling Reset() is not 71 // If Init is called only once, e.g. in main(), calling Reset() is not
80 // necessary. 72 // necessary.
81 static void Reset(); 73 static void Reset();
82 74
83 // Get the singleton CommandLine representing the current process's 75 // Get the singleton CommandLine representing the current process's
84 // command line. Note: returned value is mutable, but not thread safe; 76 // command line. Note: returned value is mutable, but not thread safe;
85 // only mutate if you know what you're doing! 77 // only mutate if you know what you're doing!
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 std::vector<StringType> args_; 191 std::vector<StringType> args_;
200 192
201 // We allow copy constructors, because a common pattern is to grab a 193 // We allow copy constructors, because a common pattern is to grab a
202 // copy of the current process's command line and then add some 194 // copy of the current process's command line and then add some
203 // flags to it. E.g.: 195 // flags to it. E.g.:
204 // CommandLine cl(*CommandLine::ForCurrentProcess()); 196 // CommandLine cl(*CommandLine::ForCurrentProcess());
205 // cl.AppendSwitch(...); 197 // cl.AppendSwitch(...);
206 }; 198 };
207 199
208 #endif // BASE_COMMAND_LINE_H_ 200 #endif // BASE_COMMAND_LINE_H_
OLDNEW
« no previous file with comments | « base/base.gypi ('k') | base/command_line.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698