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

Side by Side Diff: chrome/browser/sync/sessions/sessions_sync_manager.cc

Issue 699033002: Sync: Handle duplicating tab IDs in foreign session data (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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 | « no previous file | chrome/browser/sync/sessions/sessions_sync_manager_unittest.cc » ('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 "chrome/browser/sync/sessions/sessions_sync_manager.h" 5 #include "chrome/browser/sync/sessions/sessions_sync_manager.h"
6 6
7 #include "chrome/browser/chrome_notification_types.h" 7 #include "chrome/browser/chrome_notification_types.h"
8 #include "chrome/browser/profiles/profile.h" 8 #include "chrome/browser/profiles/profile.h"
9 #include "chrome/browser/sync/glue/synced_tab_delegate.h" 9 #include "chrome/browser/sync/glue/synced_tab_delegate.h"
10 #include "chrome/browser/sync/glue/synced_window_delegate.h" 10 #include "chrome/browser/sync/glue/synced_window_delegate.h"
(...skipping 634 matching lines...) Expand 10 before | Expand all | Expand 10 after
645 BuildSyncedSessionFromSpecifics(foreign_session_tag, 645 BuildSyncedSessionFromSpecifics(foreign_session_tag,
646 window_s, 646 window_s,
647 modification_time, 647 modification_time,
648 foreign_session->windows[window_id]); 648 foreign_session->windows[window_id]);
649 } 649 }
650 // Delete any closed windows and unused tabs as necessary. 650 // Delete any closed windows and unused tabs as necessary.
651 session_tracker_.CleanupSession(foreign_session_tag); 651 session_tracker_.CleanupSession(foreign_session_tag);
652 } else if (specifics.has_tab()) { 652 } else if (specifics.has_tab()) {
653 const sync_pb::SessionTab& tab_s = specifics.tab(); 653 const sync_pb::SessionTab& tab_s = specifics.tab();
654 SessionID::id_type tab_id = tab_s.tab_id(); 654 SessionID::id_type tab_id = tab_s.tab_id();
655
656 const SessionTab* existing_tab;
657 if (session_tracker_.LookupSessionTab(
658 foreign_session_tag, tab_id, &existing_tab) &&
659 existing_tab->timestamp > modification_time) {
660 DVLOG(1) << "Ignoring " << foreign_session_tag << "'s session tab "
661 << tab_id << " with earlier modification time";
662 return;
663 }
664
655 SessionTab* tab = 665 SessionTab* tab =
656 session_tracker_.GetTab(foreign_session_tag, 666 session_tracker_.GetTab(foreign_session_tag,
657 tab_id, 667 tab_id,
658 specifics.tab_node_id()); 668 specifics.tab_node_id());
659 669
660 // Update SessionTab based on protobuf. 670 // Update SessionTab based on protobuf.
661 tab->SetFromSyncData(tab_s, modification_time); 671 tab->SetFromSyncData(tab_s, modification_time);
662 672
663 // If a favicon or favicon urls are present, load the URLs and visit 673 // If a favicon or favicon urls are present, load the URLs and visit
664 // times into the in-memory favicon cache. 674 // times into the in-memory favicon cache.
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after
1039 << " with age " << session_age_in_days << ", deleting."; 1049 << " with age " << session_age_in_days << ", deleting.";
1040 DeleteForeignSessionInternal(session_tag, &changes); 1050 DeleteForeignSessionInternal(session_tag, &changes);
1041 } 1051 }
1042 } 1052 }
1043 1053
1044 if (!changes.empty()) 1054 if (!changes.empty())
1045 sync_processor_->ProcessSyncChanges(FROM_HERE, changes); 1055 sync_processor_->ProcessSyncChanges(FROM_HERE, changes);
1046 } 1056 }
1047 1057
1048 }; // namespace browser_sync 1058 }; // namespace browser_sync
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/sync/sessions/sessions_sync_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698