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

Side by Side Diff: components/metrics/leak_detector/leak_detector.cc

Issue 2889683003: Rename TaskRunner::RunsTasksOnCurrentThread() in //components (Closed)
Patch Set: rebase Created 3 years, 6 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "components/metrics/leak_detector/leak_detector.h" 5 #include "components/metrics/leak_detector/leak_detector.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 331
332 inline bool LeakDetector::ShouldSample(const void* ptr) const { 332 inline bool LeakDetector::ShouldSample(const void* ptr) const {
333 return PointerToHash(ptr) < sampling_factor_; 333 return PointerToHash(ptr) < sampling_factor_;
334 } 334 }
335 335
336 void LeakDetector::NotifyObservers( 336 void LeakDetector::NotifyObservers(
337 const std::vector<MemoryLeakReportProto>& reports) { 337 const std::vector<MemoryLeakReportProto>& reports) {
338 if (reports.empty()) 338 if (reports.empty())
339 return; 339 return;
340 340
341 if (!task_runner_->RunsTasksOnCurrentThread()) { 341 if (!task_runner_->RunsTasksInCurrentSequence()) {
342 task_runner_->PostTask(FROM_HERE, 342 task_runner_->PostTask(FROM_HERE,
343 base::Bind(&LeakDetector::NotifyObservers, 343 base::Bind(&LeakDetector::NotifyObservers,
344 base::Unretained(this), reports)); 344 base::Unretained(this), reports));
345 return; 345 return;
346 } 346 }
347 347
348 { 348 {
349 base::AutoLock lock(observers_lock_); 349 base::AutoLock lock(observers_lock_);
350 for (Observer& observer : observers_) 350 for (Observer& observer : observers_)
351 observer.OnLeaksFound(reports); 351 observer.OnLeaksFound(reports);
352 } 352 }
353 } 353 }
354 354
355 } // namespace metrics 355 } // namespace metrics
OLDNEW
« no previous file with comments | « components/keyed_service/core/refcounted_keyed_service.cc ('k') | components/policy/core/browser/url_blacklist_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698