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

Side by Side Diff: webkit/glue/worker_task_runner.cc

Issue 9117038: Convert all remaining explicit LeakyLazyInstanceTraits users to ::Leaky (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 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/callback.h" 5 #include "base/callback.h"
6 #include "base/lazy_instance.h" 6 #include "base/lazy_instance.h"
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/observer_list.h" 9 #include "base/observer_list.h"
10 #include "webkit/glue/worker_task_runner.h" 10 #include "webkit/glue/worker_task_runner.h"
11 11
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 found->second.postTask(new RunClosureTask(closure)); 52 found->second.postTask(new RunClosureTask(closure));
53 } 53 }
54 54
55 int WorkerTaskRunner::CurrentWorkerId() { 55 int WorkerTaskRunner::CurrentWorkerId() {
56 if (!current_tls_.Get()) 56 if (!current_tls_.Get())
57 return 0; 57 return 0;
58 return current_tls_.Get()->id_; 58 return current_tls_.Get()->id_;
59 } 59 }
60 60
61 WorkerTaskRunner* WorkerTaskRunner::Instance() { 61 WorkerTaskRunner* WorkerTaskRunner::Instance() {
62 static base::LazyInstance<WorkerTaskRunner, 62 static base::LazyInstance<WorkerTaskRunner>::Leaky
63 base::LeakyLazyInstanceTraits<WorkerTaskRunner> > 63 worker_task_runner = LAZY_INSTANCE_INITIALIZER;
64 worker_task_runner = LAZY_INSTANCE_INITIALIZER;
65 return worker_task_runner.Pointer(); 64 return worker_task_runner.Pointer();
66 } 65 }
67 66
68 void WorkerTaskRunner::AddStopObserver(Observer* obs) { 67 void WorkerTaskRunner::AddStopObserver(Observer* obs) {
69 DCHECK(CurrentWorkerId() > 0); 68 DCHECK(CurrentWorkerId() > 0);
70 current_tls_.Get()->stop_observers_.AddObserver(obs); 69 current_tls_.Get()->stop_observers_.AddObserver(obs);
71 } 70 }
72 71
73 void WorkerTaskRunner::RemoveStopObserver(Observer* obs) { 72 void WorkerTaskRunner::RemoveStopObserver(Observer* obs) {
74 DCHECK(CurrentWorkerId() > 0); 73 DCHECK(CurrentWorkerId() > 0);
(...skipping 19 matching lines...) Expand all
94 { 93 {
95 base::AutoLock locker(loop_map_lock_); 94 base::AutoLock locker(loop_map_lock_);
96 DCHECK(loop_map_[CurrentWorkerId()] == loop); 95 DCHECK(loop_map_[CurrentWorkerId()] == loop);
97 loop_map_.erase(CurrentWorkerId()); 96 loop_map_.erase(CurrentWorkerId());
98 } 97 }
99 delete current_tls_.Get(); 98 delete current_tls_.Get();
100 current_tls_.Set(NULL); 99 current_tls_.Set(NULL);
101 } 100 }
102 101
103 } // namespace webkit_glue 102 } // namespace webkit_glue
OLDNEW
« no previous file with comments | « third_party/leveldatabase/env_chromium.cc ('k') | webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698