diff options
author | evan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-25 21:13:53 +0000 |
---|---|---|
committer | evan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-25 21:13:53 +0000 |
commit | a2318cda8a1092f127ed6b88b12fad8208608ad1 (patch) | |
tree | 2bb6ff41efd418e76c1898945584166d5d8962c7 /base | |
parent | 779005e0450428d799f676fa4ed6ae3bcfd30f32 (diff) | |
download | chromium_src-a2318cda8a1092f127ed6b88b12fad8208608ad1.zip chromium_src-a2318cda8a1092f127ed6b88b12fad8208608ad1.tar.gz chromium_src-a2318cda8a1092f127ed6b88b12fad8208608ad1.tar.bz2 |
Add CommandLine::Terminate to be able to re-initialize the process command line
singleton.
Review URL: http://codereview.chromium.org/28060
Patch from Antoine Labour <piman@google.com>.
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@10379 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-rw-r--r-- | base/command_line.cc | 7 | ||||
-rw-r--r-- | base/command_line.h | 7 |
2 files changed, 13 insertions, 1 deletions
diff --git a/base/command_line.cc b/base/command_line.cc index d9a2052..e49254f 100644 --- a/base/command_line.cc +++ b/base/command_line.cc @@ -178,6 +178,12 @@ void CommandLine::Init(int argc, const char* const* argv) { #endif } +void CommandLine::Terminate() { + DCHECK(current_process_commandline_ != NULL); + delete current_process_commandline_; + current_process_commandline_ = NULL; +} + bool CommandLine::HasSwitch(const std::wstring& switch_string) const { std::wstring lowercased_switch(switch_string); #if defined(OS_WIN) @@ -345,4 +351,3 @@ void CommandLine::PrependWrapper(const std::wstring& wrapper_wide) { } #endif - diff --git a/base/command_line.h b/base/command_line.h index 94992b8..c79268d7 100644 --- a/base/command_line.h +++ b/base/command_line.h @@ -52,6 +52,13 @@ class CommandLine { // line, but it still must be called to set up the command line. static void Init(int argc, const char* const* argv); + // Destroys the current process CommandLine singleton. This is necessary if + // you want to reset the base library to its initial state (for example in an + // outer library that needs to be able to terminate, and be re-initialized). + // If Init is called only once, e.g. in main(), calling Terminate() is not + // necessary. + static void Terminate(); + // Get the singleton CommandLine representing the current process's // command line. static const CommandLine* ForCurrentProcess() { |