OLD | NEW |
---|---|
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 "chrome/browser/sync/glue/tab_node_pool.h" | 5 #include "chrome/browser/sync/glue/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/stringprintf.h" | 9 #include "base/stringprintf.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
(...skipping 14 matching lines...) Expand all Loading... | |
25 : tab_pool_fp_(-1), | 25 : tab_pool_fp_(-1), |
26 sync_service_(sync_service) { | 26 sync_service_(sync_service) { |
27 } | 27 } |
28 | 28 |
29 TabNodePool::~TabNodePool() {} | 29 TabNodePool::~TabNodePool() {} |
30 | 30 |
31 // Static | 31 // Static |
32 std::string TabNodePool::TabIdToTag( | 32 std::string TabNodePool::TabIdToTag( |
33 const std::string machine_tag, | 33 const std::string machine_tag, |
34 size_t tab_node_id) { | 34 size_t tab_node_id) { |
35 return base::StringPrintf("%s %"PRIuS"", machine_tag.c_str(), tab_node_id); | 35 return base::StringPrintf("%s %" PRIuS "", machine_tag.c_str(), tab_node_id); |
Nico
2013/04/05 17:05:37
(I think you only need the space in front of PRIus
stuartmorgan
2013/04/05 18:48:08
Yeah, but I thought that looked really strange sin
| |
36 } | 36 } |
37 | 37 |
38 void TabNodePool::AddTabNode(int64 sync_id) { | 38 void TabNodePool::AddTabNode(int64 sync_id) { |
39 tab_syncid_pool_.resize(tab_syncid_pool_.size() + 1); | 39 tab_syncid_pool_.resize(tab_syncid_pool_.size() + 1); |
40 tab_syncid_pool_[static_cast<size_t>(++tab_pool_fp_)] = sync_id; | 40 tab_syncid_pool_[static_cast<size_t>(++tab_pool_fp_)] = sync_id; |
41 } | 41 } |
42 | 42 |
43 int64 TabNodePool::GetFreeTabNode() { | 43 int64 TabNodePool::GetFreeTabNode() { |
44 DCHECK_GT(machine_tag_.length(), 0U); | 44 DCHECK_GT(machine_tag_.length(), 0U); |
45 if (tab_pool_fp_ == -1) { | 45 if (tab_pool_fp_ == -1) { |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
82 } | 82 } |
83 } | 83 } |
84 | 84 |
85 void TabNodePool::FreeTabNode(int64 sync_id) { | 85 void TabNodePool::FreeTabNode(int64 sync_id) { |
86 // Pool size should always match # of free tab nodes. | 86 // Pool size should always match # of free tab nodes. |
87 DCHECK_LT(tab_pool_fp_, static_cast<int64>(tab_syncid_pool_.size())); | 87 DCHECK_LT(tab_pool_fp_, static_cast<int64>(tab_syncid_pool_.size())); |
88 tab_syncid_pool_[static_cast<size_t>(++tab_pool_fp_)] = sync_id; | 88 tab_syncid_pool_[static_cast<size_t>(++tab_pool_fp_)] = sync_id; |
89 } | 89 } |
90 | 90 |
91 } // namespace browser_sync | 91 } // namespace browser_sync |
OLD | NEW |