Index: chrome/browser/chrome_browser_main_extra_parts_x11.cc |
diff --git a/chrome/browser/chrome_browser_main_extra_parts_x11.cc b/chrome/browser/chrome_browser_main_extra_parts_x11.cc |
index 993f4f97299e562888d52a5ba85d546f01438c63..0f8949dd6513e8fd33ddeaa69fe6c1e74118d786 100644 |
--- a/chrome/browser/chrome_browser_main_extra_parts_x11.cc |
+++ b/chrome/browser/chrome_browser_main_extra_parts_x11.cc |
@@ -5,15 +5,19 @@ |
#include "chrome/browser/chrome_browser_main_extra_parts_x11.h" |
#include "base/bind.h" |
+#include "base/command_line.h" |
#include "base/debug/debugger.h" |
#include "base/location.h" |
#include "base/sequenced_task_runner.h" |
+#include "base/strings/string_number_conversions.h" |
#include "base/threading/sequenced_task_runner_handle.h" |
#include "chrome/browser/lifetime/application_lifetime.h" |
#include "chrome/common/chrome_result_codes.h" |
+#include "chrome/common/chrome_switches.h" |
#include "content/public/browser/browser_thread.h" |
#include "ui/base/x/x11_util.h" |
#include "ui/base/x/x11_util_internal.h" |
+#include "ui/events/platform/x11/x11_event_source.h" |
using content::BrowserThread; |
@@ -93,6 +97,17 @@ void ChromeBrowserMainExtraPartsX11::PostMainMessageLoopStart() { |
// main message loop has started. This will allow us to exit cleanly |
// if X exits before us. |
ui::SetX11ErrorHandlers(BrowserX11ErrorHandler, BrowserX11IOErrorHandler); |
+ |
+#if !defined(OS_CHROMEOS) |
+ // Get a timestamp from the X server. This makes our requests to the server |
+ // less likely to be thrown away by the window manager. Put the timestamp in |
+ // a command line flag so we can forward it to an existing browser process if |
+ // necessary. |
+ base::CommandLine::ForCurrentProcess()->AppendSwitchASCII( |
+ switches::kWmUserTimeMs, |
+ base::Uint64ToString( |
+ ui::X11EventSource::GetInstance()->UpdateServerTime())); |
+#endif |
} |
void ChromeBrowserMainExtraPartsX11::PostMainMessageLoopRun() { |