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

Side by Side Diff: content/browser/browser_main_loop.cc

Issue 10151009: Disallow UI/IO thread blocking on any other thread. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/net/predictor.cc ('k') | content/browser/browser_process_sub_thread.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 "content/browser/browser_main_loop.h" 5 #include "content/browser/browser_main_loop.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/trace_event.h" 9 #include "base/debug/trace_event.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 #endif 420 #endif
421 421
422 BrowserThreadsStarted(); 422 BrowserThreadsStarted();
423 423
424 if (parts_.get()) 424 if (parts_.get())
425 parts_->PreMainMessageLoopRun(); 425 parts_->PreMainMessageLoopRun();
426 426
427 // If the UI thread blocks, the whole UI is unresponsive. 427 // If the UI thread blocks, the whole UI is unresponsive.
428 // Do not allow disk IO from the UI thread. 428 // Do not allow disk IO from the UI thread.
429 base::ThreadRestrictions::SetIOAllowed(false); 429 base::ThreadRestrictions::SetIOAllowed(false);
430 base::ThreadRestrictions::DisallowWaiting();
430 431
431 // When running the GPU thread in-process, avoid optimistically starting it 432 // When running the GPU thread in-process, avoid optimistically starting it
432 // since creating the GPU thread races against creation of the one-and-only 433 // since creating the GPU thread races against creation of the one-and-only
433 // ChildProcess instance which is created by the renderer thread. 434 // ChildProcess instance which is created by the renderer thread.
434 if (!parsed_command_line_.HasSwitch(switches::kSingleProcess) && 435 if (!parsed_command_line_.HasSwitch(switches::kSingleProcess) &&
435 !parsed_command_line_.HasSwitch(switches::kInProcessGPU)) { 436 !parsed_command_line_.HasSwitch(switches::kInProcessGPU)) {
436 BrowserThread::PostDelayedTask( 437 BrowserThread::PostDelayedTask(
437 BrowserThread::IO, FROM_HERE, base::Bind( 438 BrowserThread::IO, FROM_HERE, base::Bind(
438 base::IgnoreResult(&GpuProcessHost::Get), 439 base::IgnoreResult(&GpuProcessHost::Get),
439 GpuProcessHost::GPU_PROCESS_KIND_SANDBOXED, 440 GpuProcessHost::GPU_PROCESS_KIND_SANDBOXED,
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
637 MessageLoopForUI::current()->PostTask(FROM_HERE, *parameters_.ui_task); 638 MessageLoopForUI::current()->PostTask(FROM_HERE, *parameters_.ui_task);
638 639
639 #if defined(OS_MACOSX) 640 #if defined(OS_MACOSX)
640 MessageLoopForUI::current()->Run(); 641 MessageLoopForUI::current()->Run();
641 #else 642 #else
642 MessageLoopForUI::current()->RunWithDispatcher(NULL); 643 MessageLoopForUI::current()->RunWithDispatcher(NULL);
643 #endif 644 #endif
644 } 645 }
645 646
646 } // namespace content 647 } // namespace content
OLDNEW
« no previous file with comments | « chrome/browser/net/predictor.cc ('k') | content/browser/browser_process_sub_thread.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698