summaryrefslogtreecommitdiff
path: root/chromium/base
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>2021-10-04 10:16:29 +0200
commit1926ed7124a6ebd3af08a110c6c8bc4e25627662 (patch)
tree786838da354bc5a511c67288d0178093cf627eb3 /chromium/base
parentc2c96d1d5de3c8e561d593f4afe1bbdf55097148 (diff)
downloadqtwebengine-chromium-1926ed7124a6ebd3af08a110c6c8bc4e25627662.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>
Diffstat (limited to 'chromium/base')
-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 92f45f5f9da..c0e5eda59dd 100644
--- a/chromium/base/command_line.cc
+++ b/chromium/base/command_line.cc
@@ -207,7 +207,7 @@ void CommandLine::InitUsingArgvForTesting(int argc, const char* const* argv) {
#endif // defined(OS_WIN)
// 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
@@ -216,6 +216,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) || defined(OS_FUCHSIA)
diff --git a/chromium/base/command_line.h b/chromium/base/command_line.h
index 6927e3e3413..afa0fdc5c09 100644
--- a/chromium/base/command_line.h
+++ b/chromium/base/command_line.h
@@ -77,6 +77,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