summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoerg Bornemann <joerg.bornemann@theqtcompany.com>2016-03-21 13:53:48 +0100
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2017-05-02 17:57:34 +0200
commita4ac4cac2665f8de80ff4ee64cd07e8dd43d5096 (patch)
tree0533c61865280c0f7e367c255087540e2e01be9a
parent43a7bac9677f5ad58c5bacc4a6dcd17857a546ed (diff)
downloadqtwebengine-chromium-a4ac4cac2665f8de80ff4ee64cd07e8dd43d5096.tar.gz
Add CommandLine::CreateEmpty
Add a static function to create the CommandLine object for the current process without initializing it. Rationale: on Windows we need to initialize the CommandLine differently than Chromium intends. Esp. we want to pass our own arguments instead of relying on GetCommandLineW(). Task-number: QTBUG-51971 Change-Id: I0d1f0aa4eabad470d730f4f0a76cd1535f8f23ce Reviewed-by: Kai Koehne <kai.koehne@theqtcompany.com> Reviewed-by: Michael BrĂ¼ning <michael.bruning@theqtcompany.com>
-rw-r--r--chromium/base/command_line.cc10
-rw-r--r--chromium/base/command_line.h2
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