OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "chrome/browser/chromeos/drive/resource_metadata_storage.h" | 5 #include "chrome/browser/chromeos/drive/resource_metadata_storage.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/location.h" | 9 #include "base/location.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 | 223 |
224 const base::FilePath resource_map_path = | 224 const base::FilePath resource_map_path = |
225 directory_path_.Append(kResourceMapDBName); | 225 directory_path_.Append(kResourceMapDBName); |
226 | 226 |
227 // Try to open the existing DB. | 227 // Try to open the existing DB. |
228 leveldb::DB* db = NULL; | 228 leveldb::DB* db = NULL; |
229 leveldb::Options options; | 229 leveldb::Options options; |
230 options.create_if_missing = false; | 230 options.create_if_missing = false; |
231 | 231 |
232 DBInitStatus open_existing_result = DB_INIT_NOT_FOUND; | 232 DBInitStatus open_existing_result = DB_INIT_NOT_FOUND; |
233 if (file_util::PathExists(resource_map_path)) { | 233 if (base::PathExists(resource_map_path)) { |
234 leveldb::Status status = | 234 leveldb::Status status = |
235 leveldb::DB::Open(options, resource_map_path.AsUTF8Unsafe(), &db); | 235 leveldb::DB::Open(options, resource_map_path.AsUTF8Unsafe(), &db); |
236 open_existing_result = LevelDBStatusToDBInitStatus(status); | 236 open_existing_result = LevelDBStatusToDBInitStatus(status); |
237 } | 237 } |
238 | 238 |
239 if (open_existing_result == DB_INIT_SUCCESS) { | 239 if (open_existing_result == DB_INIT_SUCCESS) { |
240 resource_map_.reset(db); | 240 resource_map_.reset(db); |
241 | 241 |
242 // Check the validity of existing DB. | 242 // Check the validity of existing DB. |
243 ResourceMetadataHeader header; | 243 ResourceMetadataHeader header; |
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
608 if (!it->status().ok() || num_child_entries != num_entries_with_parent) { | 608 if (!it->status().ok() || num_child_entries != num_entries_with_parent) { |
609 DLOG(ERROR) << "Error during checking resource map. status = " | 609 DLOG(ERROR) << "Error during checking resource map. status = " |
610 << it->status().ToString(); | 610 << it->status().ToString(); |
611 return false; | 611 return false; |
612 } | 612 } |
613 return true; | 613 return true; |
614 } | 614 } |
615 | 615 |
616 } // namespace internal | 616 } // namespace internal |
617 } // namespace drive | 617 } // namespace drive |
OLD | NEW |