Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(100)

Side by Side Diff: chrome/browser/chrome_browser_main_extra_parts_x11.cc

Issue 2076163002: Migrate SequencedTaskRunnerHandle calls to TaskRunnerHandle calls. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mix_c_Ab_1_scheduler_support_parallelTRH
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « blimp/net/thread_pipe_manager.cc ('k') | chrome/browser/win/settings_app_monitor.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
11 #include "base/sequenced_task_runner.h" 11 #include "base/sequenced_task_runner.h"
12 #include "base/strings/string_number_conversions.h" 12 #include "base/strings/string_number_conversions.h"
13 #include "base/threading/sequenced_task_runner_handle.h" 13 #include "base/threading/task_runner_handle.h"
14 #include "chrome/browser/lifetime/application_lifetime.h" 14 #include "chrome/browser/lifetime/application_lifetime.h"
15 #include "chrome/common/chrome_result_codes.h" 15 #include "chrome/common/chrome_result_codes.h"
16 #include "chrome/common/chrome_switches.h" 16 #include "chrome/common/chrome_switches.h"
17 #include "content/public/browser/browser_thread.h" 17 #include "content/public/browser/browser_thread.h"
18 #include "ui/base/x/x11_util.h" 18 #include "ui/base/x/x11_util.h"
19 #include "ui/base/x/x11_util_internal.h" 19 #include "ui/base/x/x11_util_internal.h"
20 #include "ui/events/platform/x11/x11_event_source.h" 20 #include "ui/events/platform/x11/x11_event_source.h"
21 21
22 using content::BrowserThread; 22 using content::BrowserThread;
23 23
24 namespace { 24 namespace {
25 25
26 // Indicates that we're currently responding to an IO error (by shutting down). 26 // Indicates that we're currently responding to an IO error (by shutting down).
27 bool g_in_x11_io_error_handler = false; 27 bool g_in_x11_io_error_handler = false;
28 28
29 // Number of seconds to wait for UI thread to get an IO error if we get it on 29 // Number of seconds to wait for UI thread to get an IO error if we get it on
30 // the background thread. 30 // the background thread.
31 const int kWaitForUIThreadSeconds = 10; 31 const int kWaitForUIThreadSeconds = 10;
32 32
33 int BrowserX11ErrorHandler(Display* d, XErrorEvent* error) { 33 int BrowserX11ErrorHandler(Display* d, XErrorEvent* error) {
34 if (!g_in_x11_io_error_handler) { 34 if (!g_in_x11_io_error_handler) {
35 base::SequencedTaskRunnerHandle::Get()->PostTask( 35 base::TaskRunnerHandle::Get()->PostTask(
36 FROM_HERE, base::Bind(&ui::LogErrorEventDescription, d, *error)); 36 FROM_HERE, base::Bind(&ui::LogErrorEventDescription, d, *error));
37 } 37 }
38 return 0; 38 return 0;
39 } 39 }
40 40
41
42 // This function is used to help us diagnose crash dumps that happen 41 // This function is used to help us diagnose crash dumps that happen
43 // during the shutdown process. 42 // during the shutdown process.
44 NOINLINE void WaitingForUIThreadToHandleIOError() { 43 NOINLINE void WaitingForUIThreadToHandleIOError() {
45 // Ensure function isn't optimized away. 44 // Ensure function isn't optimized away.
46 asm(""); 45 asm("");
47 sleep(kWaitForUIThreadSeconds); 46 sleep(kWaitForUIThreadSeconds);
48 } 47 }
49 48
50 int BrowserX11IOErrorHandler(Display* d) { 49 int BrowserX11IOErrorHandler(Display* d) {
51 if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) { 50 if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) {
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 } 112 }
114 #endif 113 #endif
115 } 114 }
116 115
117 void ChromeBrowserMainExtraPartsX11::PostMainMessageLoopRun() { 116 void ChromeBrowserMainExtraPartsX11::PostMainMessageLoopRun() {
118 // Unset the X11 error handlers. The X11 error handlers log the errors using a 117 // Unset the X11 error handlers. The X11 error handlers log the errors using a
119 // |PostTask()| on the message-loop. But since the message-loop is in the 118 // |PostTask()| on the message-loop. But since the message-loop is in the
120 // process of terminating, this can cause errors. 119 // process of terminating, this can cause errors.
121 ui::SetX11ErrorHandlers(X11EmptyErrorHandler, X11EmptyIOErrorHandler); 120 ui::SetX11ErrorHandlers(X11EmptyErrorHandler, X11EmptyIOErrorHandler);
122 } 121 }
OLDNEW
« no previous file with comments | « blimp/net/thread_pipe_manager.cc ('k') | chrome/browser/win/settings_app_monitor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698