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

Side by Side Diff: components/sync_sessions/synced_session_tracker.cc

Issue 2562853002: [Sync] Fix flakiness from Sessions refactor (Closed)
Patch Set: Fix SetSyncId Created 4 years 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 (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 "components/sync_sessions/synced_session_tracker.h" 5 #include "components/sync_sessions/synced_session_tracker.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 // rely on the later update to build the mapping (or a restart). 254 // rely on the later update to build the mapping (or a restart).
255 GetTab(session_tag, tab_id); 255 GetTab(session_tag, tab_id);
256 256
257 // The tab should be unmapped. 257 // The tab should be unmapped.
258 std::unique_ptr<sessions::SessionTab> tab; 258 std::unique_ptr<sessions::SessionTab> tab;
259 auto it = unmapped_tabs_[session_tag].find(tab_id); 259 auto it = unmapped_tabs_[session_tag].find(tab_id);
260 if (it != unmapped_tabs_[session_tag].end()) { 260 if (it != unmapped_tabs_[session_tag].end()) {
261 tab = std::move(it->second); 261 tab = std::move(it->second);
262 unmapped_tabs_[session_tag].erase(it); 262 unmapped_tabs_[session_tag].erase(it);
263 } 263 }
264 DCHECK(tab); 264 if (!tab) {
265 LOG(ERROR) << "crbug.com/665196 Attempting to map tab " << tab_id
skym 2016/12/09 15:40:00 This doesn't seem like the right bug number.
Nicolas Zea 2016/12/09 17:33:36 Oops! Fixed
266 << " multiple times!";
267 return;
268 }
265 269
266 tab->window_id.set_id(window_id); 270 tab->window_id.set_id(window_id);
267 DVLOG(1) << " - tab " << tab_id << " added to window " << window_id; 271 DVLOG(1) << " - tab " << tab_id << " added to window " << window_id;
268 DCHECK(GetSession(session_tag)->windows.find(window_id) != 272 DCHECK(GetSession(session_tag)->windows.find(window_id) !=
269 GetSession(session_tag)->windows.end()); 273 GetSession(session_tag)->windows.end());
270 auto& window_tabs = GetSession(session_tag)->windows[window_id]->tabs; 274 auto& window_tabs = GetSession(session_tag)->windows[window_id]->tabs;
271 if (window_tabs.size() <= tab_index) { 275 if (window_tabs.size() <= tab_index) {
272 window_tabs.resize(tab_index + 1); 276 window_tabs.resize(tab_index + 1);
273 } 277 }
274 DCHECK(!window_tabs[tab_index]); 278 DCHECK(!window_tabs[tab_index]);
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 // Get rid of our convenience maps (does not delete the actual Window/Tabs 415 // Get rid of our convenience maps (does not delete the actual Window/Tabs
412 // themselves; they should have all been deleted above). 416 // themselves; they should have all been deleted above).
413 synced_window_map_.clear(); 417 synced_window_map_.clear();
414 synced_tab_map_.clear(); 418 synced_tab_map_.clear();
415 419
416 local_tab_pool_.Clear(); 420 local_tab_pool_.Clear();
417 local_session_tag_.clear(); 421 local_session_tag_.clear();
418 } 422 }
419 423
420 } // namespace sync_sessions 424 } // namespace sync_sessions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698