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

Side by Side Diff: chrome/browser/sync/glue/session_sync_test_helper.cc

Issue 1877083002: [Sync] Moved tab_node_id tracking to session object and improved foreign session garbage collection. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Moved tab_node_ids to session object, resumed aggressive cleanup. Created 4 years, 8 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/session_sync_test_helper.h" 5 #include "chrome/browser/sync/glue/session_sync_test_helper.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "components/sync_sessions/synced_session.h" 10 #include "components/sync_sessions/synced_session.h"
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 ui::PAGE_TRANSITION_TYPED); 91 ui::PAGE_TRANSITION_TYPED);
92 } 92 }
93 } 93 }
94 } 94 }
95 95
96 void SessionSyncTestHelper::BuildTabSpecifics( 96 void SessionSyncTestHelper::BuildTabSpecifics(
97 const std::string& tag, 97 const std::string& tag,
98 int window_id, 98 int window_id,
99 int tab_id, 99 int tab_id,
100 sync_pb::SessionSpecifics* tab_base) { 100 sync_pb::SessionSpecifics* tab_base) {
101 BuildTabSpecifics(tag, window_id, tab_id, ++max_tab_node_id_, tab_base);
102 }
103
104 void SessionSyncTestHelper::BuildTabSpecifics(
105 const std::string& tag,
106 int window_id,
107 int tab_id,
108 int tab_node_id,
109 sync_pb::SessionSpecifics* tab_base) {
101 tab_base->set_session_tag(tag); 110 tab_base->set_session_tag(tag);
102 tab_base->set_tab_node_id(++max_tab_node_id_); 111 tab_base->set_tab_node_id(tab_node_id);
103 sync_pb::SessionTab* tab = tab_base->mutable_tab(); 112 sync_pb::SessionTab* tab = tab_base->mutable_tab();
104 tab->set_tab_id(tab_id); 113 tab->set_tab_id(tab_id);
105 tab->set_tab_visual_index(1); 114 tab->set_tab_visual_index(1);
106 tab->set_current_navigation_index(0); 115 tab->set_current_navigation_index(0);
107 tab->set_pinned(true); 116 tab->set_pinned(true);
108 tab->set_extension_app_id(kAppId); 117 tab->set_extension_app_id(kAppId);
109 sync_pb::TabNavigation* navigation = tab->add_navigation(); 118 sync_pb::TabNavigation* navigation = tab->add_navigation();
110 navigation->set_virtual_url(kVirtualUrl); 119 navigation->set_virtual_url(kVirtualUrl);
111 navigation->set_referrer(kReferrer); 120 navigation->set_referrer(kReferrer);
112 navigation->set_title(kTitle); 121 navigation->set_title(kTitle);
(...skipping 16 matching lines...) Expand all
129 for (size_t i = 0; i < tab_list.size(); ++i) { 138 for (size_t i = 0; i < tab_list.size(); ++i) {
130 BuildTabSpecifics(tag, 0, tab_list[i], &tabs1[i]); 139 BuildTabSpecifics(tag, 0, tab_list[i], &tabs1[i]);
131 } 140 }
132 141
133 if (tabs) 142 if (tabs)
134 tabs->swap(tabs1); 143 tabs->swap(tabs1);
135 return meta; 144 return meta;
136 } 145 }
137 146
138 } // namespace browser_sync 147 } // namespace browser_sync
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698