| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/browser/sessions/session_service.h" | 5 #include "chrome/browser/sessions/session_service.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <limits> | 8 #include <limits> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 ScheduleReset(); | 175 ScheduleReset(); |
| 176 } | 176 } |
| 177 | 177 |
| 178 void SessionService::MoveCurrentSessionToLastSession() { | 178 void SessionService::MoveCurrentSessionToLastSession() { |
| 179 pending_tab_close_ids_.clear(); | 179 pending_tab_close_ids_.clear(); |
| 180 window_closing_ids_.clear(); | 180 window_closing_ids_.clear(); |
| 181 pending_window_close_ids_.clear(); | 181 pending_window_close_ids_.clear(); |
| 182 | 182 |
| 183 Save(); | 183 Save(); |
| 184 | 184 |
| 185 if (!backend_thread()) { | 185 RunTaskOnBackendThread( |
| 186 backend()->MoveCurrentSessionToLastSession(); | 186 FROM_HERE, base::Bind(&SessionBackend::MoveCurrentSessionToLastSession, |
| 187 } else { | 187 backend())); |
| 188 backend_thread()->message_loop()->PostTask( | |
| 189 FROM_HERE, base::Bind(&SessionBackend::MoveCurrentSessionToLastSession, | |
| 190 backend())); | |
| 191 } | |
| 192 } | 188 } |
| 193 | 189 |
| 194 void SessionService::SetTabWindow(const SessionID& window_id, | 190 void SessionService::SetTabWindow(const SessionID& window_id, |
| 195 const SessionID& tab_id) { | 191 const SessionID& tab_id) { |
| 196 if (!ShouldTrackChangesToWindow(window_id)) | 192 if (!ShouldTrackChangesToWindow(window_id)) |
| 197 return; | 193 return; |
| 198 | 194 |
| 199 ScheduleCommand(CreateSetTabWindowCommand(window_id, tab_id)); | 195 ScheduleCommand(CreateSetTabWindowCommand(window_id, tab_id)); |
| 200 } | 196 } |
| 201 | 197 |
| (...skipping 1336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1538 50); | 1534 50); |
| 1539 if (use_long_period) { | 1535 if (use_long_period) { |
| 1540 std::string long_name_("SessionRestore.SaveLongPeriod"); | 1536 std::string long_name_("SessionRestore.SaveLongPeriod"); |
| 1541 UMA_HISTOGRAM_CUSTOM_TIMES(long_name_, | 1537 UMA_HISTOGRAM_CUSTOM_TIMES(long_name_, |
| 1542 delta, | 1538 delta, |
| 1543 save_delay_in_mins_, | 1539 save_delay_in_mins_, |
| 1544 save_delay_in_hrs_, | 1540 save_delay_in_hrs_, |
| 1545 50); | 1541 50); |
| 1546 } | 1542 } |
| 1547 } | 1543 } |
| OLD | NEW |