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

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

Issue 2344153002: Made g_lazy_worker_pool leaky (Closed)
Patch Set: Created 4 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
« 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_posix.h" 5 #include "base/threading/worker_pool_posix.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 WorkerPoolImpl::~WorkerPoolImpl() { 50 WorkerPoolImpl::~WorkerPoolImpl() {
51 pool_->Terminate(); 51 pool_->Terminate();
52 } 52 }
53 53
54 void WorkerPoolImpl::PostTask(const tracked_objects::Location& from_here, 54 void WorkerPoolImpl::PostTask(const tracked_objects::Location& from_here,
55 const base::Closure& task, 55 const base::Closure& task,
56 bool task_is_slow) { 56 bool task_is_slow) {
57 pool_->PostTask(from_here, task); 57 pool_->PostTask(from_here, task);
58 } 58 }
59 59
60 base::LazyInstance<WorkerPoolImpl> g_lazy_worker_pool = 60 base::LazyInstance<WorkerPoolImpl>::Leaky g_lazy_worker_pool =
61 LAZY_INSTANCE_INITIALIZER; 61 LAZY_INSTANCE_INITIALIZER;
62 62
63 class WorkerThread : public PlatformThread::Delegate { 63 class WorkerThread : public PlatformThread::Delegate {
64 public: 64 public:
65 WorkerThread(const std::string& name_prefix, 65 WorkerThread(const std::string& name_prefix,
66 base::PosixDynamicThreadPool* pool) 66 base::PosixDynamicThreadPool* pool)
67 : name_prefix_(name_prefix), pool_(pool) {} 67 : name_prefix_(name_prefix), pool_(pool) {}
68 68
69 void ThreadMain() override; 69 void ThreadMain() override;
70 70
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 return PendingTask(FROM_HERE, base::Closure()); 184 return PendingTask(FROM_HERE, base::Closure());
185 } 185 }
186 } 186 }
187 187
188 PendingTask pending_task = std::move(pending_tasks_.front()); 188 PendingTask pending_task = std::move(pending_tasks_.front());
189 pending_tasks_.pop(); 189 pending_tasks_.pop();
190 return pending_task; 190 return pending_task;
191 } 191 }
192 192
193 } // namespace base 193 } // 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