OLD | NEW |
---|---|
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 Loading... | |
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 Loading... | |
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 |
OLD | NEW |