Index: base/sequence_checker_impl.cc |
diff --git a/base/sequence_checker_impl.cc b/base/sequence_checker_impl.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..24d9ed99a147c7c5a8d2db69557b3f891851cfa4 |
--- /dev/null |
+++ b/base/sequence_checker_impl.cc |
@@ -0,0 +1,31 @@ |
+// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "base/sequence_checker_impl.h" |
+ |
+#include "base/sequenced_task_runner.h" |
+ |
+namespace base { |
+ |
+SequenceCheckerImpl::SequenceCheckerImpl( |
+ const scoped_refptr<SequencedTaskRunner>& sequenced_task_runner) |
+ : sequenced_task_runner_(sequenced_task_runner) {} |
+ |
+SequenceCheckerImpl::~SequenceCheckerImpl() {} |
+ |
+bool SequenceCheckerImpl::CalledOnValidSequence() const { |
+ AutoLock auto_lock(lock_); |
+ return sequenced_task_runner_.get() ? |
+ sequenced_task_runner_->RunsTasksOnCurrentThread() : |
michaeln
2012/12/21 22:07:31
Hmmm... as coded right now, the base::Bind closure
akalin
2012/12/21 23:11:51
Hmm that may indeed be a problem. I'll look into
jar (doing other things)
2012/12/21 23:50:41
It is always good hygiene to do the least possible
akalin
2012/12/22 00:00:04
But that entire block of code (that michaeln@ ment
michaeln
2012/12/22 00:21:53
This IsRunningSequenceOnCurrentThread went in with
jar (doing other things)
2012/12/26 22:39:08
My mistake. I conflated the comment about *distan
|
+ thread_checker_.CalledOnValidThread(); |
+} |
+ |
+void SequenceCheckerImpl::ChangeSequence( |
+ const scoped_refptr<SequencedTaskRunner>& sequenced_task_runner) { |
+ AutoLock auto_lock(lock_); |
+ sequenced_task_runner_ = sequenced_task_runner; |
+ thread_checker_.DetachFromThread(); |
+} |
+ |
+} // namespace base |