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/browser/fileapi/sandbox_directory_database.h" | 5 #include "webkit/browser/fileapi/sandbox_directory_database.h" |
6 | 6 |
7 #include <math.h> | 7 #include <math.h> |
8 #include <algorithm> | 8 #include <algorithm> |
9 #include <set> | 9 #include <set> |
10 #include <stack> | 10 #include <stack> |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 | 236 |
237 if (file_info.is_directory()) { | 237 if (file_info.is_directory()) { |
238 ++num_directories_in_db_; | 238 ++num_directories_in_db_; |
239 DCHECK(file_info.data_path.empty()); | 239 DCHECK(file_info.data_path.empty()); |
240 } else { | 240 } else { |
241 // Ensure any pair of file entry don't share their data_path. | 241 // Ensure any pair of file entry don't share their data_path. |
242 if (!files_in_db_.insert(file_info.data_path).second) | 242 if (!files_in_db_.insert(file_info.data_path).second) |
243 return false; | 243 return false; |
244 | 244 |
245 // Ensure the backing file exists as a normal file. | 245 // Ensure the backing file exists as a normal file. |
246 base::PlatformFileInfo platform_file_info; | 246 base::File::Info platform_file_info; |
247 if (!base::GetFileInfo( | 247 if (!base::GetFileInfo( |
248 path_.Append(file_info.data_path), &platform_file_info) || | 248 path_.Append(file_info.data_path), &platform_file_info) || |
249 platform_file_info.is_directory || | 249 platform_file_info.is_directory || |
250 platform_file_info.is_symbolic_link) { | 250 platform_file_info.is_symbolic_link) { |
251 // leveldb::Iterator iterates a snapshot of the database. | 251 // leveldb::Iterator iterates a snapshot of the database. |
252 // So even after RemoveFileInfo() call, we'll visit hierarchy link | 252 // So even after RemoveFileInfo() call, we'll visit hierarchy link |
253 // from |parent_id| to |file_id|. | 253 // from |parent_id| to |file_id|. |
254 if (!dir_db_->RemoveFileInfo(file_id)) | 254 if (!dir_db_->RemoveFileInfo(file_id)) |
255 return false; | 255 return false; |
256 --num_hierarchy_links_in_db_; | 256 --num_hierarchy_links_in_db_; |
(...skipping 662 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
919 | 919 |
920 void SandboxDirectoryDatabase::HandleError( | 920 void SandboxDirectoryDatabase::HandleError( |
921 const tracked_objects::Location& from_here, | 921 const tracked_objects::Location& from_here, |
922 const leveldb::Status& status) { | 922 const leveldb::Status& status) { |
923 LOG(ERROR) << "SandboxDirectoryDatabase failed at: " | 923 LOG(ERROR) << "SandboxDirectoryDatabase failed at: " |
924 << from_here.ToString() << " with error: " << status.ToString(); | 924 << from_here.ToString() << " with error: " << status.ToString(); |
925 db_.reset(); | 925 db_.reset(); |
926 } | 926 } |
927 | 927 |
928 } // namespace fileapi | 928 } // namespace fileapi |
OLD | NEW |