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

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

Issue 11880014: cc: Set ui/gpu/cc/ipc/upload/raster thread priorities. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Address feedback (use static). Created 7 years, 11 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 | « cc/raster_worker_pool.cc ('k') | content/common/child_process.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/hi_res_timer_manager.h" 10 #include "base/hi_res_timer_manager.h"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 #include "ui/base/clipboard/clipboard.h" 48 #include "ui/base/clipboard/clipboard.h"
49 49
50 #if defined(USE_AURA) 50 #if defined(USE_AURA)
51 #include "content/browser/renderer_host/image_transport_factory.h" 51 #include "content/browser/renderer_host/image_transport_factory.h"
52 #endif 52 #endif
53 53
54 #if defined(OS_ANDROID) 54 #if defined(OS_ANDROID)
55 #include "base/android/jni_android.h" 55 #include "base/android/jni_android.h"
56 #include "content/browser/android/surface_texture_peer_browser_impl.h" 56 #include "content/browser/android/surface_texture_peer_browser_impl.h"
57 #include "content/browser/device_orientation/data_fetcher_impl_android.h" 57 #include "content/browser/device_orientation/data_fetcher_impl_android.h"
58 // TODO(epenner): Move thread priorities to base. (crbug.com/170549)
59 #include <sys/resource.h>
58 #endif 60 #endif
59 61
60 #if defined(OS_WIN) 62 #if defined(OS_WIN)
61 #include <windows.h> 63 #include <windows.h>
62 #include <commctrl.h> 64 #include <commctrl.h>
63 #include <shellapi.h> 65 #include <shellapi.h>
64 66
65 #include "content/browser/system_message_window_win.h" 67 #include "content/browser/system_message_window_win.h"
66 #include "content/common/sandbox_policy.h" 68 #include "content/common/sandbox_policy.h"
67 #include "ui/base/l10n/l10n_util_win.h" 69 #include "ui/base/l10n/l10n_util_win.h"
(...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after
627 const char* kThreadName = "CrBrowserMain"; 629 const char* kThreadName = "CrBrowserMain";
628 base::PlatformThread::SetName(kThreadName); 630 base::PlatformThread::SetName(kThreadName);
629 if (main_message_loop_.get()) 631 if (main_message_loop_.get())
630 main_message_loop_->set_thread_name(kThreadName); 632 main_message_loop_->set_thread_name(kThreadName);
631 633
632 // Register the main thread by instantiating it, but don't call any methods. 634 // Register the main thread by instantiating it, but don't call any methods.
633 main_thread_.reset(new BrowserThreadImpl(BrowserThread::UI, 635 main_thread_.reset(new BrowserThreadImpl(BrowserThread::UI,
634 MessageLoop::current())); 636 MessageLoop::current()));
635 } 637 }
636 638
639 #if defined(OS_ANDROID)
640 // TODO(epenner): Move thread priorities to base. (crbug.com/170549)
641 namespace {
642 void SetHighThreadPriority() {
643 int nice_value = -6; // High priority.
644 setpriority(PRIO_PROCESS, base::PlatformThread::CurrentId(), nice_value);
645 }
646 }
647 #endif
648
637 void BrowserMainLoop::BrowserThreadsStarted() { 649 void BrowserMainLoop::BrowserThreadsStarted() {
650 #if defined(OS_ANDROID)
651 // TODO(epenner): Move thread priorities to base. (crbug.com/170549)
652 BrowserThread::PostTask(BrowserThread::UI,
653 FROM_HERE,
654 base::Bind(&SetHighThreadPriority));
655 BrowserThread::PostTask(BrowserThread::IO,
656 FROM_HERE,
657 base::Bind(&SetHighThreadPriority));
658 #endif
659
638 #if !defined(OS_IOS) 660 #if !defined(OS_IOS)
639 HistogramSynchronizer::GetInstance(); 661 HistogramSynchronizer::GetInstance();
640 662
641 BrowserGpuChannelHostFactory::Initialize(); 663 BrowserGpuChannelHostFactory::Initialize();
642 #if defined(USE_AURA) 664 #if defined(USE_AURA)
643 ImageTransportFactory::Initialize(); 665 ImageTransportFactory::Initialize();
644 #endif 666 #endif
645 667
646 #if defined(OS_LINUX) 668 #if defined(OS_LINUX)
647 device_monitor_linux_.reset(new DeviceMonitorLinux()); 669 device_monitor_linux_.reset(new DeviceMonitorLinux());
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
743 DCHECK_EQ(MessageLoop::TYPE_UI, MessageLoop::current()->type()); 765 DCHECK_EQ(MessageLoop::TYPE_UI, MessageLoop::current()->type());
744 if (parameters_.ui_task) 766 if (parameters_.ui_task)
745 MessageLoopForUI::current()->PostTask(FROM_HERE, *parameters_.ui_task); 767 MessageLoopForUI::current()->PostTask(FROM_HERE, *parameters_.ui_task);
746 768
747 base::RunLoop run_loop; 769 base::RunLoop run_loop;
748 run_loop.Run(); 770 run_loop.Run();
749 #endif 771 #endif
750 } 772 }
751 773
752 } // namespace content 774 } // namespace content
OLDNEW
« no previous file with comments | « cc/raster_worker_pool.cc ('k') | content/common/child_process.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698