| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/sync_file_system/drive_backend/metadata_database_index.
h" | 5 #include "chrome/browser/sync_file_system/drive_backend/metadata_database_index.
h" |
| 6 | 6 |
| 7 #include "base/metrics/histogram.h" | 7 #include "base/metrics/histogram.h" |
| 8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
| 9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
| 10 #include "base/threading/thread_restrictions.h" | 10 #include "base/threading/thread_restrictions.h" |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 service_metadata->sync_root_tracker_id(), | 212 service_metadata->sync_root_tracker_id(), |
| 213 db); | 213 db); |
| 214 | 214 |
| 215 scoped_ptr<MetadataDatabaseIndex> index(new MetadataDatabaseIndex(db)); | 215 scoped_ptr<MetadataDatabaseIndex> index(new MetadataDatabaseIndex(db)); |
| 216 index->Initialize(service_metadata.Pass(), &contents); | 216 index->Initialize(service_metadata.Pass(), &contents); |
| 217 return index.Pass(); | 217 return index.Pass(); |
| 218 } | 218 } |
| 219 | 219 |
| 220 // static | 220 // static |
| 221 scoped_ptr<MetadataDatabaseIndex> | 221 scoped_ptr<MetadataDatabaseIndex> |
| 222 MetadataDatabaseIndex::CreateForTesting(DatabaseContents* contents) { | 222 MetadataDatabaseIndex::CreateForTesting(DatabaseContents* contents, |
| 223 scoped_ptr<MetadataDatabaseIndex> index(new MetadataDatabaseIndex(NULL)); | 223 LevelDBWrapper* db) { |
| 224 scoped_ptr<MetadataDatabaseIndex> index(new MetadataDatabaseIndex(db)); |
| 224 index->Initialize(make_scoped_ptr(new ServiceMetadata), contents); | 225 index->Initialize(make_scoped_ptr(new ServiceMetadata), contents); |
| 225 return index.Pass(); | 226 return index.Pass(); |
| 226 } | 227 } |
| 227 | 228 |
| 228 void MetadataDatabaseIndex::Initialize( | 229 void MetadataDatabaseIndex::Initialize( |
| 229 scoped_ptr<ServiceMetadata> service_metadata, | 230 scoped_ptr<ServiceMetadata> service_metadata, |
| 230 DatabaseContents* contents) { | 231 DatabaseContents* contents) { |
| 231 service_metadata_ = service_metadata.Pass(); | 232 service_metadata_ = service_metadata.Pass(); |
| 232 | 233 |
| 233 for (size_t i = 0; i < contents->file_metadata.size(); ++i) | 234 for (size_t i = 0; i < contents->file_metadata.size(); ++i) |
| (...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 733 | 734 |
| 734 DVLOG(3) << " Remove from dirty_trackers_: " << tracker_id; | 735 DVLOG(3) << " Remove from dirty_trackers_: " << tracker_id; |
| 735 dirty_trackers_.erase(tracker_id); | 736 dirty_trackers_.erase(tracker_id); |
| 736 | 737 |
| 737 demoted_dirty_trackers_.erase(tracker_id); | 738 demoted_dirty_trackers_.erase(tracker_id); |
| 738 } | 739 } |
| 739 } | 740 } |
| 740 | 741 |
| 741 } // namespace drive_backend | 742 } // namespace drive_backend |
| 742 } // namespace sync_file_system | 743 } // namespace sync_file_system |
| OLD | NEW |