electron/patches/common/chromium/chrome_process_finder.patch

45 lines
2 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Milan Burda <miburda@microsoft.com>
Date: Fri, 26 Oct 2018 20:45:49 +0200
Subject: chrome_process_finder.patch
Fix some problems when using app.makeSingleInstance on Windows
* The original command line of new instances are passed instead
of the one modified by Chromium.
* The command line is passed as Array.
When using the app.makeSingleInstance API, the command line arguments
of the new instance will be passed to existing instance. Without this patch,
Chromium would append some new flags (kOriginalProcessStartTime and kFastStart).
Reference: https://github.com/electron/electron/pull/3175
diff --git a/chrome/browser/win/chrome_process_finder.cc b/chrome/browser/win/chrome_process_finder.cc
index 4fdea2af27020303a66a747304c5ecce5cc698d5..598ba8171631dbcf7ad23bc4b5c74a750bbaa47c 100644
--- a/chrome/browser/win/chrome_process_finder.cc
+++ b/chrome/browser/win/chrome_process_finder.cc
@@ -43,15 +43,6 @@ NotifyChromeResult AttemptToNotifyRunningChrome(HWND remote_window,
if (!thread_id || !process_id)
return NOTIFY_FAILED;
- base::CommandLine command_line(*base::CommandLine::ForCurrentProcess());
- command_line.AppendSwitchASCII(
- switches::kOriginalProcessStartTime,
- base::Int64ToString(
- base::CurrentProcessInfo::CreationTime().ToInternalValue()));
-
- if (fast_start)
- command_line.AppendSwitch(switches::kFastStart);
-
// Send the command line to the remote chrome window.
// Format is "START\0<<<current directory>>>\0<<<commandline>>>".
std::wstring to_send(L"START\0", 6); // want the NULL in the string.
@@ -60,7 +51,7 @@ NotifyChromeResult AttemptToNotifyRunningChrome(HWND remote_window,
return NOTIFY_FAILED;
to_send.append(cur_dir.value());
to_send.append(L"\0", 1); // Null separator.
- to_send.append(command_line.GetCommandLineString());
+ to_send.append(::GetCommandLineW());
to_send.append(L"\0", 1); // Null separator.
// Allow the current running browser window to make itself the foreground