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

Side by Side Diff: webkit/database/database_tracker.cc

Issue 13219005: Replace string16 with base::string16 in src/webkit (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 months 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 | Annotate | Revision Log
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 "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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 OriginInfo::OriginInfo() 44 OriginInfo::OriginInfo()
45 : total_size_(0) {} 45 : total_size_(0) {}
46 46
47 OriginInfo::OriginInfo(const OriginInfo& origin_info) 47 OriginInfo::OriginInfo(const OriginInfo& origin_info)
48 : origin_(origin_info.origin_), 48 : origin_(origin_info.origin_),
49 total_size_(origin_info.total_size_), 49 total_size_(origin_info.total_size_),
50 database_info_(origin_info.database_info_) {} 50 database_info_(origin_info.database_info_) {}
51 51
52 OriginInfo::~OriginInfo() {} 52 OriginInfo::~OriginInfo() {}
53 53
54 void OriginInfo::GetAllDatabaseNames(std::vector<string16>* databases) const { 54 void OriginInfo::GetAllDatabaseNames(
55 std::vector<base::string16>* databases) const {
55 for (DatabaseInfoMap::const_iterator it = database_info_.begin(); 56 for (DatabaseInfoMap::const_iterator it = database_info_.begin();
56 it != database_info_.end(); it++) { 57 it != database_info_.end(); it++) {
57 databases->push_back(it->first); 58 databases->push_back(it->first);
58 } 59 }
59 } 60 }
60 61
61 int64 OriginInfo::GetDatabaseSize(const string16& database_name) const { 62 int64 OriginInfo::GetDatabaseSize(const base::string16& database_name) const {
62 DatabaseInfoMap::const_iterator it = database_info_.find(database_name); 63 DatabaseInfoMap::const_iterator it = database_info_.find(database_name);
63 if (it != database_info_.end()) 64 if (it != database_info_.end())
64 return it->second.first; 65 return it->second.first;
65 return 0; 66 return 0;
66 } 67 }
67 68
68 string16 OriginInfo::GetDatabaseDescription( 69 base::string16 OriginInfo::GetDatabaseDescription(
69 const string16& database_name) const { 70 const base::string16& database_name) const {
70 DatabaseInfoMap::const_iterator it = database_info_.find(database_name); 71 DatabaseInfoMap::const_iterator it = database_info_.find(database_name);
71 if (it != database_info_.end()) 72 if (it != database_info_.end())
72 return it->second.second; 73 return it->second.second;
73 return string16(); 74 return base::string16();
74 } 75 }
75 76
76 OriginInfo::OriginInfo(const string16& origin, int64 total_size) 77 OriginInfo::OriginInfo(const base::string16& origin, int64 total_size)
77 : origin_(origin), total_size_(total_size) {} 78 : origin_(origin), total_size_(total_size) {}
78 79
79 DatabaseTracker::DatabaseTracker( 80 DatabaseTracker::DatabaseTracker(
80 const base::FilePath& profile_path, 81 const base::FilePath& profile_path,
81 bool is_incognito, 82 bool is_incognito,
82 quota::SpecialStoragePolicy* special_storage_policy, 83 quota::SpecialStoragePolicy* special_storage_policy,
83 quota::QuotaManagerProxy* quota_manager_proxy, 84 quota::QuotaManagerProxy* quota_manager_proxy,
84 base::MessageLoopProxy* db_tracker_thread) 85 base::MessageLoopProxy* db_tracker_thread)
85 : is_initialized_(false), 86 : is_initialized_(false),
86 is_incognito_(is_incognito), 87 is_incognito_(is_incognito),
(...skipping 14 matching lines...) Expand all
101 quota_manager_proxy->RegisterClient( 102 quota_manager_proxy->RegisterClient(
102 new DatabaseQuotaClient(db_tracker_thread, this)); 103 new DatabaseQuotaClient(db_tracker_thread, this));
103 } 104 }
104 } 105 }
105 106
106 DatabaseTracker::~DatabaseTracker() { 107 DatabaseTracker::~DatabaseTracker() {
107 DCHECK(dbs_to_be_deleted_.empty()); 108 DCHECK(dbs_to_be_deleted_.empty());
108 DCHECK(deletion_callbacks_.empty()); 109 DCHECK(deletion_callbacks_.empty());
109 } 110 }
110 111
111 void DatabaseTracker::DatabaseOpened(const string16& origin_identifier, 112 void DatabaseTracker::DatabaseOpened(const base::string16& origin_identifier,
112 const string16& database_name, 113 const base::string16& database_name,
113 const string16& database_description, 114 const base::string16& database_description,
114 int64 estimated_size, 115 int64 estimated_size,
115 int64* database_size) { 116 int64* database_size) {
116 if (shutting_down_ || !LazyInit()) { 117 if (shutting_down_ || !LazyInit()) {
117 *database_size = 0; 118 *database_size = 0;
118 return; 119 return;
119 } 120 }
120 121
121 if (quota_manager_proxy_) 122 if (quota_manager_proxy_)
122 quota_manager_proxy_->NotifyStorageAccessed( 123 quota_manager_proxy_->NotifyStorageAccessed(
123 quota::QuotaClient::kDatabase, 124 quota::QuotaClient::kDatabase,
124 DatabaseUtil::GetOriginFromIdentifier(origin_identifier), 125 DatabaseUtil::GetOriginFromIdentifier(origin_identifier),
125 quota::kStorageTypeTemporary); 126 quota::kStorageTypeTemporary);
126 127
127 InsertOrUpdateDatabaseDetails(origin_identifier, database_name, 128 InsertOrUpdateDatabaseDetails(origin_identifier, database_name,
128 database_description, estimated_size); 129 database_description, estimated_size);
129 if (database_connections_.AddConnection(origin_identifier, database_name)) { 130 if (database_connections_.AddConnection(origin_identifier, database_name)) {
130 *database_size = SeedOpenDatabaseInfo(origin_identifier, 131 *database_size = SeedOpenDatabaseInfo(origin_identifier,
131 database_name, 132 database_name,
132 database_description); 133 database_description);
133 return; 134 return;
134 } 135 }
135 *database_size = UpdateOpenDatabaseInfoAndNotify(origin_identifier, 136 *database_size = UpdateOpenDatabaseInfoAndNotify(origin_identifier,
136 database_name, 137 database_name,
137 &database_description); 138 &database_description);
138 } 139 }
139 140
140 void DatabaseTracker::DatabaseModified(const string16& origin_identifier, 141 void DatabaseTracker::DatabaseModified(const base::string16& origin_identifier,
141 const string16& database_name) { 142 const base::string16& database_name) {
142 if (!LazyInit()) 143 if (!LazyInit())
143 return; 144 return;
144 UpdateOpenDatabaseSizeAndNotify(origin_identifier, database_name); 145 UpdateOpenDatabaseSizeAndNotify(origin_identifier, database_name);
145 } 146 }
146 147
147 void DatabaseTracker::DatabaseClosed(const string16& origin_identifier, 148 void DatabaseTracker::DatabaseClosed(const base::string16& origin_identifier,
148 const string16& database_name) { 149 const base::string16& database_name) {
149 if (database_connections_.IsEmpty()) { 150 if (database_connections_.IsEmpty()) {
150 DCHECK(!is_initialized_); 151 DCHECK(!is_initialized_);
151 return; 152 return;
152 } 153 }
153 154
154 // We call NotifiyStorageAccessed when a db is opened and also when 155 // We call NotifiyStorageAccessed when a db is opened and also when
155 // closed because we don't call it for read while open. 156 // closed because we don't call it for read while open.
156 if (quota_manager_proxy_) 157 if (quota_manager_proxy_)
157 quota_manager_proxy_->NotifyStorageAccessed( 158 quota_manager_proxy_->NotifyStorageAccessed(
158 quota::QuotaClient::kDatabase, 159 quota::QuotaClient::kDatabase,
159 DatabaseUtil::GetOriginFromIdentifier(origin_identifier), 160 DatabaseUtil::GetOriginFromIdentifier(origin_identifier),
160 quota::kStorageTypeTemporary); 161 quota::kStorageTypeTemporary);
161 162
162 UpdateOpenDatabaseSizeAndNotify(origin_identifier, database_name); 163 UpdateOpenDatabaseSizeAndNotify(origin_identifier, database_name);
163 if (database_connections_.RemoveConnection(origin_identifier, database_name)) 164 if (database_connections_.RemoveConnection(origin_identifier, database_name))
164 DeleteDatabaseIfNeeded(origin_identifier, database_name); 165 DeleteDatabaseIfNeeded(origin_identifier, database_name);
165 } 166 }
166 167
167 void DatabaseTracker::HandleSqliteError( 168 void DatabaseTracker::HandleSqliteError(
168 const string16& origin_identifier, 169 const base::string16& origin_identifier,
169 const string16& database_name, 170 const base::string16& database_name,
170 int error) { 171 int error) {
171 // We only handle errors that indicate corruption and we 172 // We only handle errors that indicate corruption and we
172 // do so with a heavy hand, we delete it. Any renderers/workers 173 // do so with a heavy hand, we delete it. Any renderers/workers
173 // with this database open will receive a message to close it 174 // with this database open will receive a message to close it
174 // immediately, once all have closed, the files will be deleted. 175 // immediately, once all have closed, the files will be deleted.
175 // In the interim, all attempts to open a new connection to that 176 // In the interim, all attempts to open a new connection to that
176 // database will fail. 177 // database will fail.
177 // Note: the client-side filters out all but these two errors as 178 // Note: the client-side filters out all but these two errors as
178 // a small optimization, see WebDatabaseObserverImpl::HandleSqliteError. 179 // a small optimization, see WebDatabaseObserverImpl::HandleSqliteError.
179 if (error == SQLITE_CORRUPT || error == SQLITE_NOTADB) { 180 if (error == SQLITE_CORRUPT || error == SQLITE_NOTADB) {
180 DeleteDatabase(origin_identifier, database_name, 181 DeleteDatabase(origin_identifier, database_name,
181 net::CompletionCallback()); 182 net::CompletionCallback());
182 } 183 }
183 } 184 }
184 185
185 void DatabaseTracker::CloseDatabases(const DatabaseConnections& connections) { 186 void DatabaseTracker::CloseDatabases(const DatabaseConnections& connections) {
186 if (database_connections_.IsEmpty()) { 187 if (database_connections_.IsEmpty()) {
187 DCHECK(!is_initialized_ || connections.IsEmpty()); 188 DCHECK(!is_initialized_ || connections.IsEmpty());
188 return; 189 return;
189 } 190 }
190 191
191 // When being closed by this route, there's a chance that 192 // When being closed by this route, there's a chance that
192 // the tracker missed some DatabseModified calls. This method is used 193 // the tracker missed some DatabseModified calls. This method is used
193 // when a renderer crashes to cleanup its open resources. 194 // when a renderer crashes to cleanup its open resources.
194 // We need to examine what we have in connections for the 195 // We need to examine what we have in connections for the
195 // size of each open databases and notify any differences between the 196 // size of each open databases and notify any differences between the
196 // actual file sizes now. 197 // actual file sizes now.
197 std::vector<std::pair<string16, string16> > open_dbs; 198 std::vector<std::pair<base::string16, base::string16> > open_dbs;
198 connections.ListConnections(&open_dbs); 199 connections.ListConnections(&open_dbs);
199 for (std::vector<std::pair<string16, string16> >::iterator it = 200 for (std::vector<std::pair<base::string16, base::string16> >::iterator it =
200 open_dbs.begin(); it != open_dbs.end(); ++it) 201 open_dbs.begin(); it != open_dbs.end(); ++it)
201 UpdateOpenDatabaseSizeAndNotify(it->first, it->second); 202 UpdateOpenDatabaseSizeAndNotify(it->first, it->second);
202 203
203 std::vector<std::pair<string16, string16> > closed_dbs; 204 std::vector<std::pair<base::string16, base::string16> > closed_dbs;
204 database_connections_.RemoveConnections(connections, &closed_dbs); 205 database_connections_.RemoveConnections(connections, &closed_dbs);
205 for (std::vector<std::pair<string16, string16> >::iterator it = 206 for (std::vector<std::pair<base::string16, base::string16> >::iterator it =
206 closed_dbs.begin(); it != closed_dbs.end(); ++it) { 207 closed_dbs.begin(); it != closed_dbs.end(); ++it) {
207 DeleteDatabaseIfNeeded(it->first, it->second); 208 DeleteDatabaseIfNeeded(it->first, it->second);
208 } 209 }
209 } 210 }
210 211
211 void DatabaseTracker::DeleteDatabaseIfNeeded(const string16& origin_identifier, 212 void DatabaseTracker::DeleteDatabaseIfNeeded(
212 const string16& database_name) { 213 const base::string16& origin_identifier,
214 const base::string16& database_name) {
213 DCHECK(!database_connections_.IsDatabaseOpened(origin_identifier, 215 DCHECK(!database_connections_.IsDatabaseOpened(origin_identifier,
214 database_name)); 216 database_name));
215 if (IsDatabaseScheduledForDeletion(origin_identifier, database_name)) { 217 if (IsDatabaseScheduledForDeletion(origin_identifier, database_name)) {
216 DeleteClosedDatabase(origin_identifier, database_name); 218 DeleteClosedDatabase(origin_identifier, database_name);
217 dbs_to_be_deleted_[origin_identifier].erase(database_name); 219 dbs_to_be_deleted_[origin_identifier].erase(database_name);
218 if (dbs_to_be_deleted_[origin_identifier].empty()) 220 if (dbs_to_be_deleted_[origin_identifier].empty())
219 dbs_to_be_deleted_.erase(origin_identifier); 221 dbs_to_be_deleted_.erase(origin_identifier);
220 222
221 PendingDeletionCallbacks::iterator callback = deletion_callbacks_.begin(); 223 PendingDeletionCallbacks::iterator callback = deletion_callbacks_.begin();
222 while (callback != deletion_callbacks_.end()) { 224 while (callback != deletion_callbacks_.end()) {
223 DatabaseSet::iterator found_origin = 225 DatabaseSet::iterator found_origin =
224 callback->second.find(origin_identifier); 226 callback->second.find(origin_identifier);
225 if (found_origin != callback->second.end()) { 227 if (found_origin != callback->second.end()) {
226 std::set<string16>& databases = found_origin->second; 228 std::set<base::string16>& databases = found_origin->second;
227 databases.erase(database_name); 229 databases.erase(database_name);
228 if (databases.empty()) { 230 if (databases.empty()) {
229 callback->second.erase(found_origin); 231 callback->second.erase(found_origin);
230 if (callback->second.empty()) { 232 if (callback->second.empty()) {
231 net::CompletionCallback cb = callback->first; 233 net::CompletionCallback cb = callback->first;
232 cb.Run(net::OK); 234 cb.Run(net::OK);
233 callback = deletion_callbacks_.erase(callback); 235 callback = deletion_callbacks_.erase(callback);
234 continue; 236 continue;
235 } 237 }
236 } 238 }
(...skipping 20 matching lines...) Expand all
257 ClearAllCachedOriginInfo(); 259 ClearAllCachedOriginInfo();
258 260
259 if (!is_incognito_) { 261 if (!is_incognito_) {
260 meta_table_.reset(NULL); 262 meta_table_.reset(NULL);
261 databases_table_.reset(NULL); 263 databases_table_.reset(NULL);
262 db_->Close(); 264 db_->Close();
263 is_initialized_ = false; 265 is_initialized_ = false;
264 } 266 }
265 } 267 }
266 268
267 string16 DatabaseTracker::GetOriginDirectory( 269 base::string16 DatabaseTracker::GetOriginDirectory(
268 const string16& origin_identifier) { 270 const base::string16& origin_identifier) {
269 if (!is_incognito_) 271 if (!is_incognito_)
270 return origin_identifier; 272 return origin_identifier;
271 273
272 OriginDirectoriesMap::const_iterator it = 274 OriginDirectoriesMap::const_iterator it =
273 incognito_origin_directories_.find(origin_identifier); 275 incognito_origin_directories_.find(origin_identifier);
274 if (it != incognito_origin_directories_.end()) 276 if (it != incognito_origin_directories_.end())
275 return it->second; 277 return it->second;
276 278
277 string16 origin_directory = 279 base::string16 origin_directory =
278 base::IntToString16(incognito_origin_directories_generator_++); 280 base::IntToString16(incognito_origin_directories_generator_++);
279 incognito_origin_directories_[origin_identifier] = origin_directory; 281 incognito_origin_directories_[origin_identifier] = origin_directory;
280 return origin_directory; 282 return origin_directory;
281 } 283 }
282 284
283 base::FilePath DatabaseTracker::GetFullDBFilePath( 285 base::FilePath DatabaseTracker::GetFullDBFilePath(
284 const string16& origin_identifier, 286 const base::string16& origin_identifier,
285 const string16& database_name) { 287 const base::string16& database_name) {
286 DCHECK(!origin_identifier.empty()); 288 DCHECK(!origin_identifier.empty());
287 if (!LazyInit()) 289 if (!LazyInit())
288 return base::FilePath(); 290 return base::FilePath();
289 291
290 int64 id = databases_table_->GetDatabaseID( 292 int64 id = databases_table_->GetDatabaseID(
291 origin_identifier, database_name); 293 origin_identifier, database_name);
292 if (id < 0) 294 if (id < 0)
293 return base::FilePath(); 295 return base::FilePath();
294 296
295 base::FilePath file_name = base::FilePath::FromWStringHack( 297 base::FilePath file_name = base::FilePath::FromWStringHack(
296 UTF8ToWide(base::Int64ToString(id))); 298 UTF8ToWide(base::Int64ToString(id)));
297 return db_dir_.Append(base::FilePath::FromWStringHack( 299 return db_dir_.Append(base::FilePath::FromWStringHack(
298 UTF16ToWide(GetOriginDirectory(origin_identifier)))).Append(file_name); 300 UTF16ToWide(GetOriginDirectory(origin_identifier)))).Append(file_name);
299 } 301 }
300 302
301 bool DatabaseTracker::GetOriginInfo(const string16& origin_identifier, 303 bool DatabaseTracker::GetOriginInfo(const base::string16& origin_identifier,
302 OriginInfo* info) { 304 OriginInfo* info) {
303 DCHECK(info); 305 DCHECK(info);
304 CachedOriginInfo* cached_info = GetCachedOriginInfo(origin_identifier); 306 CachedOriginInfo* cached_info = GetCachedOriginInfo(origin_identifier);
305 if (!cached_info) 307 if (!cached_info)
306 return false; 308 return false;
307 *info = OriginInfo(*cached_info); 309 *info = OriginInfo(*cached_info);
308 return true; 310 return true;
309 } 311 }
310 312
311 bool DatabaseTracker::GetAllOriginIdentifiers( 313 bool DatabaseTracker::GetAllOriginIdentifiers(
312 std::vector<string16>* origin_identifiers) { 314 std::vector<base::string16>* origin_identifiers) {
313 DCHECK(origin_identifiers); 315 DCHECK(origin_identifiers);
314 DCHECK(origin_identifiers->empty()); 316 DCHECK(origin_identifiers->empty());
315 if (!LazyInit()) 317 if (!LazyInit())
316 return false; 318 return false;
317 return databases_table_->GetAllOrigins(origin_identifiers); 319 return databases_table_->GetAllOrigins(origin_identifiers);
318 } 320 }
319 321
320 bool DatabaseTracker::GetAllOriginsInfo(std::vector<OriginInfo>* origins_info) { 322 bool DatabaseTracker::GetAllOriginsInfo(
323 std::vector<OriginInfo>* origins_info) {
321 DCHECK(origins_info); 324 DCHECK(origins_info);
322 DCHECK(origins_info->empty()); 325 DCHECK(origins_info->empty());
323 326
324 std::vector<string16> origins; 327 std::vector<base::string16> origins;
325 if (!GetAllOriginIdentifiers(&origins)) 328 if (!GetAllOriginIdentifiers(&origins))
326 return false; 329 return false;
327 330
328 for (std::vector<string16>::const_iterator it = origins.begin(); 331 for (std::vector<base::string16>::const_iterator it = origins.begin();
329 it != origins.end(); it++) { 332 it != origins.end(); it++) {
330 CachedOriginInfo* origin_info = GetCachedOriginInfo(*it); 333 CachedOriginInfo* origin_info = GetCachedOriginInfo(*it);
331 if (!origin_info) { 334 if (!origin_info) {
332 // Restore 'origins_info' to its initial state. 335 // Restore 'origins_info' to its initial state.
333 origins_info->clear(); 336 origins_info->clear();
334 return false; 337 return false;
335 } 338 }
336 origins_info->push_back(OriginInfo(*origin_info)); 339 origins_info->push_back(OriginInfo(*origin_info));
337 } 340 }
338 341
339 return true; 342 return true;
340 } 343 }
341 344
342 bool DatabaseTracker::DeleteClosedDatabase(const string16& origin_identifier, 345 bool DatabaseTracker::DeleteClosedDatabase(
343 const string16& database_name) { 346 const base::string16& origin_identifier,
347 const base::string16& database_name) {
344 if (!LazyInit()) 348 if (!LazyInit())
345 return false; 349 return false;
346 350
347 // Check if the database is opened by any renderer. 351 // Check if the database is opened by any renderer.
348 if (database_connections_.IsDatabaseOpened(origin_identifier, database_name)) 352 if (database_connections_.IsDatabaseOpened(origin_identifier, database_name))
349 return false; 353 return false;
350 354
351 int64 db_file_size = quota_manager_proxy_ ? 355 int64 db_file_size = quota_manager_proxy_ ?
352 GetDBFileSize(origin_identifier, database_name) : 0; 356 GetDBFileSize(origin_identifier, database_name) : 0;
353 357
(...skipping 20 matching lines...) Expand all
374 378
375 std::vector<DatabaseDetails> details; 379 std::vector<DatabaseDetails> details;
376 if (databases_table_->GetAllDatabaseDetailsForOrigin( 380 if (databases_table_->GetAllDatabaseDetailsForOrigin(
377 origin_identifier, &details) && details.empty()) { 381 origin_identifier, &details) && details.empty()) {
378 // Try to delete the origin in case this was the last database. 382 // Try to delete the origin in case this was the last database.
379 DeleteOrigin(origin_identifier, false); 383 DeleteOrigin(origin_identifier, false);
380 } 384 }
381 return true; 385 return true;
382 } 386 }
383 387
384 bool DatabaseTracker::DeleteOrigin(const string16& origin_identifier, 388 bool DatabaseTracker::DeleteOrigin(const base::string16& origin_identifier,
385 bool force) { 389 bool force) {
386 if (!LazyInit()) 390 if (!LazyInit())
387 return false; 391 return false;
388 392
389 // Check if any database in this origin is opened by any renderer. 393 // Check if any database in this origin is opened by any renderer.
390 if (database_connections_.IsOriginUsed(origin_identifier) && !force) 394 if (database_connections_.IsOriginUsed(origin_identifier) && !force)
391 return false; 395 return false;
392 396
393 int64 deleted_size = 0; 397 int64 deleted_size = 0;
394 if (quota_manager_proxy_) { 398 if (quota_manager_proxy_) {
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 quota::QuotaClient::kDatabase, 431 quota::QuotaClient::kDatabase,
428 DatabaseUtil::GetOriginFromIdentifier(origin_identifier), 432 DatabaseUtil::GetOriginFromIdentifier(origin_identifier),
429 quota::kStorageTypeTemporary, 433 quota::kStorageTypeTemporary,
430 -deleted_size); 434 -deleted_size);
431 } 435 }
432 436
433 return true; 437 return true;
434 } 438 }
435 439
436 bool DatabaseTracker::IsDatabaseScheduledForDeletion( 440 bool DatabaseTracker::IsDatabaseScheduledForDeletion(
437 const string16& origin_identifier, 441 const base::string16& origin_identifier,
438 const string16& database_name) { 442 const base::string16& database_name) {
439 DatabaseSet::iterator it = dbs_to_be_deleted_.find(origin_identifier); 443 DatabaseSet::iterator it = dbs_to_be_deleted_.find(origin_identifier);
440 if (it == dbs_to_be_deleted_.end()) 444 if (it == dbs_to_be_deleted_.end())
441 return false; 445 return false;
442 446
443 std::set<string16>& databases = it->second; 447 std::set<base::string16>& databases = it->second;
444 return (databases.find(database_name) != databases.end()); 448 return (databases.find(database_name) != databases.end());
445 } 449 }
446 450
447 bool DatabaseTracker::LazyInit() { 451 bool DatabaseTracker::LazyInit() {
448 if (!is_initialized_ && !shutting_down_) { 452 if (!is_initialized_ && !shutting_down_) {
449 DCHECK(!db_->is_open()); 453 DCHECK(!db_->is_open());
450 DCHECK(!databases_table_.get()); 454 DCHECK(!databases_table_.get());
451 DCHECK(!meta_table_.get()); 455 DCHECK(!meta_table_.get());
452 456
453 // If there are left-over directories from failed deletion attempts, clean 457 // If there are left-over directories from failed deletion attempts, clean
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
505 !databases_table_->Init()) 509 !databases_table_->Init())
506 return false; 510 return false;
507 511
508 if (meta_table_->GetVersionNumber() < kCurrentVersion) 512 if (meta_table_->GetVersionNumber() < kCurrentVersion)
509 meta_table_->SetVersionNumber(kCurrentVersion); 513 meta_table_->SetVersionNumber(kCurrentVersion);
510 514
511 return transaction.Commit(); 515 return transaction.Commit();
512 } 516 }
513 517
514 void DatabaseTracker::InsertOrUpdateDatabaseDetails( 518 void DatabaseTracker::InsertOrUpdateDatabaseDetails(
515 const string16& origin_identifier, 519 const base::string16& origin_identifier,
516 const string16& database_name, 520 const base::string16& database_name,
517 const string16& database_description, 521 const base::string16& database_description,
518 int64 estimated_size) { 522 int64 estimated_size) {
519 DatabaseDetails details; 523 DatabaseDetails details;
520 if (!databases_table_->GetDatabaseDetails( 524 if (!databases_table_->GetDatabaseDetails(
521 origin_identifier, database_name, &details)) { 525 origin_identifier, database_name, &details)) {
522 details.origin_identifier = origin_identifier; 526 details.origin_identifier = origin_identifier;
523 details.database_name = database_name; 527 details.database_name = database_name;
524 details.description = database_description; 528 details.description = database_description;
525 details.estimated_size = estimated_size; 529 details.estimated_size = estimated_size;
526 databases_table_->InsertDatabaseDetails(details); 530 databases_table_->InsertDatabaseDetails(details);
527 } else if ((details.description != database_description) || 531 } else if ((details.description != database_description) ||
528 (details.estimated_size != estimated_size)) { 532 (details.estimated_size != estimated_size)) {
529 details.description = database_description; 533 details.description = database_description;
530 details.estimated_size = estimated_size; 534 details.estimated_size = estimated_size;
531 databases_table_->UpdateDatabaseDetails(details); 535 databases_table_->UpdateDatabaseDetails(details);
532 } 536 }
533 } 537 }
534 538
535 void DatabaseTracker::ClearAllCachedOriginInfo() { 539 void DatabaseTracker::ClearAllCachedOriginInfo() {
536 origins_info_map_.clear(); 540 origins_info_map_.clear();
537 } 541 }
538 542
539 DatabaseTracker::CachedOriginInfo* DatabaseTracker::MaybeGetCachedOriginInfo( 543 DatabaseTracker::CachedOriginInfo* DatabaseTracker::MaybeGetCachedOriginInfo(
540 const string16& origin_identifier, bool create_if_needed) { 544 const base::string16& origin_identifier, bool create_if_needed) {
541 if (!LazyInit()) 545 if (!LazyInit())
542 return NULL; 546 return NULL;
543 547
544 // Populate the cache with data for this origin if needed. 548 // Populate the cache with data for this origin if needed.
545 if (origins_info_map_.find(origin_identifier) == origins_info_map_.end()) { 549 if (origins_info_map_.find(origin_identifier) == origins_info_map_.end()) {
546 if (!create_if_needed) 550 if (!create_if_needed)
547 return NULL; 551 return NULL;
548 552
549 std::vector<DatabaseDetails> details; 553 std::vector<DatabaseDetails> details;
550 if (!databases_table_->GetAllDatabaseDetailsForOrigin( 554 if (!databases_table_->GetAllDatabaseDetailsForOrigin(
(...skipping 14 matching lines...) Expand all
565 db_file_size = GetDBFileSize(origin_identifier, it->database_name); 569 db_file_size = GetDBFileSize(origin_identifier, it->database_name);
566 } 570 }
567 origin_info.SetDatabaseSize(it->database_name, db_file_size); 571 origin_info.SetDatabaseSize(it->database_name, db_file_size);
568 origin_info.SetDatabaseDescription(it->database_name, it->description); 572 origin_info.SetDatabaseDescription(it->database_name, it->description);
569 } 573 }
570 } 574 }
571 575
572 return &origins_info_map_[origin_identifier]; 576 return &origins_info_map_[origin_identifier];
573 } 577 }
574 578
575 int64 DatabaseTracker::GetDBFileSize(const string16& origin_identifier, 579 int64 DatabaseTracker::GetDBFileSize(const base::string16& origin_identifier,
576 const string16& database_name) { 580 const base::string16& database_name) {
577 base::FilePath db_file_name = GetFullDBFilePath(origin_identifier, 581 base::FilePath db_file_name = GetFullDBFilePath(origin_identifier,
578 database_name); 582 database_name);
579 int64 db_file_size = 0; 583 int64 db_file_size = 0;
580 if (!file_util::GetFileSize(db_file_name, &db_file_size)) 584 if (!file_util::GetFileSize(db_file_name, &db_file_size))
581 db_file_size = 0; 585 db_file_size = 0;
582 return db_file_size; 586 return db_file_size;
583 } 587 }
584 588
585 int64 DatabaseTracker::SeedOpenDatabaseInfo( 589 int64 DatabaseTracker::SeedOpenDatabaseInfo(
586 const string16& origin_id, const string16& name, 590 const base::string16& origin_id, const base::string16& name,
587 const string16& description) { 591 const base::string16& description) {
588 DCHECK(database_connections_.IsDatabaseOpened(origin_id, name)); 592 DCHECK(database_connections_.IsDatabaseOpened(origin_id, name));
589 int64 size = GetDBFileSize(origin_id, name); 593 int64 size = GetDBFileSize(origin_id, name);
590 database_connections_.SetOpenDatabaseSize(origin_id, name, size); 594 database_connections_.SetOpenDatabaseSize(origin_id, name, size);
591 CachedOriginInfo* info = MaybeGetCachedOriginInfo(origin_id, false); 595 CachedOriginInfo* info = MaybeGetCachedOriginInfo(origin_id, false);
592 if (info) { 596 if (info) {
593 info->SetDatabaseSize(name, size); 597 info->SetDatabaseSize(name, size);
594 info->SetDatabaseDescription(name, description); 598 info->SetDatabaseDescription(name, description);
595 } 599 }
596 return size; 600 return size;
597 } 601 }
598 602
599 int64 DatabaseTracker::UpdateOpenDatabaseInfoAndNotify( 603 int64 DatabaseTracker::UpdateOpenDatabaseInfoAndNotify(
600 const string16& origin_id, const string16& name, 604 const base::string16& origin_id, const base::string16& name,
601 const string16* opt_description) { 605 const base::string16* opt_description) {
602 DCHECK(database_connections_.IsDatabaseOpened(origin_id, name)); 606 DCHECK(database_connections_.IsDatabaseOpened(origin_id, name));
603 int64 new_size = GetDBFileSize(origin_id, name); 607 int64 new_size = GetDBFileSize(origin_id, name);
604 int64 old_size = database_connections_.GetOpenDatabaseSize(origin_id, name); 608 int64 old_size = database_connections_.GetOpenDatabaseSize(origin_id, name);
605 CachedOriginInfo* info = MaybeGetCachedOriginInfo(origin_id, false); 609 CachedOriginInfo* info = MaybeGetCachedOriginInfo(origin_id, false);
606 if (info && opt_description) 610 if (info && opt_description)
607 info->SetDatabaseDescription(name, *opt_description); 611 info->SetDatabaseDescription(name, *opt_description);
608 if (old_size != new_size) { 612 if (old_size != new_size) {
609 database_connections_.SetOpenDatabaseSize(origin_id, name, new_size); 613 database_connections_.SetOpenDatabaseSize(origin_id, name, new_size);
610 if (info) 614 if (info)
611 info->SetDatabaseSize(name, new_size); 615 info->SetDatabaseSize(name, new_size);
612 if (quota_manager_proxy_) 616 if (quota_manager_proxy_)
613 quota_manager_proxy_->NotifyStorageModified( 617 quota_manager_proxy_->NotifyStorageModified(
614 quota::QuotaClient::kDatabase, 618 quota::QuotaClient::kDatabase,
615 DatabaseUtil::GetOriginFromIdentifier(origin_id), 619 DatabaseUtil::GetOriginFromIdentifier(origin_id),
616 quota::kStorageTypeTemporary, 620 quota::kStorageTypeTemporary,
617 new_size - old_size); 621 new_size - old_size);
618 FOR_EACH_OBSERVER(Observer, observers_, OnDatabaseSizeChanged( 622 FOR_EACH_OBSERVER(Observer, observers_, OnDatabaseSizeChanged(
619 origin_id, name, new_size)); 623 origin_id, name, new_size));
620 } 624 }
621 return new_size; 625 return new_size;
622 } 626 }
623 627
624 void DatabaseTracker::ScheduleDatabaseForDeletion( 628 void DatabaseTracker::ScheduleDatabaseForDeletion(
625 const string16& origin_identifier, 629 const base::string16& origin_identifier,
626 const string16& database_name) { 630 const base::string16& database_name) {
627 DCHECK(database_connections_.IsDatabaseOpened(origin_identifier, 631 DCHECK(database_connections_.IsDatabaseOpened(origin_identifier,
628 database_name)); 632 database_name));
629 dbs_to_be_deleted_[origin_identifier].insert(database_name); 633 dbs_to_be_deleted_[origin_identifier].insert(database_name);
630 FOR_EACH_OBSERVER(Observer, observers_, OnDatabaseScheduledForDeletion( 634 FOR_EACH_OBSERVER(Observer, observers_, OnDatabaseScheduledForDeletion(
631 origin_identifier, database_name)); 635 origin_identifier, database_name));
632 } 636 }
633 637
634 void DatabaseTracker::ScheduleDatabasesForDeletion( 638 void DatabaseTracker::ScheduleDatabasesForDeletion(
635 const DatabaseSet& databases, 639 const DatabaseSet& databases,
636 const net::CompletionCallback& callback) { 640 const net::CompletionCallback& callback) {
637 DCHECK(!databases.empty()); 641 DCHECK(!databases.empty());
638 642
639 if (!callback.is_null()) 643 if (!callback.is_null())
640 deletion_callbacks_.push_back(std::make_pair(callback, databases)); 644 deletion_callbacks_.push_back(std::make_pair(callback, databases));
641 for (DatabaseSet::const_iterator ori = databases.begin(); 645 for (DatabaseSet::const_iterator ori = databases.begin();
642 ori != databases.end(); ++ori) { 646 ori != databases.end(); ++ori) {
643 for (std::set<string16>::const_iterator db = ori->second.begin(); 647 for (std::set<base::string16>::const_iterator db = ori->second.begin();
644 db != ori->second.end(); ++db) 648 db != ori->second.end(); ++db)
645 ScheduleDatabaseForDeletion(ori->first, *db); 649 ScheduleDatabaseForDeletion(ori->first, *db);
646 } 650 }
647 } 651 }
648 652
649 int DatabaseTracker::DeleteDatabase(const string16& origin_identifier, 653 int DatabaseTracker::DeleteDatabase(const base::string16& origin_identifier,
650 const string16& database_name, 654 const base::string16& database_name,
651 const net::CompletionCallback& callback) { 655 const net::CompletionCallback& callback) {
652 if (!LazyInit()) 656 if (!LazyInit())
653 return net::ERR_FAILED; 657 return net::ERR_FAILED;
654 658
655 if (database_connections_.IsDatabaseOpened(origin_identifier, 659 if (database_connections_.IsDatabaseOpened(origin_identifier,
656 database_name)) { 660 database_name)) {
657 if (!callback.is_null()) { 661 if (!callback.is_null()) {
658 DatabaseSet set; 662 DatabaseSet set;
659 set[origin_identifier].insert(database_name); 663 set[origin_identifier].insert(database_name);
660 deletion_callbacks_.push_back(std::make_pair(callback, set)); 664 deletion_callbacks_.push_back(std::make_pair(callback, set));
661 } 665 }
662 ScheduleDatabaseForDeletion(origin_identifier, database_name); 666 ScheduleDatabaseForDeletion(origin_identifier, database_name);
663 return net::ERR_IO_PENDING; 667 return net::ERR_IO_PENDING;
664 } 668 }
665 DeleteClosedDatabase(origin_identifier, database_name); 669 DeleteClosedDatabase(origin_identifier, database_name);
666 return net::OK; 670 return net::OK;
667 } 671 }
668 672
669 int DatabaseTracker::DeleteDataModifiedSince( 673 int DatabaseTracker::DeleteDataModifiedSince(
670 const base::Time& cutoff, 674 const base::Time& cutoff,
671 const net::CompletionCallback& callback) { 675 const net::CompletionCallback& callback) {
672 if (!LazyInit()) 676 if (!LazyInit())
673 return net::ERR_FAILED; 677 return net::ERR_FAILED;
674 678
675 DatabaseSet to_be_deleted; 679 DatabaseSet to_be_deleted;
676 680
677 std::vector<string16> origins_identifiers; 681 std::vector<base::string16> origins_identifiers;
678 if (!databases_table_->GetAllOrigins(&origins_identifiers)) 682 if (!databases_table_->GetAllOrigins(&origins_identifiers))
679 return net::ERR_FAILED; 683 return net::ERR_FAILED;
680 int rv = net::OK; 684 int rv = net::OK;
681 for (std::vector<string16>::const_iterator ori = origins_identifiers.begin(); 685 for (std::vector<base::string16>::const_iterator ori =
686 origins_identifiers.begin();
682 ori != origins_identifiers.end(); ++ori) { 687 ori != origins_identifiers.end(); ++ori) {
683 if (special_storage_policy_.get() && 688 if (special_storage_policy_.get() &&
684 special_storage_policy_->IsStorageProtected( 689 special_storage_policy_->IsStorageProtected(
685 DatabaseUtil::GetOriginFromIdentifier(*ori))) { 690 DatabaseUtil::GetOriginFromIdentifier(*ori))) {
686 continue; 691 continue;
687 } 692 }
688 693
689 std::vector<DatabaseDetails> details; 694 std::vector<DatabaseDetails> details;
690 if (!databases_table_->GetAllDatabaseDetailsForOrigin(*ori, &details)) 695 if (!databases_table_->GetAllDatabaseDetailsForOrigin(*ori, &details))
691 rv = net::ERR_FAILED; 696 rv = net::ERR_FAILED;
(...skipping 17 matching lines...) Expand all
709 return rv; 714 return rv;
710 715
711 if (!to_be_deleted.empty()) { 716 if (!to_be_deleted.empty()) {
712 ScheduleDatabasesForDeletion(to_be_deleted, callback); 717 ScheduleDatabasesForDeletion(to_be_deleted, callback);
713 return net::ERR_IO_PENDING; 718 return net::ERR_IO_PENDING;
714 } 719 }
715 return net::OK; 720 return net::OK;
716 } 721 }
717 722
718 int DatabaseTracker::DeleteDataForOrigin( 723 int DatabaseTracker::DeleteDataForOrigin(
719 const string16& origin, const net::CompletionCallback& callback) { 724 const base::string16& origin, const net::CompletionCallback& callback) {
720 if (!LazyInit()) 725 if (!LazyInit())
721 return net::ERR_FAILED; 726 return net::ERR_FAILED;
722 727
723 DatabaseSet to_be_deleted; 728 DatabaseSet to_be_deleted;
724 729
725 std::vector<DatabaseDetails> details; 730 std::vector<DatabaseDetails> details;
726 if (!databases_table_->GetAllDatabaseDetailsForOrigin(origin, &details)) 731 if (!databases_table_->GetAllDatabaseDetailsForOrigin(origin, &details))
727 return net::ERR_FAILED; 732 return net::ERR_FAILED;
728 for (std::vector<DatabaseDetails>::const_iterator db = details.begin(); 733 for (std::vector<DatabaseDetails>::const_iterator db = details.begin();
729 db != details.end(); ++db) { 734 db != details.end(); ++db) {
730 // Check if the database is opened by any renderer. 735 // Check if the database is opened by any renderer.
731 if (database_connections_.IsDatabaseOpened(origin, db->database_name)) 736 if (database_connections_.IsDatabaseOpened(origin, db->database_name))
732 to_be_deleted[origin].insert(db->database_name); 737 to_be_deleted[origin].insert(db->database_name);
733 else 738 else
734 DeleteClosedDatabase(origin, db->database_name); 739 DeleteClosedDatabase(origin, db->database_name);
735 } 740 }
736 741
737 if (!to_be_deleted.empty()) { 742 if (!to_be_deleted.empty()) {
738 ScheduleDatabasesForDeletion(to_be_deleted, callback); 743 ScheduleDatabasesForDeletion(to_be_deleted, callback);
739 return net::ERR_IO_PENDING; 744 return net::ERR_IO_PENDING;
740 } 745 }
741 return net::OK; 746 return net::OK;
742 } 747 }
743 748
744 void DatabaseTracker::GetIncognitoFileHandle( 749 void DatabaseTracker::GetIncognitoFileHandle(
745 const string16& vfs_file_name, base::PlatformFile* file_handle) const { 750 const base::string16& vfs_file_name,
751 base::PlatformFile* file_handle) const {
746 DCHECK(is_incognito_); 752 DCHECK(is_incognito_);
747 FileHandlesMap::const_iterator it = 753 FileHandlesMap::const_iterator it =
748 incognito_file_handles_.find(vfs_file_name); 754 incognito_file_handles_.find(vfs_file_name);
749 if (it != incognito_file_handles_.end()) 755 if (it != incognito_file_handles_.end())
750 *file_handle = it->second; 756 *file_handle = it->second;
751 else 757 else
752 *file_handle = base::kInvalidPlatformFileValue; 758 *file_handle = base::kInvalidPlatformFileValue;
753 } 759 }
754 760
755 void DatabaseTracker::SaveIncognitoFileHandle( 761 void DatabaseTracker::SaveIncognitoFileHandle(
756 const string16& vfs_file_name, const base::PlatformFile& file_handle) { 762 const base::string16& vfs_file_name,
763 const base::PlatformFile& file_handle) {
757 DCHECK(is_incognito_); 764 DCHECK(is_incognito_);
758 DCHECK(incognito_file_handles_.find(vfs_file_name) == 765 DCHECK(incognito_file_handles_.find(vfs_file_name) ==
759 incognito_file_handles_.end()); 766 incognito_file_handles_.end());
760 if (file_handle != base::kInvalidPlatformFileValue) 767 if (file_handle != base::kInvalidPlatformFileValue)
761 incognito_file_handles_[vfs_file_name] = file_handle; 768 incognito_file_handles_[vfs_file_name] = file_handle;
762 } 769 }
763 770
764 bool DatabaseTracker::CloseIncognitoFileHandle(const string16& vfs_file_name) { 771 bool DatabaseTracker::CloseIncognitoFileHandle(
772 const base::string16& vfs_file_name) {
765 DCHECK(is_incognito_); 773 DCHECK(is_incognito_);
766 DCHECK(incognito_file_handles_.find(vfs_file_name) != 774 DCHECK(incognito_file_handles_.find(vfs_file_name) !=
767 incognito_file_handles_.end()); 775 incognito_file_handles_.end());
768 776
769 bool handle_closed = false; 777 bool handle_closed = false;
770 FileHandlesMap::iterator it = incognito_file_handles_.find(vfs_file_name); 778 FileHandlesMap::iterator it = incognito_file_handles_.find(vfs_file_name);
771 if (it != incognito_file_handles_.end()) { 779 if (it != incognito_file_handles_.end()) {
772 handle_closed = base::ClosePlatformFile(it->second); 780 handle_closed = base::ClosePlatformFile(it->second);
773 if (handle_closed) 781 if (handle_closed)
774 incognito_file_handles_.erase(it); 782 incognito_file_handles_.erase(it);
775 } 783 }
776 return handle_closed; 784 return handle_closed;
777 } 785 }
778 786
779 bool DatabaseTracker::HasSavedIncognitoFileHandle( 787 bool DatabaseTracker::HasSavedIncognitoFileHandle(
780 const string16& vfs_file_name) const { 788 const base::string16& vfs_file_name) const {
781 return (incognito_file_handles_.find(vfs_file_name) != 789 return (incognito_file_handles_.find(vfs_file_name) !=
782 incognito_file_handles_.end()); 790 incognito_file_handles_.end());
783 } 791 }
784 792
785 void DatabaseTracker::DeleteIncognitoDBDirectory() { 793 void DatabaseTracker::DeleteIncognitoDBDirectory() {
786 shutting_down_ = true; 794 shutting_down_ = true;
787 is_initialized_ = false; 795 is_initialized_ = false;
788 796
789 for (FileHandlesMap::iterator it = incognito_file_handles_.begin(); 797 for (FileHandlesMap::iterator it = incognito_file_handles_.begin();
790 it != incognito_file_handles_.end(); it++) 798 it != incognito_file_handles_.end(); it++)
(...skipping 12 matching lines...) Expand all
803 special_storage_policy_.get() && 811 special_storage_policy_.get() &&
804 special_storage_policy_->HasSessionOnlyOrigins(); 812 special_storage_policy_->HasSessionOnlyOrigins();
805 813
806 // Clearing only session-only databases, and there are none. 814 // Clearing only session-only databases, and there are none.
807 if (!has_session_only_databases) 815 if (!has_session_only_databases)
808 return; 816 return;
809 817
810 if (!LazyInit()) 818 if (!LazyInit())
811 return; 819 return;
812 820
813 std::vector<string16> origin_identifiers; 821 std::vector<base::string16> origin_identifiers;
814 GetAllOriginIdentifiers(&origin_identifiers); 822 GetAllOriginIdentifiers(&origin_identifiers);
815 823
816 for (std::vector<string16>::iterator origin = origin_identifiers.begin(); 824 for (std::vector<base::string16>::iterator origin =
825 origin_identifiers.begin();
817 origin != origin_identifiers.end(); ++origin) { 826 origin != origin_identifiers.end(); ++origin) {
818 GURL origin_url = 827 GURL origin_url =
819 webkit_database::DatabaseUtil::GetOriginFromIdentifier(*origin); 828 webkit_database::DatabaseUtil::GetOriginFromIdentifier(*origin);
820 if (!special_storage_policy_->IsStorageSessionOnly(origin_url)) 829 if (!special_storage_policy_->IsStorageSessionOnly(origin_url))
821 continue; 830 continue;
822 if (special_storage_policy_->IsStorageProtected(origin_url)) 831 if (special_storage_policy_->IsStorageProtected(origin_url))
823 continue; 832 continue;
824 webkit_database::OriginInfo origin_info; 833 webkit_database::OriginInfo origin_info;
825 std::vector<string16> databases; 834 std::vector<base::string16> databases;
826 GetOriginInfo(*origin, &origin_info); 835 GetOriginInfo(*origin, &origin_info);
827 origin_info.GetAllDatabaseNames(&databases); 836 origin_info.GetAllDatabaseNames(&databases);
828 837
829 for (std::vector<string16>::iterator database = databases.begin(); 838 for (std::vector<base::string16>::iterator database = databases.begin();
830 database != databases.end(); ++database) { 839 database != databases.end(); ++database) {
831 base::PlatformFile file_handle = base::CreatePlatformFile( 840 base::PlatformFile file_handle = base::CreatePlatformFile(
832 GetFullDBFilePath(*origin, *database), 841 GetFullDBFilePath(*origin, *database),
833 base::PLATFORM_FILE_OPEN_ALWAYS | 842 base::PLATFORM_FILE_OPEN_ALWAYS |
834 base::PLATFORM_FILE_SHARE_DELETE | 843 base::PLATFORM_FILE_SHARE_DELETE |
835 base::PLATFORM_FILE_DELETE_ON_CLOSE | 844 base::PLATFORM_FILE_DELETE_ON_CLOSE |
836 base::PLATFORM_FILE_READ, 845 base::PLATFORM_FILE_READ,
837 NULL, NULL); 846 NULL, NULL);
838 base::ClosePlatformFile(file_handle); 847 base::ClosePlatformFile(file_handle);
839 } 848 }
(...skipping 20 matching lines...) Expand all
860 if (!db_tracker_thread_->BelongsToCurrentThread()) { 869 if (!db_tracker_thread_->BelongsToCurrentThread()) {
861 db_tracker_thread_->PostTask( 870 db_tracker_thread_->PostTask(
862 FROM_HERE, 871 FROM_HERE,
863 base::Bind(&DatabaseTracker::SetForceKeepSessionState, this)); 872 base::Bind(&DatabaseTracker::SetForceKeepSessionState, this));
864 return; 873 return;
865 } 874 }
866 force_keep_session_state_ = true; 875 force_keep_session_state_ = true;
867 } 876 }
868 877
869 } // namespace webkit_database 878 } // namespace webkit_database
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698