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

Side by Side Diff: base/threading/platform_thread.h

Issue 1051863003: Turn ThreadPriority enum into an enum class. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@setthreadpri
Patch Set: nits Created 5 years, 8 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 | « no previous file | base/threading/platform_thread_android.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 // WARNING: You should *NOT* be using this class directly. PlatformThread is 5 // WARNING: You should *NOT* be using this class directly. PlatformThread is
6 // the low-level platform-specific abstraction to the OS's threading interface. 6 // the low-level platform-specific abstraction to the OS's threading interface.
7 // You should instead be using a message-loop driven Thread, see thread.h. 7 // You should instead be using a message-loop driven Thread, see thread.h.
8 8
9 #ifndef BASE_THREADING_PLATFORM_THREAD_H_ 9 #ifndef BASE_THREADING_PLATFORM_THREAD_H_
10 #define BASE_THREADING_PLATFORM_THREAD_H_ 10 #define BASE_THREADING_PLATFORM_THREAD_H_
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 103
104 private: 104 private:
105 friend class PlatformThread; 105 friend class PlatformThread;
106 106
107 Handle handle_; 107 Handle handle_;
108 PlatformThreadId id_; 108 PlatformThreadId id_;
109 }; 109 };
110 110
111 const PlatformThreadId kInvalidThreadId(0); 111 const PlatformThreadId kInvalidThreadId(0);
112 112
113 // Valid values for SetThreadPriority() 113 // Valid values for SetThreadPriority(), listed in increasing order of
114 enum ThreadPriority { 114 // importance.
115 kThreadPriority_Normal, 115 enum class ThreadPriority {
116 // Suitable for threads that shouldn't disrupt high priority work.
117 BACKGROUND,
118 // Default priority level.
119 NORMAL,
120 // Suitable for threads which generate data for the display (at ~60Hz).
121 DISPLAY,
116 // Suitable for low-latency, glitch-resistant audio. 122 // Suitable for low-latency, glitch-resistant audio.
117 kThreadPriority_RealtimeAudio, 123 REALTIME_AUDIO,
118 // Suitable for threads which generate data for the display (at ~60Hz).
119 kThreadPriority_Display,
120 // Suitable for threads that shouldn't disrupt high priority work.
121 kThreadPriority_Background
122 }; 124 };
123 125
124 // A namespace for low-level thread functions. 126 // A namespace for low-level thread functions.
125 class BASE_EXPORT PlatformThread { 127 class BASE_EXPORT PlatformThread {
126 public: 128 public:
127 // Implement this interface to run code on a background thread. Your 129 // Implement this interface to run code on a background thread. Your
128 // ThreadMain method will be called on the newly created thread. 130 // ThreadMain method will be called on the newly created thread.
129 class BASE_EXPORT Delegate { 131 class BASE_EXPORT Delegate {
130 public: 132 public:
131 virtual void ThreadMain() = 0; 133 virtual void ThreadMain() = 0;
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 196
195 static ThreadPriority GetThreadPriority(PlatformThreadHandle handle); 197 static ThreadPriority GetThreadPriority(PlatformThreadHandle handle);
196 198
197 private: 199 private:
198 DISALLOW_IMPLICIT_CONSTRUCTORS(PlatformThread); 200 DISALLOW_IMPLICIT_CONSTRUCTORS(PlatformThread);
199 }; 201 };
200 202
201 } // namespace base 203 } // namespace base
202 204
203 #endif // BASE_THREADING_PLATFORM_THREAD_H_ 205 #endif // BASE_THREADING_PLATFORM_THREAD_H_
OLDNEW
« no previous file with comments | « no previous file | base/threading/platform_thread_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698