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; |