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 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 } | 168 } |
169 | 169 |
170 void SimpleDatabaseSystem::SetFullFilePathsForVfsFile( | 170 void SimpleDatabaseSystem::SetFullFilePathsForVfsFile( |
171 const string16& origin_identifier, | 171 const string16& origin_identifier, |
172 const string16& database_name) { | 172 const string16& database_name) { |
173 string16 vfs_file_name = origin_identifier + ASCIIToUTF16("/") + | 173 string16 vfs_file_name = origin_identifier + ASCIIToUTF16("/") + |
174 database_name + ASCIIToUTF16("#"); | 174 database_name + ASCIIToUTF16("#"); |
175 FilePath file_name = | 175 FilePath file_name = |
176 DatabaseUtil::GetFullFilePathForVfsFile(db_tracker_, vfs_file_name); | 176 DatabaseUtil::GetFullFilePathForVfsFile(db_tracker_, vfs_file_name); |
177 | 177 |
178 AutoLock file_names_auto_lock(file_names_lock_); | 178 base::AutoLock file_names_auto_lock(file_names_lock_); |
179 file_names_[vfs_file_name] = file_name; | 179 file_names_[vfs_file_name] = file_name; |
180 file_names_[vfs_file_name + ASCIIToUTF16("-journal")] = | 180 file_names_[vfs_file_name + ASCIIToUTF16("-journal")] = |
181 FilePath::FromWStringHack(file_name.ToWStringHack() + | 181 FilePath::FromWStringHack(file_name.ToWStringHack() + |
182 ASCIIToWide("-journal")); | 182 ASCIIToWide("-journal")); |
183 } | 183 } |
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 base::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 |