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

Side by Side Diff: base/threading/worker_pool.cc

Issue 23514070: Annotate WorkerPool::PostTaskAndReply as leaky. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: improved the comment Created 7 years, 3 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/threading/worker_pool.h" 5 #include "base/threading/worker_pool.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/debug/leak_annotations.h"
9 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
10 #include "base/task_runner.h" 11 #include "base/task_runner.h"
11 #include "base/threading/post_task_and_reply_impl.h" 12 #include "base/threading/post_task_and_reply_impl.h"
12 #include "base/tracked_objects.h" 13 #include "base/tracked_objects.h"
13 14
14 namespace base { 15 namespace base {
15 16
16 namespace { 17 namespace {
17 18
18 class PostTaskAndReplyWorkerPool : public internal::PostTaskAndReplyImpl { 19 class PostTaskAndReplyWorkerPool : public internal::PostTaskAndReplyImpl {
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 98
98 base::LazyInstance<TaskRunnerHolder>::Leaky 99 base::LazyInstance<TaskRunnerHolder>::Leaky
99 g_taskrunners = LAZY_INSTANCE_INITIALIZER; 100 g_taskrunners = LAZY_INSTANCE_INITIALIZER;
100 101
101 } // namespace 102 } // namespace
102 103
103 bool WorkerPool::PostTaskAndReply(const tracked_objects::Location& from_here, 104 bool WorkerPool::PostTaskAndReply(const tracked_objects::Location& from_here,
104 const Closure& task, 105 const Closure& task,
105 const Closure& reply, 106 const Closure& reply,
106 bool task_is_slow) { 107 bool task_is_slow) {
108 // Do not report PostTaskAndReplyRelay leaks in tests. There's nothing we can
109 // do about them because WorkerPool doesn't have a flushing API.
110 // http://crbug.com/248513
111 // http://crbug.com/290897
112 // Note: this annotation does not cover tasks posted through a TaskRunner.
113 ANNOTATE_SCOPED_MEMORY_LEAK;
107 return PostTaskAndReplyWorkerPool(task_is_slow).PostTaskAndReply( 114 return PostTaskAndReplyWorkerPool(task_is_slow).PostTaskAndReply(
108 from_here, task, reply); 115 from_here, task, reply);
109 } 116 }
110 117
111 // static 118 // static
112 const scoped_refptr<TaskRunner>& 119 const scoped_refptr<TaskRunner>&
113 WorkerPool::GetTaskRunner(bool tasks_are_slow) { 120 WorkerPool::GetTaskRunner(bool tasks_are_slow) {
114 return g_taskrunners.Get().taskrunners_[tasks_are_slow]; 121 return g_taskrunners.Get().taskrunners_[tasks_are_slow];
115 } 122 }
116 123
117 } // namespace base 124 } // namespace base
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698