diff options
-rw-r--r-- | chromium/base/command_line.cc | 10 | ||||
-rw-r--r-- | chromium/base/command_line.h | 2 |
2 files changed, 11 insertions, 1 deletions
diff --git a/chromium/base/command_line.cc b/chromium/base/command_line.cc index 99ea2b00032..32870287619 100644 --- a/chromium/base/command_line.cc +++ b/chromium/base/command_line.cc @@ -211,7 +211,7 @@ void CommandLine::InitUsingArgvForTesting(int argc, const char* const* argv) { #endif // static -bool CommandLine::Init(int argc, const char* const* argv) { +bool CommandLine::CreateEmpty() { if (current_process_commandline_) { // If this is intentional, Reset() must be called first. If we are using // the shared build mode, we have to share a single object across multiple @@ -220,6 +220,14 @@ bool CommandLine::Init(int argc, const char* const* argv) { } current_process_commandline_ = new CommandLine(NO_PROGRAM); + return true; +} + +// static +bool CommandLine::Init(int argc, const char* const* argv) { + if (!CreateEmpty()) + return false; + #if defined(OS_WIN) current_process_commandline_->ParseFromString(::GetCommandLineW()); #elif defined(OS_POSIX) diff --git a/chromium/base/command_line.h b/chromium/base/command_line.h index 3d29f8fee7f..d3a3fe4d3e2 100644 --- a/chromium/base/command_line.h +++ b/chromium/base/command_line.h @@ -78,6 +78,8 @@ class BASE_EXPORT CommandLine { static void InitUsingArgvForTesting(int argc, const char* const* argv); #endif + static bool CreateEmpty(); + // Initialize the current process CommandLine singleton. On Windows, ignores // its arguments (we instead parse GetCommandLineW() directly) because we // don't trust the CRT's parsing of the command line, but it still must be |