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 1207823004: PlatformThreadHandle: remove public id() interface (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: the last two nits Created 5 years, 5 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_posix.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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 66
67 // Used to operate on threads. 67 // Used to operate on threads.
68 class PlatformThreadHandle { 68 class PlatformThreadHandle {
69 public: 69 public:
70 #if defined(OS_WIN) 70 #if defined(OS_WIN)
71 typedef void* Handle; 71 typedef void* Handle;
72 #elif defined(OS_POSIX) 72 #elif defined(OS_POSIX)
73 typedef pthread_t Handle; 73 typedef pthread_t Handle;
74 #endif 74 #endif
75 75
76 PlatformThreadHandle() 76 PlatformThreadHandle() : handle_(0) {}
77 : handle_(0),
78 id_(0) {
79 }
80 77
81 explicit PlatformThreadHandle(Handle handle) 78 explicit PlatformThreadHandle(Handle handle) : handle_(handle) {}
82 : handle_(handle),
83 id_(0) {
84 }
85
86 PlatformThreadHandle(Handle handle,
87 PlatformThreadId id)
88 : handle_(handle),
89 id_(id) {
90 }
91
92 // TODO(toyoshim): Remove id() and use PlatformThread::CurrentId() instead.
93 PlatformThreadId id() const {
94 return id_;
95 }
96 79
97 bool is_equal(const PlatformThreadHandle& other) const { 80 bool is_equal(const PlatformThreadHandle& other) const {
98 return handle_ == other.handle_; 81 return handle_ == other.handle_;
99 } 82 }
100 83
101 bool is_null() const { 84 bool is_null() const {
102 return !handle_; 85 return !handle_;
103 } 86 }
104 87
105 Handle platform_handle() const { 88 Handle platform_handle() const {
106 return handle_; 89 return handle_;
107 } 90 }
108 91
109 private: 92 private:
110 Handle handle_; 93 Handle handle_;
111 PlatformThreadId id_;
112 }; 94 };
113 95
114 const PlatformThreadId kInvalidThreadId(0); 96 const PlatformThreadId kInvalidThreadId(0);
115 97
116 // Valid values for priority of Thread::Options and SimpleThread::Options, and 98 // Valid values for priority of Thread::Options and SimpleThread::Options, and
117 // SetCurrentThreadPriority(), listed in increasing order of importance. 99 // SetCurrentThreadPriority(), listed in increasing order of importance.
118 enum class ThreadPriority { 100 enum class ThreadPriority {
119 // Suitable for threads that shouldn't disrupt high priority work. 101 // Suitable for threads that shouldn't disrupt high priority work.
120 BACKGROUND, 102 BACKGROUND,
121 // Default priority level. 103 // Default priority level.
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 184
203 static ThreadPriority GetCurrentThreadPriority(); 185 static ThreadPriority GetCurrentThreadPriority();
204 186
205 private: 187 private:
206 DISALLOW_IMPLICIT_CONSTRUCTORS(PlatformThread); 188 DISALLOW_IMPLICIT_CONSTRUCTORS(PlatformThread);
207 }; 189 };
208 190
209 } // namespace base 191 } // namespace base
210 192
211 #endif // BASE_THREADING_PLATFORM_THREAD_H_ 193 #endif // BASE_THREADING_PLATFORM_THREAD_H_
OLDNEW
« no previous file with comments | « no previous file | base/threading/platform_thread_posix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698