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

Side by Side Diff: chrome/browser/process_resource_usage.cc

Issue 1551503002: Convert Pass()→std::move() in //chrome (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 12 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "chrome/browser/process_resource_usage.h" 5 #include "chrome/browser/process_resource_usage.h"
6 6
7 #include <utility>
8
7 #include "base/bind.h" 9 #include "base/bind.h"
8 #include "base/location.h" 10 #include "base/location.h"
9 #include "base/logging.h" 11 #include "base/logging.h"
10 #include "base/single_thread_task_runner.h" 12 #include "base/single_thread_task_runner.h"
11 #include "base/thread_task_runner_handle.h" 13 #include "base/thread_task_runner_handle.h"
12 #include "chrome/common/resource_usage_reporter_type_converters.h" 14 #include "chrome/common/resource_usage_reporter_type_converters.h"
13 15
14 ProcessResourceUsage::ProcessResourceUsage(ResourceUsageReporterPtr service) 16 ProcessResourceUsage::ProcessResourceUsage(ResourceUsageReporterPtr service)
15 : service_(service.Pass()), update_in_progress_(false) { 17 : service_(std::move(service)), update_in_progress_(false) {
16 service_.set_connection_error_handler( 18 service_.set_connection_error_handler(
17 base::Bind(&ProcessResourceUsage::RunPendingRefreshCallbacks, 19 base::Bind(&ProcessResourceUsage::RunPendingRefreshCallbacks,
18 base::Unretained(this))); 20 base::Unretained(this)));
19 } 21 }
20 22
21 ProcessResourceUsage::~ProcessResourceUsage() { 23 ProcessResourceUsage::~ProcessResourceUsage() {
22 DCHECK(thread_checker_.CalledOnValidThread()); 24 DCHECK(thread_checker_.CalledOnValidThread());
23 } 25 }
24 26
25 void ProcessResourceUsage::RunPendingRefreshCallbacks() { 27 void ProcessResourceUsage::RunPendingRefreshCallbacks() {
(...skipping 18 matching lines...) Expand all
44 if (!update_in_progress_) { 46 if (!update_in_progress_) {
45 update_in_progress_ = true; 47 update_in_progress_ = true;
46 service_->GetUsageData(base::Bind(&ProcessResourceUsage::OnRefreshDone, 48 service_->GetUsageData(base::Bind(&ProcessResourceUsage::OnRefreshDone,
47 base::Unretained(this))); 49 base::Unretained(this)));
48 } 50 }
49 } 51 }
50 52
51 void ProcessResourceUsage::OnRefreshDone(ResourceUsageDataPtr data) { 53 void ProcessResourceUsage::OnRefreshDone(ResourceUsageDataPtr data) {
52 DCHECK(thread_checker_.CalledOnValidThread()); 54 DCHECK(thread_checker_.CalledOnValidThread());
53 update_in_progress_ = false; 55 update_in_progress_ = false;
54 stats_ = data.Pass(); 56 stats_ = std::move(data);
55 RunPendingRefreshCallbacks(); 57 RunPendingRefreshCallbacks();
56 } 58 }
57 59
58 bool ProcessResourceUsage::ReportsV8MemoryStats() const { 60 bool ProcessResourceUsage::ReportsV8MemoryStats() const {
59 DCHECK(thread_checker_.CalledOnValidThread()); 61 DCHECK(thread_checker_.CalledOnValidThread());
60 if (stats_) 62 if (stats_)
61 return stats_->reports_v8_stats; 63 return stats_->reports_v8_stats;
62 return false; 64 return false;
63 } 65 }
64 66
(...skipping 11 matching lines...) Expand all
76 return 0; 78 return 0;
77 } 79 }
78 80
79 blink::WebCache::ResourceTypeStats ProcessResourceUsage::GetWebCoreCacheStats() 81 blink::WebCache::ResourceTypeStats ProcessResourceUsage::GetWebCoreCacheStats()
80 const { 82 const {
81 DCHECK(thread_checker_.CalledOnValidThread()); 83 DCHECK(thread_checker_.CalledOnValidThread());
82 if (stats_ && stats_->web_cache_stats) 84 if (stats_ && stats_->web_cache_stats)
83 return stats_->web_cache_stats->To<blink::WebCache::ResourceTypeStats>(); 85 return stats_->web_cache_stats->To<blink::WebCache::ResourceTypeStats>();
84 return {}; 86 return {};
85 } 87 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698