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

Side by Side Diff: content/child/child_process.cc

Issue 1690173004: content: Increase thread priority for display critical IO threads on ChromeOS. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: cl format Created 4 years, 10 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 | « content/child/child_process.h ('k') | content/gpu/gpu_main.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/child/child_process.h" 5 #include "content/child/child_process.h"
6 6
7 #include <string.h> 7 #include <string.h>
8 8
9 #include "base/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 16 matching lines...) Expand all
27 #endif 27 #endif
28 28
29 namespace content { 29 namespace content {
30 30
31 namespace { 31 namespace {
32 32
33 base::LazyInstance<base::ThreadLocalPointer<ChildProcess> > g_lazy_tls = 33 base::LazyInstance<base::ThreadLocalPointer<ChildProcess> > g_lazy_tls =
34 LAZY_INSTANCE_INITIALIZER; 34 LAZY_INSTANCE_INITIALIZER;
35 } 35 }
36 36
37 ChildProcess::ChildProcess() 37 ChildProcess::ChildProcess() : ChildProcess(base::ThreadPriority::NORMAL) {}
38
39 ChildProcess::ChildProcess(base::ThreadPriority io_thread_priority)
38 : ref_count_(0), 40 : ref_count_(0),
39 shutdown_event_(true, false), 41 shutdown_event_(true, false),
40 io_thread_("Chrome_ChildIOThread") { 42 io_thread_("Chrome_ChildIOThread") {
41 DCHECK(!g_lazy_tls.Pointer()->Get()); 43 DCHECK(!g_lazy_tls.Pointer()->Get());
42 g_lazy_tls.Pointer()->Set(this); 44 g_lazy_tls.Pointer()->Set(this);
43 45
44 base::StatisticsRecorder::Initialize(); 46 base::StatisticsRecorder::Initialize();
45 47
46 // We can't recover from failing to start the IO thread. 48 // We can't recover from failing to start the IO thread.
47 base::Thread::Options thread_options(base::MessageLoop::TYPE_IO, 0); 49 base::Thread::Options thread_options(base::MessageLoop::TYPE_IO, 0);
50 thread_options.priority = io_thread_priority;
48 #if defined(OS_ANDROID) 51 #if defined(OS_ANDROID)
52 // TODO(reveman): Remove this in favor of setting it explicitly for each type
53 // of process.
49 thread_options.priority = base::ThreadPriority::DISPLAY; 54 thread_options.priority = base::ThreadPriority::DISPLAY;
50 #endif 55 #endif
51 CHECK(io_thread_.StartWithOptions(thread_options)); 56 CHECK(io_thread_.StartWithOptions(thread_options));
52 } 57 }
53 58
54 ChildProcess::~ChildProcess() { 59 ChildProcess::~ChildProcess() {
55 DCHECK(g_lazy_tls.Pointer()->Get() == this); 60 DCHECK(g_lazy_tls.Pointer()->Get() == this);
56 61
57 // Signal this event before destroying the child process. That way all 62 // Signal this event before destroying the child process. That way all
58 // background threads can cleanup. 63 // background threads can cleanup.
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 memset(&sa, 0, sizeof(sa)); 143 memset(&sa, 0, sizeof(sa));
139 sa.sa_handler = SigUSR1Handler; 144 sa.sa_handler = SigUSR1Handler;
140 sigaction(SIGUSR1, &sa, NULL); 145 sigaction(SIGUSR1, &sa, NULL);
141 146
142 pause(); 147 pause();
143 #endif // defined(OS_ANDROID) 148 #endif // defined(OS_ANDROID)
144 #endif // defined(OS_POSIX) 149 #endif // defined(OS_POSIX)
145 } 150 }
146 151
147 } // namespace content 152 } // namespace content
OLDNEW
« no previous file with comments | « content/child/child_process.h ('k') | content/gpu/gpu_main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698