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

Unified Diff: chrome/browser/browser_main.cc

Issue 4146004: ThreadRestrictions: disallow blocking IO on the UI thread (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: more Created 10 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/browser_main.cc
diff --git a/chrome/browser/browser_main.cc b/chrome/browser/browser_main.cc
index 92a3b68f85a3eeeff3bbf97376ec2eaf2e13a36b..dd1217d95cf930ac26440f0d85408224799a1732 100644
--- a/chrome/browser/browser_main.cc
+++ b/chrome/browser/browser_main.cc
@@ -27,6 +27,7 @@
#include "base/string_split.h"
#include "base/string_util.h"
#include "base/sys_string_conversions.h"
+#include "base/thread_restrictions.h"
#include "base/time.h"
#include "base/trace_event.h"
#include "base/utf_string_conversions.h"
@@ -478,6 +479,14 @@ void HandleTestParameters(const CommandLine& command_line) {
void RunUIMessageLoop(BrowserProcess* browser_process) {
TRACE_EVENT_BEGIN("BrowserMain:MESSAGE_LOOP", 0, "");
+#if defined(OS_LINUX)
+ // If the UI thread blocks, the whole UI is unresponsive.
+ // Do not allow disk IO from the UI thread.
+ // TODO(evanm): turn this on for all platforms.
+ // http://code.google.com/p/chromium/issues/detail?id=60211
+ base::ThreadRestrictions::SetIOAllowed(false);
+#endif
+
#if defined(TOOLKIT_VIEWS)
views::AcceleratorHandler accelerator_handler;
MessageLoopForUI::current()->Run(&accelerator_handler);

Powered by Google App Engine
This is Rietveld 408576698