| 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 "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "components/sync_sessions/sync_sessions_client.h" | 10 #include "components/sync_sessions/sync_sessions_client.h" |
| (...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 423 | 423 |
| 424 void SyncedSessionTracker::Clear() { | 424 void SyncedSessionTracker::Clear() { |
| 425 // Cleanup first, which will take care of orphaned SessionTab and | 425 // Cleanup first, which will take care of orphaned SessionTab and |
| 426 // SessionWindow objects. The SyncedSession destructor will only delete things | 426 // SessionWindow objects. The SyncedSession destructor will only delete things |
| 427 // that is currently parents. | 427 // that is currently parents. |
| 428 for (const auto& kv : synced_session_map_) { | 428 for (const auto& kv : synced_session_map_) { |
| 429 CleanupSession(kv.first); | 429 CleanupSession(kv.first); |
| 430 } | 430 } |
| 431 | 431 |
| 432 // Delete SyncedSession objects (which also deletes all their windows/tabs). | 432 // Delete SyncedSession objects (which also deletes all their windows/tabs). |
| 433 STLDeleteValues(&synced_session_map_); | 433 base::STLDeleteValues(&synced_session_map_); |
| 434 | 434 |
| 435 // Go through and delete any tabs we had allocated but had not yet placed into | 435 // Go through and delete any tabs we had allocated but had not yet placed into |
| 436 // a SyncedSession object. | 436 // a SyncedSession object. |
| 437 STLDeleteElements(&unmapped_tabs_); | 437 base::STLDeleteElements(&unmapped_tabs_); |
| 438 | 438 |
| 439 // Get rid of our Window/Tab maps (does not delete the actual Window/Tabs | 439 // Get rid of our Window/Tab maps (does not delete the actual Window/Tabs |
| 440 // themselves; they should have all been deleted above). | 440 // themselves; they should have all been deleted above). |
| 441 synced_window_map_.clear(); | 441 synced_window_map_.clear(); |
| 442 synced_tab_map_.clear(); | 442 synced_tab_map_.clear(); |
| 443 local_session_tag_.clear(); | 443 local_session_tag_.clear(); |
| 444 } | 444 } |
| 445 | 445 |
| 446 } // namespace browser_sync | 446 } // namespace browser_sync |
| OLD | NEW |