| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/tools/test_shell/simple_database_system.h" | 5 #include "webkit/tools/test_shell/simple_database_system.h" |
| 6 | 6 |
| 7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/threading/platform_thread.h" | 10 #include "base/threading/platform_thread.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 | 21 |
| 22 SimpleDatabaseSystem* SimpleDatabaseSystem::instance_ = NULL; | 22 SimpleDatabaseSystem* SimpleDatabaseSystem::instance_ = NULL; |
| 23 | 23 |
| 24 SimpleDatabaseSystem* SimpleDatabaseSystem::GetInstance() { | 24 SimpleDatabaseSystem* SimpleDatabaseSystem::GetInstance() { |
| 25 DCHECK(instance_); | 25 DCHECK(instance_); |
| 26 return instance_; | 26 return instance_; |
| 27 } | 27 } |
| 28 | 28 |
| 29 SimpleDatabaseSystem::SimpleDatabaseSystem() | 29 SimpleDatabaseSystem::SimpleDatabaseSystem() |
| 30 : waiting_for_dbs_to_close_(false) { | 30 : waiting_for_dbs_to_close_(false) { |
| 31 temp_dir_.CreateUniqueTempDir(); | 31 CHECK(temp_dir_.CreateUniqueTempDir()); |
| 32 db_tracker_ = new DatabaseTracker(temp_dir_.path(), false); | 32 db_tracker_ = new DatabaseTracker(temp_dir_.path(), false); |
| 33 db_tracker_->AddObserver(this); | 33 db_tracker_->AddObserver(this); |
| 34 DCHECK(!instance_); | 34 DCHECK(!instance_); |
| 35 instance_ = this; | 35 instance_ = this; |
| 36 } | 36 } |
| 37 | 37 |
| 38 SimpleDatabaseSystem::~SimpleDatabaseSystem() { | 38 SimpleDatabaseSystem::~SimpleDatabaseSystem() { |
| 39 db_tracker_->RemoveObserver(this); | 39 db_tracker_->RemoveObserver(this); |
| 40 instance_ = NULL; | 40 instance_ = NULL; |
| 41 } | 41 } |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 | 184 |
| 185 FilePath SimpleDatabaseSystem::GetFullFilePathForVfsFile( | 185 FilePath SimpleDatabaseSystem::GetFullFilePathForVfsFile( |
| 186 const string16& vfs_file_name) { | 186 const string16& vfs_file_name) { |
| 187 if (vfs_file_name.empty()) // temp file, used for vacuuming | 187 if (vfs_file_name.empty()) // temp file, used for vacuuming |
| 188 return FilePath(); | 188 return FilePath(); |
| 189 | 189 |
| 190 AutoLock file_names_auto_lock(file_names_lock_); | 190 AutoLock file_names_auto_lock(file_names_lock_); |
| 191 DCHECK(file_names_.find(vfs_file_name) != file_names_.end()); | 191 DCHECK(file_names_.find(vfs_file_name) != file_names_.end()); |
| 192 return file_names_[vfs_file_name]; | 192 return file_names_[vfs_file_name]; |
| 193 } | 193 } |
| OLD | NEW |