| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/chrome_browser_main_extra_parts_x11.h" | 5 #include "chrome/browser/chrome_browser_main_extra_parts_x11.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/debug/debugger.h" | 9 #include "base/debug/debugger.h" |
| 10 #include "base/location.h" | 10 #include "base/location.h" |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 ui::SetX11ErrorHandlers(NULL, NULL); | 92 ui::SetX11ErrorHandlers(NULL, NULL); |
| 93 } | 93 } |
| 94 | 94 |
| 95 void ChromeBrowserMainExtraPartsX11::PostMainMessageLoopStart() { | 95 void ChromeBrowserMainExtraPartsX11::PostMainMessageLoopStart() { |
| 96 // Installs the X11 error handlers for the browser process after the | 96 // Installs the X11 error handlers for the browser process after the |
| 97 // main message loop has started. This will allow us to exit cleanly | 97 // main message loop has started. This will allow us to exit cleanly |
| 98 // if X exits before us. | 98 // if X exits before us. |
| 99 ui::SetX11ErrorHandlers(BrowserX11ErrorHandler, BrowserX11IOErrorHandler); | 99 ui::SetX11ErrorHandlers(BrowserX11ErrorHandler, BrowserX11IOErrorHandler); |
| 100 | 100 |
| 101 #if !defined(OS_CHROMEOS) | 101 #if !defined(OS_CHROMEOS) |
| 102 // Get a timestamp from the X server. This makes our requests to the server | 102 // It is possible for X11EventSource to not have been created (e.g. when |
| 103 // less likely to be thrown away by the window manager. Put the timestamp in | 103 // running as a mus client). |
| 104 // a command line flag so we can forward it to an existing browser process if | 104 if (ui::X11EventSource::GetInstance()) { |
| 105 // necessary. | 105 // Get a timestamp from the X server. This makes our requests to the server |
| 106 base::CommandLine::ForCurrentProcess()->AppendSwitchASCII( | 106 // less likely to be thrown away by the window manager. Put the timestamp |
| 107 switches::kWmUserTimeMs, | 107 // in a command line flag so we can forward it to an existing browser |
| 108 base::Uint64ToString( | 108 // process if necessary. |
| 109 ui::X11EventSource::GetInstance()->UpdateLastSeenServerTime())); | 109 base::CommandLine::ForCurrentProcess()->AppendSwitchASCII( |
| 110 switches::kWmUserTimeMs, |
| 111 base::Uint64ToString( |
| 112 ui::X11EventSource::GetInstance()->UpdateLastSeenServerTime())); |
| 113 } |
| 110 #endif | 114 #endif |
| 111 } | 115 } |
| 112 | 116 |
| 113 void ChromeBrowserMainExtraPartsX11::PostMainMessageLoopRun() { | 117 void ChromeBrowserMainExtraPartsX11::PostMainMessageLoopRun() { |
| 114 // Unset the X11 error handlers. The X11 error handlers log the errors using a | 118 // Unset the X11 error handlers. The X11 error handlers log the errors using a |
| 115 // |PostTask()| on the message-loop. But since the message-loop is in the | 119 // |PostTask()| on the message-loop. But since the message-loop is in the |
| 116 // process of terminating, this can cause errors. | 120 // process of terminating, this can cause errors. |
| 117 ui::SetX11ErrorHandlers(X11EmptyErrorHandler, X11EmptyIOErrorHandler); | 121 ui::SetX11ErrorHandlers(X11EmptyErrorHandler, X11EmptyIOErrorHandler); |
| 118 } | 122 } |
| OLD | NEW |