summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--base/command_line.cc7
-rw-r--r--base/command_line.h7
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() {