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

Unified Diff: chrome/browser/sync/glue/session_model_associator.cc

Issue 7706024: [Sync] Don't attempt to sync windowless tabs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/sync/glue/session_model_associator.cc
diff --git a/chrome/browser/sync/glue/session_model_associator.cc b/chrome/browser/sync/glue/session_model_associator.cc
index 4b7496d62add66c8175f0c45697334a58938ea29..e3695362b3f8211e6086ae314901fab6c2c513bb 100644
--- a/chrome/browser/sync/glue/session_model_associator.cc
+++ b/chrome/browser/sync/glue/session_model_associator.cc
@@ -216,9 +216,6 @@ void SessionModelAssociator::ReassociateTabs(
void SessionModelAssociator::ReassociateTab(const SyncedTabDelegate& tab) {
DCHECK(CalledOnValidThread());
- if (!IsValidTab(tab))
- return;
-
int64 sync_id;
SessionID::id_type id = tab.GetSessionId();
if (tab.IsBeingDestroyed()) {
@@ -233,6 +230,9 @@ void SessionModelAssociator::ReassociateTab(const SyncedTabDelegate& tab) {
return;
}
+ if (!IsValidTab(tab))
+ return;
+
TabLinksMap::const_iterator tablink = tab_map_.find(id);
if (tablink == tab_map_.end()) {
// This is a new tab, get a sync node for it.
@@ -251,10 +251,7 @@ void SessionModelAssociator::Associate(const SyncedTabDelegate* tab,
const SyncedWindowDelegate* window =
SyncedWindowDelegate::FindSyncedWindowDelegateWithId(
tab->GetWindowId());
- if (!window) { // Can happen for weird things like developer console.
- tab_pool_.FreeTabNode(sync_id);
- return;
- }
+ DCHECK(window);
TabLinks t(sync_id, tab);
tab_map_[session_id] = t;
@@ -848,7 +845,12 @@ bool SessionModelAssociator::SessionWindowHasNoTabsToSync(
bool SessionModelAssociator::IsValidTab(const SyncedTabDelegate& tab) {
DCHECK(CalledOnValidThread());
if ((tab.profile() == sync_service_->profile() ||
- sync_service_->profile() == NULL)) {
+ sync_service_->profile() == NULL)) { // For tests.
+ const SyncedWindowDelegate* window =
+ SyncedWindowDelegate::FindSyncedWindowDelegateWithId(
+ tab.GetWindowId());
+ if (!window)
+ return false;
const NavigationEntry* entry = tab.GetActiveEntry();
if (!entry)
return false;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698