summaryrefslogtreecommitdiffstats
path: root/base/memory
diff options
context:
space:
mode:
authortommycli@chromium.org <tommycli@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-07-17 05:35:14 +0000
committertommycli@chromium.org <tommycli@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-07-17 05:35:14 +0000
commit09a10057e09de243a53915d7ebeaad19c2f9e029 (patch)
tree5ad6b83e83b7aaec801fdc58621f65a685e54d3f /base/memory
parenta8c2847f56e56cc0470f807585dfc4a873902e9f (diff)
downloadchromium_src-09a10057e09de243a53915d7ebeaad19c2f9e029.zip
chromium_src-09a10057e09de243a53915d7ebeaad19c2f9e029.tar.gz
chromium_src-09a10057e09de243a53915d7ebeaad19c2f9e029.tar.bz2
base: Change WeakPtr to use SequenceChecker instead of ThreadChecker.
This will enable WeakPtr to be used in SequencedWorkerPool, et al. with a sequence token. This is a continuation of issue: https://chromiumcodereview.appspot.com/18231002/ The original issue got messed up by a rietveld bug, so refer there for history and comments. BUG=165590 Review URL: https://chromiumcodereview.appspot.com/18501008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@211956 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/memory')
-rw-r--r--base/memory/weak_ptr.cc12
-rw-r--r--base/memory/weak_ptr.h6
2 files changed, 9 insertions, 9 deletions
diff --git a/base/memory/weak_ptr.cc b/base/memory/weak_ptr.cc
index a22f61a..d9ce86a 100644
--- a/base/memory/weak_ptr.cc
+++ b/base/memory/weak_ptr.cc
@@ -10,21 +10,21 @@ namespace internal {
WeakReference::Flag::Flag() : is_valid_(true) {
// Flags only become bound when checked for validity, or invalidated,
// so that we can check that later validity/invalidation operations on
- // the same Flag take place on the same thread.
- thread_checker_.DetachFromThread();
+ // the same Flag take place on the same sequenced thread.
+ sequence_checker_.DetachFromSequence();
}
void WeakReference::Flag::Invalidate() {
// The flag being invalidated with a single ref implies that there are no
// weak pointers in existence. Allow deletion on other thread in this case.
- DCHECK(thread_checker_.CalledOnValidThread() || HasOneRef())
- << "WeakPtrs must be checked and invalidated on the same thread.";
+ DCHECK(sequence_checker_.CalledOnValidSequencedThread() || HasOneRef())
+ << "WeakPtrs must be invalidated on the same sequenced thread.";
is_valid_ = false;
}
bool WeakReference::Flag::IsValid() const {
- DCHECK(thread_checker_.CalledOnValidThread())
- << "WeakPtrs must be checked and invalidated on the same thread.";
+ DCHECK(sequence_checker_.CalledOnValidSequencedThread())
+ << "WeakPtrs must be checked on the same sequenced thread.";
return is_valid_;
}
diff --git a/base/memory/weak_ptr.h b/base/memory/weak_ptr.h
index 621c0fa..b4120a1 100644
--- a/base/memory/weak_ptr.h
+++ b/base/memory/weak_ptr.h
@@ -67,8 +67,8 @@
#include "base/base_export.h"
#include "base/logging.h"
#include "base/memory/ref_counted.h"
+#include "base/sequence_checker.h"
#include "base/template_util.h"
-#include "base/threading/thread_checker.h"
namespace base {
@@ -91,14 +91,14 @@ class BASE_EXPORT WeakReference {
bool IsValid() const;
// Remove this when crbug.com/234964 is addressed.
- void DetachFromThreadHack() { thread_checker_.DetachFromThread(); }
+ void DetachFromThreadHack() { sequence_checker_.DetachFromSequence(); }
private:
friend class base::RefCountedThreadSafe<Flag>;
~Flag();
- ThreadChecker thread_checker_;
+ SequenceChecker sequence_checker_;
bool is_valid_;
};