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

Side by Side Diff: base/thread_task_runner_handle.cc

Issue 13461029: The continue window is owned by the desktop environment now. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix Mac. Created 7 years, 8 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 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/thread_task_runner_handle.h" 5 #include "base/thread_task_runner_handle.h"
6 6
7 #include "base/lazy_instance.h" 7 #include "base/lazy_instance.h"
8 #include "base/single_thread_task_runner.h" 8 #include "base/single_thread_task_runner.h"
9 #include "base/threading/thread_local.h" 9 #include "base/threading/thread_local.h"
10 10
11 namespace base { 11 namespace base {
12 12
13 namespace { 13 namespace {
14 14
15 base::LazyInstance<base::ThreadLocalPointer<ThreadTaskRunnerHandle> > 15 base::LazyInstance<base::ThreadLocalPointer<ThreadTaskRunnerHandle> >
16 lazy_tls_ptr = LAZY_INSTANCE_INITIALIZER; 16 lazy_tls_ptr = LAZY_INSTANCE_INITIALIZER;
17 17
18 } // namespace 18 } // namespace
19 19
20 // static 20 // static
21 scoped_refptr<SingleThreadTaskRunner> ThreadTaskRunnerHandle::Get() { 21 scoped_refptr<SingleThreadTaskRunner> ThreadTaskRunnerHandle::Get() {
22 ThreadTaskRunnerHandle* current = lazy_tls_ptr.Pointer()->Get(); 22 ThreadTaskRunnerHandle* current = lazy_tls_ptr.Pointer()->Get();
23 DCHECK(current); 23 if (!current)
24 return NULL;
25
24 return current->task_runner_; 26 return current->task_runner_;
25 } 27 }
26 28
27 ThreadTaskRunnerHandle::ThreadTaskRunnerHandle( 29 ThreadTaskRunnerHandle::ThreadTaskRunnerHandle(
28 const scoped_refptr<SingleThreadTaskRunner>& task_runner) 30 const scoped_refptr<SingleThreadTaskRunner>& task_runner)
29 : task_runner_(task_runner) { 31 : task_runner_(task_runner) {
30 DCHECK(task_runner_->BelongsToCurrentThread()); 32 DCHECK(task_runner_->BelongsToCurrentThread());
31 DCHECK(!lazy_tls_ptr.Pointer()->Get()); 33 DCHECK(!lazy_tls_ptr.Pointer()->Get());
32 lazy_tls_ptr.Pointer()->Set(this); 34 lazy_tls_ptr.Pointer()->Set(this);
33 } 35 }
34 36
35 ThreadTaskRunnerHandle::~ThreadTaskRunnerHandle() { 37 ThreadTaskRunnerHandle::~ThreadTaskRunnerHandle() {
36 DCHECK(task_runner_->BelongsToCurrentThread()); 38 DCHECK(task_runner_->BelongsToCurrentThread());
37 DCHECK_EQ(lazy_tls_ptr.Pointer()->Get(), this); 39 DCHECK_EQ(lazy_tls_ptr.Pointer()->Get(), this);
38 lazy_tls_ptr.Pointer()->Set(NULL); 40 lazy_tls_ptr.Pointer()->Set(NULL);
39 } 41 }
40 42
41 } // namespace base 43 } // namespace base
OLDNEW
« no previous file with comments | « no previous file | remoting/host/basic_desktop_environment.h » ('j') | remoting/host/plugin/host_script_object.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698