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

Unified Diff: native_client_sdk/src/libraries/sdk_util/ref_object.h

Issue 18644009: [NaCl SDK] Upate atomic ops in nacl_io (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 'Move comment to correct location' Created 7 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 side-by-side diff with in-line comments
Download patch
Index: native_client_sdk/src/libraries/sdk_util/ref_object.h
diff --git a/native_client_sdk/src/libraries/sdk_util/ref_object.h b/native_client_sdk/src/libraries/sdk_util/ref_object.h
index e446e8014176a68e4cdca6681a80539fc8dd6167..88fcee9b8e1112b375fb7960e297234351afefed 100644
--- a/native_client_sdk/src/libraries/sdk_util/ref_object.h
+++ b/native_client_sdk/src/libraries/sdk_util/ref_object.h
@@ -16,9 +16,8 @@ class ScopedRefBase;
/*
* RefObject
*
- * A reference counted object with a lock. The lock protects the data within
- * the object, but not the reference counting which happens through atomic
- * operations. RefObjects should only be handled by ScopedRef objects.
+ * A reference counted object. RefObjects should only be handled by ScopedRef
+ * objects.
*
* When the object is first created, it has a reference count of zero. It's
* first incremented when it gets assigned to a ScopedRef. When the last
@@ -29,7 +28,6 @@ class RefObject {
public:
RefObject() {
ref_count_ = 0;
- pthread_mutex_init(&lock_, NULL);
}
/*
@@ -44,6 +42,11 @@ class RefObject {
int RefCount() const { return ref_count_; }
protected:
+ virtual ~RefObject() {}
+
+ // Override to clean up object when last reference is released.
+ virtual void Destroy() {}
+
void Acquire() {
AtomicAddFetch(&ref_count_, 1);
}
@@ -58,14 +61,6 @@ class RefObject {
return true;
}
- virtual ~RefObject() {
- pthread_mutex_destroy(&lock_);
- }
-
- // Override to clean up object when last reference is released.
- virtual void Destroy() {}
- pthread_mutex_t lock_;
-
private:
Atomic32 ref_count_;

Powered by Google App Engine
This is Rietveld 408576698