OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #include "base/sequence_checker_impl.h" | |
6 | |
7 #include "base/sequenced_task_runner.h" | |
8 | |
9 namespace base { | |
10 | |
11 SequenceCheckerImpl::SequenceCheckerImpl( | |
12 const scoped_refptr<SequencedTaskRunner>& sequenced_task_runner) | |
13 : sequenced_task_runner_(sequenced_task_runner) {} | |
14 | |
15 SequenceCheckerImpl::~SequenceCheckerImpl() {} | |
16 | |
17 bool SequenceCheckerImpl::CalledOnValidSequence() const { | |
18 AutoLock auto_lock(lock_); | |
19 return sequenced_task_runner_.get() ? | |
20 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
| |
21 thread_checker_.CalledOnValidThread(); | |
22 } | |
23 | |
24 void SequenceCheckerImpl::ChangeSequence( | |
25 const scoped_refptr<SequencedTaskRunner>& sequenced_task_runner) { | |
26 AutoLock auto_lock(lock_); | |
27 sequenced_task_runner_ = sequenced_task_runner; | |
28 thread_checker_.DetachFromThread(); | |
29 } | |
30 | |
31 } // namespace base | |
OLD | NEW |