| 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 "webkit/database/database_tracker.h" | 5 #include "webkit/database/database_tracker.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 } | 198 } |
| 199 | 199 |
| 200 void DatabaseTracker::CloseDatabases(const DatabaseConnections& connections) { | 200 void DatabaseTracker::CloseDatabases(const DatabaseConnections& connections) { |
| 201 if (database_connections_.IsEmpty()) { | 201 if (database_connections_.IsEmpty()) { |
| 202 DCHECK(!is_initialized_ || connections.IsEmpty()); | 202 DCHECK(!is_initialized_ || connections.IsEmpty()); |
| 203 return; | 203 return; |
| 204 } | 204 } |
| 205 | 205 |
| 206 // When being closed by this route, there's a chance that | 206 // When being closed by this route, there's a chance that |
| 207 // the tracker missed some DatabseModified calls. This method is used | 207 // the tracker missed some DatabseModified calls. This method is used |
| 208 // when a renderer crashes to cleanup it's open resources. | 208 // when a renderer crashes to cleanup its open resources. |
| 209 // We need to examine what we have in connections for the | 209 // We need to examine what we have in connections for the |
| 210 // size of each open databases and notify any differences between the | 210 // size of each open databases and notify any differences between the |
| 211 // actual file sizes now. | 211 // actual file sizes now. |
| 212 std::vector<std::pair<string16, string16> > open_dbs; | 212 std::vector<std::pair<string16, string16> > open_dbs; |
| 213 connections.ListConnections(&open_dbs); | 213 connections.ListConnections(&open_dbs); |
| 214 for (std::vector<std::pair<string16, string16> >::iterator it = | 214 for (std::vector<std::pair<string16, string16> >::iterator it = |
| 215 open_dbs.begin(); it != open_dbs.end(); ++it) | 215 open_dbs.begin(); it != open_dbs.end(); ++it) |
| 216 UpdateOpenDatabaseSizeAndNotify(it->first, it->second); | 216 UpdateOpenDatabaseSizeAndNotify(it->first, it->second); |
| 217 | 217 |
| 218 std::vector<std::pair<string16, string16> > closed_dbs; | 218 std::vector<std::pair<string16, string16> > closed_dbs; |
| (...skipping 675 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 894 if (!db_tracker_thread_->BelongsToCurrentThread()) { | 894 if (!db_tracker_thread_->BelongsToCurrentThread()) { |
| 895 db_tracker_thread_->PostTask( | 895 db_tracker_thread_->PostTask( |
| 896 FROM_HERE, | 896 FROM_HERE, |
| 897 base::Bind(&DatabaseTracker::SaveSessionState, this)); | 897 base::Bind(&DatabaseTracker::SaveSessionState, this)); |
| 898 return; | 898 return; |
| 899 } | 899 } |
| 900 save_session_state_ = true; | 900 save_session_state_ = true; |
| 901 } | 901 } |
| 902 | 902 |
| 903 } // namespace webkit_database | 903 } // namespace webkit_database |
| OLD | NEW |