summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgab <gab@chromium.org>2015-04-01 16:05:02 -0700
committerCommit bot <commit-bot@chromium.org>2015-04-01 23:05:40 +0000
commit9a47073b992032eccd980693076a2dfb5dab429d (patch)
tree74458229f7a974865c750eceb7dbdc96efced359
parented746db6b452ff281df0b227ea386e9a744acd9c (diff)
downloadchromium_src-9a47073b992032eccd980693076a2dfb5dab429d.zip
chromium_src-9a47073b992032eccd980693076a2dfb5dab429d.tar.gz
chromium_src-9a47073b992032eccd980693076a2dfb5dab429d.tar.bz2
Turn ThreadPriority enum into an enum class.
Adding some type safety as it is often used in close proximity with OS-level raw integer priorities. Also fixing nomenclature to use CHROMIUM_STYLE_ENUM_NAMES rather than kGoogleStyleEnumNames: https://www.chromium.org/developers/coding-style#Naming And lastly, sorting the declaration order by importance. TBR=jam BUG=456903 Review URL: https://codereview.chromium.org/1051863003 Cr-Commit-Position: refs/heads/master@{#323359}
-rw-r--r--base/threading/platform_thread.h18
-rw-r--r--base/threading/platform_thread_android.cc12
-rw-r--r--base/threading/platform_thread_freebsd.cc12
-rw-r--r--base/threading/platform_thread_internal_posix.cc2
-rw-r--r--base/threading/platform_thread_linux.cc12
-rw-r--r--base/threading/platform_thread_mac.mm6
-rw-r--r--base/threading/platform_thread_posix.cc12
-rw-r--r--base/threading/platform_thread_unittest.cc26
-rw-r--r--base/threading/platform_thread_win.cc28
-rw-r--r--content/browser/browser_main_loop.cc7
-rw-r--r--content/browser/renderer_host/compositor_impl_android.cc2
-rw-r--r--content/child/child_process.cc2
-rw-r--r--content/gpu/gpu_child_thread.cc5
-rw-r--r--content/renderer/gpu/compositor_output_surface.cc8
-rw-r--r--content/renderer/media/webrtc_local_audio_track_unittest.cc2
-rw-r--r--content/renderer/render_thread_impl.cc4
-rw-r--r--gpu/command_buffer/service/async_pixel_transfer_manager_egl.cc6
-rw-r--r--gpu/command_buffer/service/async_pixel_transfer_manager_share_group.cc2
-rw-r--r--media/audio/audio_device_thread.cc2
-rw-r--r--media/audio/win/audio_low_latency_input_win.cc2
-rw-r--r--media/audio/win/audio_low_latency_output_win.cc2
21 files changed, 87 insertions, 85 deletions
diff --git a/base/threading/platform_thread.h b/base/threading/platform_thread.h
index f90a9a2..653961d 100644
--- a/base/threading/platform_thread.h
+++ b/base/threading/platform_thread.h
@@ -110,15 +110,17 @@ class PlatformThreadHandle {
const PlatformThreadId kInvalidThreadId(0);
-// Valid values for SetThreadPriority()
-enum ThreadPriority {
- kThreadPriority_Normal,
- // Suitable for low-latency, glitch-resistant audio.
- kThreadPriority_RealtimeAudio,
- // Suitable for threads which generate data for the display (at ~60Hz).
- kThreadPriority_Display,
+// Valid values for SetThreadPriority(), listed in increasing order of
+// importance.
+enum class ThreadPriority {
// Suitable for threads that shouldn't disrupt high priority work.
- kThreadPriority_Background
+ BACKGROUND,
+ // Default priority level.
+ NORMAL,
+ // Suitable for threads which generate data for the display (at ~60Hz).
+ DISPLAY,
+ // Suitable for low-latency, glitch-resistant audio.
+ REALTIME_AUDIO,
};
// A namespace for low-level thread functions.
diff --git a/base/threading/platform_thread_android.cc b/base/threading/platform_thread_android.cc
index be4ccbe..a31f659 100644
--- a/base/threading/platform_thread_android.cc
+++ b/base/threading/platform_thread_android.cc
@@ -38,17 +38,17 @@ namespace internal {
// We use -6 for display, but we may want to split this into urgent (-8) and
// non-urgent (-4).
const ThreadPriorityToNiceValuePair kThreadPriorityToNiceValueMap[4] = {
- {kThreadPriority_RealtimeAudio, -16},
- {kThreadPriority_Background, 10},
- {kThreadPriority_Normal, 0},
- {kThreadPriority_Display, -6},
+ {ThreadPriority::BACKGROUND, 10},
+ {ThreadPriority::NORMAL, 0},
+ {ThreadPriority::DISPLAY, -6},
+ {ThreadPriority::REALTIME_AUDIO, -16},
};
bool SetThreadPriorityForPlatform(PlatformThreadHandle handle,
ThreadPriority priority) {
// On Android, we set the Audio priority through JNI as Audio priority
// will also allow the process to run while it is backgrounded.
- if (priority == kThreadPriority_RealtimeAudio) {
+ if (priority == ThreadPriority::REALTIME_AUDIO) {
JNIEnv* env = base::android::AttachCurrentThread();
Java_ThreadUtils_setThreadPriorityAudio(env, PlatformThread::CurrentId());
return true;
@@ -89,7 +89,7 @@ void InitOnThread() {
// Threads on linux/android may inherit their priority from the thread
// where they were created. This sets all new threads to the default.
PlatformThread::SetThreadPriority(PlatformThread::CurrentHandle(),
- kThreadPriority_Normal);
+ ThreadPriority::NORMAL);
}
void TerminateOnThread() {
diff --git a/base/threading/platform_thread_freebsd.cc b/base/threading/platform_thread_freebsd.cc
index dc5d34b..7ba4eed 100644
--- a/base/threading/platform_thread_freebsd.cc
+++ b/base/threading/platform_thread_freebsd.cc
@@ -30,10 +30,10 @@ const struct sched_param kRealTimePrio = {8};
} // namespace
const ThreadPriorityToNiceValuePair kThreadPriorityToNiceValueMap[4] = {
- { kThreadPriority_RealtimeAudio, -10 },
- { kThreadPriority_Background, 10 },
- { kThreadPriority_Normal, 0 },
- { kThreadPriority_Display, -6 },
+ {ThreadPriority::BACKGROUND, 10},
+ {ThreadPriority::NORMAL, 0},
+ {ThreadPriority::DISPLAY, -6},
+ {ThreadPriority::REALTIME_AUDIO, -10},
}
bool SetThreadPriorityForPlatform(PlatformThreadHandle handle,
@@ -41,7 +41,7 @@ bool SetThreadPriorityForPlatform(PlatformThreadHandle handle,
#if !defined(OS_NACL)
// TODO(gab): Assess the correctness of using |pthread_self()| below instead
// of |handle|. http://crbug.com/468793.
- return priority == kThreadPriority_RealtimeAudio &&
+ return priority == ThreadPriority::REALTIME_AUDIO &&
pthread_setschedparam(pthread_self(), SCHED_RR, &kRealTimePrio) == 0;
#else
return false;
@@ -59,7 +59,7 @@ bool GetThreadPriorityForPlatform(PlatformThreadHandle handle,
&maybe_realtime_prio) == 0 &&
maybe_sched_rr == SCHED_RR &&
maybe_realtime_prio.sched_priority == kRealTimePrio.sched_priority) {
- *priority = kThreadPriority_RealtimeAudio;
+ *priority = ThreadPriority::REALTIME_AUDIO;
return true;
}
#endif
diff --git a/base/threading/platform_thread_internal_posix.cc b/base/threading/platform_thread_internal_posix.cc
index 841a44a..9af0204 100644
--- a/base/threading/platform_thread_internal_posix.cc
+++ b/base/threading/platform_thread_internal_posix.cc
@@ -27,7 +27,7 @@ ThreadPriority NiceValueToThreadPriority(int nice_value) {
return pair.priority;
}
NOTREACHED() << "Unknown nice value";
- return kThreadPriority_Normal;
+ return ThreadPriority::NORMAL;
}
} // namespace internal
diff --git a/base/threading/platform_thread_linux.cc b/base/threading/platform_thread_linux.cc
index 67dbca6..b72fb5b 100644
--- a/base/threading/platform_thread_linux.cc
+++ b/base/threading/platform_thread_linux.cc
@@ -31,10 +31,10 @@ const struct sched_param kRealTimePrio = {8};
} // namespace
const ThreadPriorityToNiceValuePair kThreadPriorityToNiceValueMap[4] = {
- {kThreadPriority_RealtimeAudio, -10},
- {kThreadPriority_Background, 10},
- {kThreadPriority_Normal, 0},
- {kThreadPriority_Display, -6},
+ {ThreadPriority::BACKGROUND, 10},
+ {ThreadPriority::NORMAL, 0},
+ {ThreadPriority::DISPLAY, -6},
+ {ThreadPriority::REALTIME_AUDIO, -10},
};
bool SetThreadPriorityForPlatform(PlatformThreadHandle handle,
@@ -42,7 +42,7 @@ bool SetThreadPriorityForPlatform(PlatformThreadHandle handle,
#if !defined(OS_NACL)
// TODO(gab): Assess the correctness of using |pthread_self()| below instead
// of |handle|. http://crbug.com/468793.
- return priority == kThreadPriority_RealtimeAudio &&
+ return priority == ThreadPriority::REALTIME_AUDIO &&
pthread_setschedparam(pthread_self(), SCHED_RR, &kRealTimePrio) == 0;
#else
return false;
@@ -60,7 +60,7 @@ bool GetThreadPriorityForPlatform(PlatformThreadHandle handle,
&maybe_realtime_prio) == 0 &&
maybe_sched_rr == SCHED_RR &&
maybe_realtime_prio.sched_priority == kRealTimePrio.sched_priority) {
- *priority = kThreadPriority_RealtimeAudio;
+ *priority = ThreadPriority::REALTIME_AUDIO;
return true;
}
#endif
diff --git a/base/threading/platform_thread_mac.mm b/base/threading/platform_thread_mac.mm
index 59345b0..fd40d79 100644
--- a/base/threading/platform_thread_mac.mm
+++ b/base/threading/platform_thread_mac.mm
@@ -161,10 +161,10 @@ void PlatformThread::SetThreadPriority(PlatformThreadHandle handle,
mach_port_t mach_thread_id = pthread_mach_thread_np(handle.handle_);
switch (priority) {
- case kThreadPriority_Normal:
+ case ThreadPriority::NORMAL:
SetPriorityNormal(mach_thread_id);
break;
- case kThreadPriority_RealtimeAudio:
+ case ThreadPriority::REALTIME_AUDIO:
SetPriorityRealtimeAudio(mach_thread_id);
break;
default:
@@ -176,7 +176,7 @@ void PlatformThread::SetThreadPriority(PlatformThreadHandle handle,
// static
ThreadPriority PlatformThread::GetThreadPriority(PlatformThreadHandle handle) {
NOTIMPLEMENTED();
- return kThreadPriority_Normal;
+ return ThreadPriority::NORMAL;
}
size_t GetDefaultThreadStackSize(const pthread_attr_t& attributes) {
diff --git a/base/threading/platform_thread_posix.cc b/base/threading/platform_thread_posix.cc
index 600c5ce9..3dbdc98 100644
--- a/base/threading/platform_thread_posix.cc
+++ b/base/threading/platform_thread_posix.cc
@@ -39,7 +39,7 @@ struct ThreadParams {
ThreadParams()
: delegate(NULL),
joinable(false),
- priority(kThreadPriority_Normal),
+ priority(ThreadPriority::NORMAL),
handle(NULL),
handle_set(false, false) {
}
@@ -59,7 +59,7 @@ void* ThreadFunc(void* params) {
if (!thread_params->joinable)
base::ThreadRestrictions::SetSingletonAllowed(false);
- if (thread_params->priority != kThreadPriority_Normal) {
+ if (thread_params->priority != ThreadPriority::NORMAL) {
PlatformThread::SetThreadPriority(PlatformThread::CurrentHandle(),
thread_params->priority);
}
@@ -201,7 +201,7 @@ bool PlatformThread::Create(size_t stack_size, Delegate* delegate,
PlatformThreadHandle* thread_handle) {
base::ThreadRestrictions::ScopedAllowWait allow_wait;
return CreateThread(stack_size, true /* joinable thread */,
- delegate, thread_handle, kThreadPriority_Normal);
+ delegate, thread_handle, ThreadPriority::NORMAL);
}
// static
@@ -219,7 +219,7 @@ bool PlatformThread::CreateNonJoinable(size_t stack_size, Delegate* delegate) {
base::ThreadRestrictions::ScopedAllowWait allow_wait;
bool result = CreateThread(stack_size, false /* non-joinable thread */,
- delegate, &unused, kThreadPriority_Normal);
+ delegate, &unused, ThreadPriority::NORMAL);
return result;
}
@@ -265,7 +265,7 @@ void PlatformThread::SetThreadPriority(PlatformThreadHandle handle,
ThreadPriority PlatformThread::GetThreadPriority(PlatformThreadHandle handle) {
#if defined(OS_NACL)
NOTIMPLEMENTED();
- return kThreadPriority_Normal;
+ return ThreadPriority::NORMAL;
#else
// Mirrors SetThreadPriority()'s implementation.
ThreadPriority platform_specific_priority;
@@ -283,7 +283,7 @@ ThreadPriority PlatformThread::GetThreadPriority(PlatformThreadHandle handle) {
getpriority(PRIO_PROCESS, handle.id_ == current_id ? 0 : handle.id_);
if (errno != 0) {
DVPLOG(1) << "Failed to get nice value of thread (" << handle.id_ << ")";
- return kThreadPriority_Normal;
+ return ThreadPriority::NORMAL;
}
return internal::NiceValueToThreadPriority(nice_value);
diff --git a/base/threading/platform_thread_unittest.cc b/base/threading/platform_thread_unittest.cc
index 6e5605e..c4b3d5d 100644
--- a/base/threading/platform_thread_unittest.cc
+++ b/base/threading/platform_thread_unittest.cc
@@ -175,12 +175,14 @@ const ThreadPriority kThreadPriorityTestValues[] = {
// on POSIX as it at least provides coverage for running this code under
// "normal" priority.
#if !defined(OS_POSIX)
- kThreadPriority_RealtimeAudio,
- kThreadPriority_Display,
- kThreadPriority_Background,
+ ThreadPriority::DISPLAY,
+ ThreadPriority::REALTIME_AUDIO,
+ // Keep BACKGROUND second to last to test backgrounding from other
+ // priorities.
+ ThreadPriority::BACKGROUND,
#endif // !defined(OS_POSIX)
- // Keep normal last to test unbackgrounding.
- kThreadPriority_Normal
+ // Keep NORMAL last to test unbackgrounding.
+ ThreadPriority::NORMAL
};
} // namespace
@@ -192,7 +194,7 @@ TEST(PlatformThreadTest, ThreadPriorityOtherThread) {
PlatformThreadHandle current_handle(PlatformThread::CurrentHandle());
// Confirm that the current thread's priority is as expected.
- EXPECT_EQ(kThreadPriority_Normal,
+ EXPECT_EQ(ThreadPriority::NORMAL,
PlatformThread::GetThreadPriority(current_handle));
// Create a test thread.
@@ -204,7 +206,7 @@ TEST(PlatformThreadTest, ThreadPriorityOtherThread) {
EXPECT_NE(thread.thread_id(), PlatformThread::CurrentId());
// New threads should get normal priority by default.
- EXPECT_EQ(kThreadPriority_Normal, PlatformThread::GetThreadPriority(handle));
+ EXPECT_EQ(ThreadPriority::NORMAL, PlatformThread::GetThreadPriority(handle));
// Toggle each supported priority on the test thread and confirm it only
// affects it (and not the current thread).
@@ -217,7 +219,7 @@ TEST(PlatformThreadTest, ThreadPriorityOtherThread) {
PlatformThread::GetThreadPriority(handle));
// Make sure the current thread was otherwise unaffected.
- EXPECT_EQ(kThreadPriority_Normal,
+ EXPECT_EQ(ThreadPriority::NORMAL,
PlatformThread::GetThreadPriority(current_handle));
}
@@ -233,7 +235,7 @@ TEST(PlatformThreadTest, ThreadPriorityCurrentThread) {
PlatformThreadHandle current_handle(PlatformThread::CurrentHandle());
// Confirm that the current thread's priority is as expected.
- EXPECT_EQ(kThreadPriority_Normal,
+ EXPECT_EQ(ThreadPriority::NORMAL,
PlatformThread::GetThreadPriority(current_handle));
// Create a test thread for verification purposes only.
@@ -245,7 +247,7 @@ TEST(PlatformThreadTest, ThreadPriorityCurrentThread) {
EXPECT_NE(thread.thread_id(), PlatformThread::CurrentId());
// Confirm that the new thread's priority is as expected.
- EXPECT_EQ(kThreadPriority_Normal, PlatformThread::GetThreadPriority(handle));
+ EXPECT_EQ(ThreadPriority::NORMAL, PlatformThread::GetThreadPriority(handle));
// Toggle each supported priority on the current thread and confirm it only
// affects it (and not the test thread).
@@ -259,12 +261,12 @@ TEST(PlatformThreadTest, ThreadPriorityCurrentThread) {
PlatformThread::GetThreadPriority(current_handle));
// Make sure the test thread was otherwise unaffected.
- EXPECT_EQ(kThreadPriority_Normal,
+ EXPECT_EQ(ThreadPriority::NORMAL,
PlatformThread::GetThreadPriority(handle));
}
// Restore current thread priority for follow-up tests.
- PlatformThread::SetThreadPriority(current_handle, kThreadPriority_Normal);
+ PlatformThread::SetThreadPriority(current_handle, ThreadPriority::NORMAL);
thread.MarkForTermination();
PlatformThread::Join(handle);
diff --git a/base/threading/platform_thread_win.cc b/base/threading/platform_thread_win.cc
index df44ec2..b9f7a56 100644
--- a/base/threading/platform_thread_win.cc
+++ b/base/threading/platform_thread_win.cc
@@ -237,17 +237,17 @@ void PlatformThread::SetThreadPriority(PlatformThreadHandle handle,
int desired_priority = THREAD_PRIORITY_ERROR_RETURN;
switch (priority) {
- case kThreadPriority_Normal:
- desired_priority = THREAD_PRIORITY_NORMAL;
+ case ThreadPriority::BACKGROUND:
+ desired_priority = THREAD_PRIORITY_LOWEST;
break;
- case kThreadPriority_RealtimeAudio:
- desired_priority = THREAD_PRIORITY_TIME_CRITICAL;
+ case ThreadPriority::NORMAL:
+ desired_priority = THREAD_PRIORITY_NORMAL;
break;
- case kThreadPriority_Display:
+ case ThreadPriority::DISPLAY:
desired_priority = THREAD_PRIORITY_ABOVE_NORMAL;
break;
- case kThreadPriority_Background:
- desired_priority = THREAD_PRIORITY_LOWEST;
+ case ThreadPriority::REALTIME_AUDIO:
+ desired_priority = THREAD_PRIORITY_TIME_CRITICAL;
break;
default:
NOTREACHED() << "Unknown priority.";
@@ -269,19 +269,19 @@ ThreadPriority PlatformThread::GetThreadPriority(PlatformThreadHandle handle) {
int priority = ::GetThreadPriority(handle.handle_);
switch (priority) {
+ case THREAD_PRIORITY_LOWEST:
+ return ThreadPriority::BACKGROUND;
case THREAD_PRIORITY_NORMAL:
- return kThreadPriority_Normal;
- case THREAD_PRIORITY_TIME_CRITICAL:
- return kThreadPriority_RealtimeAudio;
+ return ThreadPriority::NORMAL;
case THREAD_PRIORITY_ABOVE_NORMAL:
- return kThreadPriority_Display;
- case THREAD_PRIORITY_LOWEST:
- return kThreadPriority_Background;
+ return ThreadPriority::DISPLAY;
+ case THREAD_PRIORITY_TIME_CRITICAL:
+ return ThreadPriority::REALTIME_AUDIO;
case THREAD_PRIORITY_ERROR_RETURN:
DPCHECK(false) << "GetThreadPriority error"; // Falls through.
default:
NOTREACHED() << "Unexpected priority: " << priority;
- return kThreadPriority_Normal;
+ return ThreadPriority::NORMAL;
}
}
diff --git a/content/browser/browser_main_loop.cc b/content/browser/browser_main_loop.cc
index 1c38215..fcb540c 100644
--- a/content/browser/browser_main_loop.cc
+++ b/content/browser/browser_main_loop.cc
@@ -1036,10 +1036,9 @@ int BrowserMainLoop::BrowserThreadsStarted() {
#if defined(OS_ANDROID)
// Up the priority of anything that touches with display tasks
// (this thread is UI thread, and io_thread_ is for IPCs).
- io_thread_->SetPriority(base::kThreadPriority_Display);
- base::PlatformThread::SetThreadPriority(
- base::PlatformThread::CurrentHandle(),
- base::kThreadPriority_Display);
+ io_thread_->SetPriority(base::ThreadPriority::DISPLAY);
+ base::PlatformThread::SetThreadPriority(base::PlatformThread::CurrentHandle(),
+ base::ThreadPriority::DISPLAY);
// On Android, GLSurface::InitializeOneOff() must be called before
// initalizing the GpuDataManagerImpl as it uses the GL bindings.
diff --git a/content/browser/renderer_host/compositor_impl_android.cc b/content/browser/renderer_host/compositor_impl_android.cc
index 853684f..41c4acb 100644
--- a/content/browser/renderer_host/compositor_impl_android.cc
+++ b/content/browser/renderer_host/compositor_impl_android.cc
@@ -146,7 +146,7 @@ class SingleThreadTaskGraphRunner
SingleThreadTaskGraphRunner()
: worker_thread_(this, "CompositorTileWorker1") {
worker_thread_.Start();
- worker_thread_.SetThreadPriority(base::kThreadPriority_Background);
+ worker_thread_.SetThreadPriority(base::ThreadPriority::BACKGROUND);
}
~SingleThreadTaskGraphRunner() override {
diff --git a/content/child/child_process.cc b/content/child/child_process.cc
index db73ea3..e4da856 100644
--- a/content/child/child_process.cc
+++ b/content/child/child_process.cc
@@ -48,7 +48,7 @@ ChildProcess::ChildProcess()
base::Thread::Options(base::MessageLoop::TYPE_IO, 0)));
#if defined(OS_ANDROID)
- io_thread_.SetPriority(base::kThreadPriority_Display);
+ io_thread_.SetPriority(base::ThreadPriority::DISPLAY);
#endif
}
diff --git a/content/gpu/gpu_child_thread.cc b/content/gpu/gpu_child_thread.cc
index 6c34189..3d26c84 100644
--- a/content/gpu/gpu_child_thread.cc
+++ b/content/gpu/gpu_child_thread.cc
@@ -166,9 +166,8 @@ void GpuChildThread::OnInitialize() {
}
#if defined(OS_ANDROID)
- base::PlatformThread::SetThreadPriority(
- base::PlatformThread::CurrentHandle(),
- base::kThreadPriority_Display);
+ base::PlatformThread::SetThreadPriority(base::PlatformThread::CurrentHandle(),
+ base::ThreadPriority::DISPLAY);
#endif
// We don't need to pipe log messages if we are running the GPU thread in
diff --git a/content/renderer/gpu/compositor_output_surface.cc b/content/renderer/gpu/compositor_output_surface.cc
index 0ce2973..bdeefe0 100644
--- a/content/renderer/gpu/compositor_output_surface.cc
+++ b/content/renderer/gpu/compositor_output_surface.cc
@@ -215,12 +215,12 @@ bool CompositorOutputSurface::Send(IPC::Message* message) {
namespace {
#if defined(OS_ANDROID)
void SetThreadPriorityToIdle(base::PlatformThreadHandle handle) {
- base::PlatformThread::SetThreadPriority(
- handle, base::kThreadPriority_Background);
+ base::PlatformThread::SetThreadPriority(handle,
+ base::ThreadPriority::BACKGROUND);
}
void SetThreadPriorityToDefault(base::PlatformThreadHandle handle) {
- base::PlatformThread::SetThreadPriority(
- handle, base::kThreadPriority_Normal);
+ base::PlatformThread::SetThreadPriority(handle,
+ base::ThreadPriority::NORMAL);
}
#else
void SetThreadPriorityToIdle(base::PlatformThreadHandle handle) {}
diff --git a/content/renderer/media/webrtc_local_audio_track_unittest.cc b/content/renderer/media/webrtc_local_audio_track_unittest.cc
index 5fdf43a..2300f4a5 100644
--- a/content/renderer/media/webrtc_local_audio_track_unittest.cc
+++ b/content/renderer/media/webrtc_local_audio_track_unittest.cc
@@ -66,7 +66,7 @@ class FakeAudioThread : public base::PlatformThread::Delegate {
void Start() {
base::PlatformThread::CreateWithPriority(
- 0, this, &thread_, base::kThreadPriority_RealtimeAudio);
+ 0, this, &thread_, base::ThreadPriority::REALTIME_AUDIO);
CHECK(!thread_.is_null());
}
diff --git a/content/renderer/render_thread_impl.cc b/content/renderer/render_thread_impl.cc
index ffbf609..3d713e0 100644
--- a/content/renderer/render_thread_impl.cc
+++ b/content/renderer/render_thread_impl.cc
@@ -671,7 +671,7 @@ void RenderThreadImpl::Init() {
#if defined(OS_ANDROID) || defined(OS_LINUX)
if (!command_line.HasSwitch(
switches::kUseNormalPriorityForTileTaskWorkerThreads)) {
- raster_thread->SetThreadPriority(base::kThreadPriority_Background);
+ raster_thread->SetThreadPriority(base::ThreadPriority::BACKGROUND);
}
#endif
compositor_raster_threads_.push_back(raster_thread.Pass());
@@ -1036,7 +1036,7 @@ void RenderThreadImpl::EnsureWebKitInitialized() {
compositor_thread_.reset(new base::Thread("Compositor"));
compositor_thread_->Start();
#if defined(OS_ANDROID)
- compositor_thread_->SetPriority(base::kThreadPriority_Display);
+ compositor_thread_->SetPriority(base::ThreadPriority::DISPLAY);
#endif
compositor_message_loop_proxy_ =
compositor_thread_->message_loop_proxy();
diff --git a/gpu/command_buffer/service/async_pixel_transfer_manager_egl.cc b/gpu/command_buffer/service/async_pixel_transfer_manager_egl.cc
index f0faded..dc8e32d 100644
--- a/gpu/command_buffer/service/async_pixel_transfer_manager_egl.cc
+++ b/gpu/command_buffer/service/async_pixel_transfer_manager_egl.cc
@@ -90,7 +90,7 @@ class TransferThread : public base::Thread {
TransferThread() : base::Thread(kAsyncTransferThreadName) {
Start();
#if defined(OS_ANDROID) || defined(OS_LINUX)
- SetPriority(base::kThreadPriority_Background);
+ SetPriority(base::ThreadPriority::BACKGROUND);
#endif
}
~TransferThread() override { Stop(); }
@@ -466,14 +466,14 @@ bool AsyncPixelTransferDelegateEGL::TransferIsInProgress() {
void AsyncPixelTransferDelegateEGL::WaitForTransferCompletion() {
if (state_->TransferIsInProgress()) {
#if defined(OS_ANDROID) || defined(OS_LINUX)
- g_transfer_thread.Pointer()->SetPriority(base::kThreadPriority_Display);
+ g_transfer_thread.Pointer()->SetPriority(base::ThreadPriority::DISPLAY);
#endif
state_->WaitForTransferCompletion();
DCHECK(!state_->TransferIsInProgress());
#if defined(OS_ANDROID) || defined(OS_LINUX)
- g_transfer_thread.Pointer()->SetPriority(base::kThreadPriority_Background);
+ g_transfer_thread.Pointer()->SetPriority(base::ThreadPriority::BACKGROUND);
#endif
}
}
diff --git a/gpu/command_buffer/service/async_pixel_transfer_manager_share_group.cc b/gpu/command_buffer/service/async_pixel_transfer_manager_share_group.cc
index 16089f6..47cdf9e 100644
--- a/gpu/command_buffer/service/async_pixel_transfer_manager_share_group.cc
+++ b/gpu/command_buffer/service/async_pixel_transfer_manager_share_group.cc
@@ -47,7 +47,7 @@ class TransferThread : public base::Thread {
initialized_(false) {
Start();
#if defined(OS_ANDROID) || defined(OS_LINUX)
- SetPriority(base::kThreadPriority_Background);
+ SetPriority(base::ThreadPriority::BACKGROUND);
#endif
}
diff --git a/media/audio/audio_device_thread.cc b/media/audio/audio_device_thread.cc
index a4bab01..a0f283e 100644
--- a/media/audio/audio_device_thread.cc
+++ b/media/audio/audio_device_thread.cc
@@ -115,7 +115,7 @@ void AudioDeviceThread::Thread::Start() {
AddRef();
PlatformThread::CreateWithPriority(0, this, &thread_,
- base::kThreadPriority_RealtimeAudio);
+ base::ThreadPriority::REALTIME_AUDIO);
CHECK(!thread_.is_null());
}
diff --git a/media/audio/win/audio_low_latency_input_win.cc b/media/audio/win/audio_low_latency_input_win.cc
index 67426d6..72d1d72 100644
--- a/media/audio/win/audio_low_latency_input_win.cc
+++ b/media/audio/win/audio_low_latency_input_win.cc
@@ -353,7 +353,7 @@ void WASAPIAudioInputStream::Run() {
ScopedCOMInitializer com_init(ScopedCOMInitializer::kMTA);
// Increase the thread priority.
- capture_thread_->SetThreadPriority(base::kThreadPriority_RealtimeAudio);
+ capture_thread_->SetThreadPriority(base::ThreadPriority::REALTIME_AUDIO);
// Enable MMCSS to ensure that this thread receives prioritized access to
// CPU resources.
diff --git a/media/audio/win/audio_low_latency_output_win.cc b/media/audio/win/audio_low_latency_output_win.cc
index 5907f9c..f7b31a3 100644
--- a/media/audio/win/audio_low_latency_output_win.cc
+++ b/media/audio/win/audio_low_latency_output_win.cc
@@ -336,7 +336,7 @@ void WASAPIAudioOutputStream::Run() {
ScopedCOMInitializer com_init(ScopedCOMInitializer::kMTA);
// Increase the thread priority.
- render_thread_->SetThreadPriority(base::kThreadPriority_RealtimeAudio);
+ render_thread_->SetThreadPriority(base::ThreadPriority::REALTIME_AUDIO);
// Enable MMCSS to ensure that this thread receives prioritized access to
// CPU resources.