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

Unified Diff: base/threading/thread_local_storage_posix.cc

Issue 9297010: Make it possible to use ThreadLocalStorage::Slot as a static without (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/threading/thread_local_storage.h ('k') | base/threading/thread_local_storage_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/threading/thread_local_storage_posix.cc
diff --git a/base/threading/thread_local_storage_posix.cc b/base/threading/thread_local_storage_posix.cc
index 3d0e18731021cd77de85f91a6492450d0cac016e..295d57c3a99a52a9b759572718fbd5d6738adc9b 100644
--- a/base/threading/thread_local_storage_posix.cc
+++ b/base/threading/thread_local_storage_posix.cc
@@ -8,13 +8,13 @@
namespace base {
-ThreadLocalStorage::Slot::Slot(TLSDestructorFunc destructor)
- : initialized_(false),
- key_(0) {
+ThreadLocalStorage::Slot::Slot(TLSDestructorFunc destructor) {
+ initialized_ = false;
+ key_ = 0;
Initialize(destructor);
}
-bool ThreadLocalStorage::Slot::Initialize(TLSDestructorFunc destructor) {
+bool ThreadLocalStorage::StaticSlot::Initialize(TLSDestructorFunc destructor) {
DCHECK(!initialized_);
int error = pthread_key_create(&key_, destructor);
if (error) {
@@ -26,7 +26,7 @@ bool ThreadLocalStorage::Slot::Initialize(TLSDestructorFunc destructor) {
return true;
}
-void ThreadLocalStorage::Slot::Free() {
+void ThreadLocalStorage::StaticSlot::Free() {
DCHECK(initialized_);
int error = pthread_key_delete(key_);
if (error)
@@ -34,12 +34,12 @@ void ThreadLocalStorage::Slot::Free() {
initialized_ = false;
}
-void* ThreadLocalStorage::Slot::Get() const {
+void* ThreadLocalStorage::StaticSlot::Get() const {
DCHECK(initialized_);
return pthread_getspecific(key_);
}
-void ThreadLocalStorage::Slot::Set(void* value) {
+void ThreadLocalStorage::StaticSlot::Set(void* value) {
DCHECK(initialized_);
int error = pthread_setspecific(key_, value);
if (error)
« no previous file with comments | « base/threading/thread_local_storage.h ('k') | base/threading/thread_local_storage_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698