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

Side by Side Diff: components/power/origin_power_map.cc

Issue 1921923002: Convert //components/[o-t]* from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 7 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 | « components/power/origin_power_map.h ('k') | components/precache/content/precache_manager.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/power/origin_power_map.h" 5 #include "components/power/origin_power_map.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "content/public/common/url_constants.h" 8 #include "content/public/common/url_constants.h"
9 #include "url/gurl.h" 9 #include "url/gurl.h"
10 10
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 return percent_map; 42 return percent_map;
43 43
44 for (OriginMap::iterator it = origin_map_.begin(); it != origin_map_.end(); 44 for (OriginMap::iterator it = origin_map_.begin(); it != origin_map_.end();
45 ++it) { 45 ++it) {
46 percent_map[it->first] = 46 percent_map[it->first] =
47 static_cast<int>(it->second * 100 / total_consumed_ + 0.5); 47 static_cast<int>(it->second * 100 / total_consumed_ + 0.5);
48 } 48 }
49 return percent_map; 49 return percent_map;
50 } 50 }
51 51
52 scoped_ptr<OriginPowerMap::Subscription> 52 std::unique_ptr<OriginPowerMap::Subscription>
53 OriginPowerMap::AddPowerConsumptionUpdatedCallback( 53 OriginPowerMap::AddPowerConsumptionUpdatedCallback(
54 const base::Closure& callback) { 54 const base::Closure& callback) {
55 return callback_list_.Add(callback); 55 return callback_list_.Add(callback);
56 } 56 }
57 57
58 void OriginPowerMap::OnAllOriginsUpdated() { 58 void OriginPowerMap::OnAllOriginsUpdated() {
59 callback_list_.Notify(); 59 callback_list_.Notify();
60 } 60 }
61 61
62 void OriginPowerMap::ClearOriginMap() { 62 void OriginPowerMap::ClearOriginMap() {
63 origin_map_.clear(); 63 origin_map_.clear();
64 total_consumed_ = 0; 64 total_consumed_ = 0;
65 } 65 }
66 66
67 } // namespace power 67 } // namespace power
OLDNEW
« no previous file with comments | « components/power/origin_power_map.h ('k') | components/precache/content/precache_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698