| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "base/threading/sequenced_task_runner_handle.h" | 5 #include "base/threading/sequenced_task_runner_handle.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "base/sequenced_task_runner.h" | 11 #include "base/sequenced_task_runner.h" |
| 12 #include "base/thread_task_runner_handle.h" | |
| 13 #include "base/threading/sequenced_worker_pool.h" | 12 #include "base/threading/sequenced_worker_pool.h" |
| 14 #include "base/threading/thread_local.h" | 13 #include "base/threading/thread_local.h" |
| 14 #include "base/threading/thread_task_runner_handle.h" |
| 15 | 15 |
| 16 namespace base { | 16 namespace base { |
| 17 | 17 |
| 18 namespace { | 18 namespace { |
| 19 | 19 |
| 20 base::LazyInstance<base::ThreadLocalPointer<SequencedTaskRunnerHandle>>::Leaky | 20 base::LazyInstance<base::ThreadLocalPointer<SequencedTaskRunnerHandle>>::Leaky |
| 21 lazy_tls_ptr = LAZY_INSTANCE_INITIALIZER; | 21 lazy_tls_ptr = LAZY_INSTANCE_INITIALIZER; |
| 22 | 22 |
| 23 } // namespace | 23 } // namespace |
| 24 | 24 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 lazy_tls_ptr.Pointer()->Set(this); | 60 lazy_tls_ptr.Pointer()->Set(this); |
| 61 } | 61 } |
| 62 | 62 |
| 63 SequencedTaskRunnerHandle::~SequencedTaskRunnerHandle() { | 63 SequencedTaskRunnerHandle::~SequencedTaskRunnerHandle() { |
| 64 DCHECK(task_runner_->RunsTasksOnCurrentThread()); | 64 DCHECK(task_runner_->RunsTasksOnCurrentThread()); |
| 65 DCHECK_EQ(lazy_tls_ptr.Pointer()->Get(), this); | 65 DCHECK_EQ(lazy_tls_ptr.Pointer()->Get(), this); |
| 66 lazy_tls_ptr.Pointer()->Set(nullptr); | 66 lazy_tls_ptr.Pointer()->Set(nullptr); |
| 67 } | 67 } |
| 68 | 68 |
| 69 } // namespace base | 69 } // namespace base |
| OLD | NEW |