diff options
author | evan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-13 01:47:01 +0000 |
---|---|---|
committer | evan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-13 01:47:01 +0000 |
commit | 75e10302d5eb778d012a2c8b054bef8f1a67193a (patch) | |
tree | 68107e4e1e736c7cde95e22bab0be4610a0d35c2 /base | |
parent | d144b0590e00629570c3f729b1d0baf048dc1d45 (diff) | |
download | chromium_src-75e10302d5eb778d012a2c8b054bef8f1a67193a.zip chromium_src-75e10302d5eb778d012a2c8b054bef8f1a67193a.tar.gz chromium_src-75e10302d5eb778d012a2c8b054bef8f1a67193a.tar.bz2 |
linux: drop linux-specific CommandLine function
We can just call this from the appropriate constructor internally.
Review URL: http://codereview.chromium.org/271051
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@28773 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-rw-r--r-- | base/command_line.cc | 13 | ||||
-rw-r--r-- | base/command_line.h | 3 | ||||
-rw-r--r-- | base/setproctitle_linux.c | 3 |
3 files changed, 9 insertions, 10 deletions
diff --git a/base/command_line.cc b/base/command_line.cc index 84fa415..a1c2c1e 100644 --- a/base/command_line.cc +++ b/base/command_line.cc @@ -189,12 +189,18 @@ bool CommandLine::IsSwitch(const StringType& parameter_string, // static void CommandLine::Init(int argc, const char* const* argv) { + delete current_process_commandline_; current_process_commandline_ = new CommandLine; #if defined(OS_WIN) current_process_commandline_->ParseFromString(::GetCommandLineW()); #elif defined(OS_POSIX) current_process_commandline_->InitFromArgv(argc, argv); #endif + +#if defined(OS_LINUX) + if (argv) + setproctitle_init(const_cast<char**>(argv)); +#endif } #if defined(OS_LINUX) || defined(OS_FREEBSD) @@ -211,13 +217,6 @@ void CommandLine::SetProcTitle() { } setproctitle("%s", title.c_str()); } - -// static -void CommandLine::SetTrueArgv(char** argv) { -#if defined(OS_LINUX) - setproctitle_init(argv); -#endif -} #endif void CommandLine::Reset() { diff --git a/base/command_line.h b/base/command_line.h index 6b7d1f4..4fd8e4a 100644 --- a/base/command_line.h +++ b/base/command_line.h @@ -66,9 +66,6 @@ class CommandLine { // in |current_process_commandline_|. Used by the zygote host so that // renderers show up with --type=renderer. static void SetProcTitle(); - - // Needed to support SetProcTitle() on Linux. Should be called by main(). - static void SetTrueArgv(char** argv); #endif // Destroys the current process CommandLine singleton. This is necessary if diff --git a/base/setproctitle_linux.c b/base/setproctitle_linux.c index 3544d3e..9924c99 100644 --- a/base/setproctitle_linux.c +++ b/base/setproctitle_linux.c @@ -104,6 +104,9 @@ void setproctitle(const char* fmt, ...) { // A version of this built into glibc would not need this function, since // it could stash the argv pointer in __libc_start_main(). But we need it. void setproctitle_init(char** main_argv) { + if (g_main_argv) + return; + uintptr_t page_size = sysconf(_SC_PAGESIZE); // Check that the argv array is in fact on the same page of memory // as the environment array just as an added measure of protection. |