Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(974)

Unified Diff: base/thread_task_runner_handle.cc

Issue 1647803004: Move base to DEPS (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/thread_task_runner_handle.h ('k') | base/threading/OWNERS » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/thread_task_runner_handle.cc
diff --git a/base/thread_task_runner_handle.cc b/base/thread_task_runner_handle.cc
deleted file mode 100644
index 860a0ec31df0af8772a301c3ae3522fa09431635..0000000000000000000000000000000000000000
--- a/base/thread_task_runner_handle.cc
+++ /dev/null
@@ -1,46 +0,0 @@
-// 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/thread_task_runner_handle.h"
-
-#include "base/lazy_instance.h"
-#include "base/single_thread_task_runner.h"
-#include "base/threading/thread_local.h"
-
-namespace base {
-
-namespace {
-
-base::LazyInstance<base::ThreadLocalPointer<ThreadTaskRunnerHandle> >
- lazy_tls_ptr = LAZY_INSTANCE_INITIALIZER;
-
-} // namespace
-
-// static
-scoped_refptr<SingleThreadTaskRunner> ThreadTaskRunnerHandle::Get() {
- ThreadTaskRunnerHandle* current = lazy_tls_ptr.Pointer()->Get();
- DCHECK(current);
- return current->task_runner_;
-}
-
-// static
-bool ThreadTaskRunnerHandle::IsSet() {
- return lazy_tls_ptr.Pointer()->Get() != NULL;
-}
-
-ThreadTaskRunnerHandle::ThreadTaskRunnerHandle(
- const scoped_refptr<SingleThreadTaskRunner>& task_runner)
- : task_runner_(task_runner) {
- DCHECK(task_runner_->BelongsToCurrentThread());
- DCHECK(!lazy_tls_ptr.Pointer()->Get());
- lazy_tls_ptr.Pointer()->Set(this);
-}
-
-ThreadTaskRunnerHandle::~ThreadTaskRunnerHandle() {
- DCHECK(task_runner_->BelongsToCurrentThread());
- DCHECK_EQ(lazy_tls_ptr.Pointer()->Get(), this);
- lazy_tls_ptr.Pointer()->Set(NULL);
-}
-
-} // namespace base
« no previous file with comments | « base/thread_task_runner_handle.h ('k') | base/threading/OWNERS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698