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

Side by Side Diff: components/sync_driver/tab_node_pool.cc

Issue 1349783006: Cleanup: Pass std::string as const reference if possible (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Revert third_party changes Created 5 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
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/sync_driver/tab_node_pool.h" 5 #include "components/sync_driver/tab_node_pool.h"
6 6
7 #include "base/format_macros.h" 7 #include "base/format_macros.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/strings/stringprintf.h" 9 #include "base/strings/stringprintf.h"
10 #include "sync/api/sync_change.h" 10 #include "sync/api/sync_change.h"
(...skipping 10 matching lines...) Expand all
21 TabNodePool::TabNodePool() 21 TabNodePool::TabNodePool()
22 : max_used_tab_node_id_(kInvalidTabNodeID) {} 22 : max_used_tab_node_id_(kInvalidTabNodeID) {}
23 23
24 // static 24 // static
25 // We start vending tab node IDs at 0. 25 // We start vending tab node IDs at 0.
26 const int TabNodePool::kInvalidTabNodeID = -1; 26 const int TabNodePool::kInvalidTabNodeID = -1;
27 27
28 TabNodePool::~TabNodePool() {} 28 TabNodePool::~TabNodePool() {}
29 29
30 // Static 30 // Static
31 std::string TabNodePool::TabIdToTag( 31 std::string TabNodePool::TabIdToTag(const std::string& machine_tag,
32 const std::string machine_tag, int tab_node_id) { 32 int tab_node_id) {
33 return base::StringPrintf("%s %d", machine_tag.c_str(), tab_node_id); 33 return base::StringPrintf("%s %d", machine_tag.c_str(), tab_node_id);
34 } 34 }
35 35
36 void TabNodePool::AddTabNode(int tab_node_id) { 36 void TabNodePool::AddTabNode(int tab_node_id) {
37 DCHECK_GT(tab_node_id, kInvalidTabNodeID); 37 DCHECK_GT(tab_node_id, kInvalidTabNodeID);
38 DCHECK(nodeid_tabid_map_.find(tab_node_id) == nodeid_tabid_map_.end()); 38 DCHECK(nodeid_tabid_map_.find(tab_node_id) == nodeid_tabid_map_.end());
39 unassociated_nodes_.insert(tab_node_id); 39 unassociated_nodes_.insert(tab_node_id);
40 if (max_used_tab_node_id_ < tab_node_id) 40 if (max_used_tab_node_id_ < tab_node_id)
41 max_used_tab_node_id_ = tab_node_id; 41 max_used_tab_node_id_ = tab_node_id;
42 } 42 }
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 179
180 bool TabNodePool::Empty() const { return free_nodes_pool_.empty(); } 180 bool TabNodePool::Empty() const { return free_nodes_pool_.empty(); }
181 181
182 bool TabNodePool::Full() { return nodeid_tabid_map_.empty(); } 182 bool TabNodePool::Full() { return nodeid_tabid_map_.empty(); }
183 183
184 void TabNodePool::SetMachineTag(const std::string& machine_tag) { 184 void TabNodePool::SetMachineTag(const std::string& machine_tag) {
185 machine_tag_ = machine_tag; 185 machine_tag_ = machine_tag;
186 } 186 }
187 187
188 } // namespace browser_sync 188 } // namespace browser_sync
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698