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-07-31 13:44:40 +0200
commitc68b9de53234acc6fe594e905ebbeae7ae032b08 (patch)
tree86c21a2393f8bd3bdc216643135c23cbfa850b8e
parent40ecd7cd758278bd955081377283a00d431a2cc1 (diff)
downloadqtwebengine-chromium-c68b9de53234acc6fe594e905ebbeae7ae032b08.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 873da813483..a09fc467421 100644
--- a/chromium/base/command_line.cc
+++ b/chromium/base/command_line.cc
@@ -212,7 +212,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
@@ -221,6 +221,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