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

Side by Side Diff: webkit/dom_storage/dom_storage_database.cc

Issue 9718029: DomStorage commit task sequencing. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 9 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/dom_storage/dom_storage_database.h" 5 #include "webkit/dom_storage/dom_storage_database.h"
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "sql/diagnostic_error_delegate.h" 9 #include "sql/diagnostic_error_delegate.h"
10 #include "sql/statement.h" 10 #include "sql/statement.h"
(...skipping 19 matching lines...) Expand all
30 : file_path_(file_path) { 30 : file_path_(file_path) {
31 // Note: in normal use we should never get an empty backing path here. 31 // Note: in normal use we should never get an empty backing path here.
32 // However, the unit test for this class defines another constructor 32 // However, the unit test for this class defines another constructor
33 // that will bypass this check to allow an empty path that signifies 33 // that will bypass this check to allow an empty path that signifies
34 // we should operate on an in-memory database for performance/reliability 34 // we should operate on an in-memory database for performance/reliability
35 // reasons. 35 // reasons.
36 DCHECK(!file_path_.empty()); 36 DCHECK(!file_path_.empty());
37 Init(); 37 Init();
38 } 38 }
39 39
40 DomStorageDatabase::DomStorageDatabase() {
41 Init();
42 }
43
40 void DomStorageDatabase::Init() { 44 void DomStorageDatabase::Init() {
41 failed_to_open_ = false; 45 failed_to_open_ = false;
42 tried_to_recreate_ = false; 46 tried_to_recreate_ = false;
43 known_to_be_empty_ = false; 47 known_to_be_empty_ = false;
44 } 48 }
45 49
46 DomStorageDatabase::~DomStorageDatabase() { 50 DomStorageDatabase::~DomStorageDatabase() {
47 if (known_to_be_empty_ && !file_path_.empty()) { 51 if (known_to_be_empty_ && !file_path_.empty()) {
48 // Delete the db from disk, it's empty. 52 // Delete the db from disk, it's empty.
49 Close(); 53 Close();
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 CreateTableV2() && 283 CreateTableV2() &&
280 CommitChanges(false, values) && 284 CommitChanges(false, values) &&
281 migration.Commit(); 285 migration.Commit();
282 } 286 }
283 287
284 void DomStorageDatabase::Close() { 288 void DomStorageDatabase::Close() {
285 db_.reset(NULL); 289 db_.reset(NULL);
286 } 290 }
287 291
288 } // namespace dom_storage 292 } // namespace dom_storage
OLDNEW
« no previous file with comments | « webkit/dom_storage/dom_storage_database.h ('k') | webkit/dom_storage/dom_storage_database_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698