Simple Cache: a few tests for rare corner cases with CRC check missing.
[chromium-blink-merge.git] / base / sequence_checker_impl.cc
blob24d9ed99a147c7c5a8d2db69557b3f891851cfa4
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.
5 #include "base/sequence_checker_impl.h"
7 #include "base/sequenced_task_runner.h"
9 namespace base {
11 SequenceCheckerImpl::SequenceCheckerImpl(
12 const scoped_refptr<SequencedTaskRunner>& sequenced_task_runner)
13 : sequenced_task_runner_(sequenced_task_runner) {}
15 SequenceCheckerImpl::~SequenceCheckerImpl() {}
17 bool SequenceCheckerImpl::CalledOnValidSequence() const {
18 AutoLock auto_lock(lock_);
19 return sequenced_task_runner_.get() ?
20 sequenced_task_runner_->RunsTasksOnCurrentThread() :
21 thread_checker_.CalledOnValidThread();
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();
31 } // namespace base