| 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 "chrome/browser/chromeos/drive/resource_metadata.h" | 5 #include "chrome/browser/chromeos/drive/resource_metadata.h" |
| 6 | 6 |
| 7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/stringprintf.h" | 8 #include "base/stringprintf.h" |
| 9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
| 10 #include "base/sys_info.h" | 10 #include "base/sys_info.h" |
| (...skipping 809 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 820 child_directories->insert(GetFilePath(entry->resource_id())); | 820 child_directories->insert(GetFilePath(entry->resource_id())); |
| 821 GetDescendantDirectoryPaths(entry->resource_id(), child_directories); | 821 GetDescendantDirectoryPaths(entry->resource_id(), child_directories); |
| 822 } | 822 } |
| 823 } | 823 } |
| 824 } | 824 } |
| 825 | 825 |
| 826 void ResourceMetadata::IterateEntries(const IterateCallback& callback) { | 826 void ResourceMetadata::IterateEntries(const IterateCallback& callback) { |
| 827 DCHECK(blocking_task_runner_->RunsTasksOnCurrentThread()); | 827 DCHECK(blocking_task_runner_->RunsTasksOnCurrentThread()); |
| 828 DCHECK(!callback.is_null()); | 828 DCHECK(!callback.is_null()); |
| 829 | 829 |
| 830 storage_->Iterate(callback); | 830 scoped_ptr<ResourceMetadataStorage::Iterator> it = storage_->GetIterator(); |
| 831 for (; !it->IsAtEnd(); it->Advance()) |
| 832 callback.Run(it->Get()); |
| 833 DCHECK(!it->HasError()); // TODO(hashimoto): Report error correctly. |
| 831 } | 834 } |
| 832 | 835 |
| 833 void ResourceMetadata::GetEntryInfoPairByPathsOnUIThreadAfterGetFirst( | 836 void ResourceMetadata::GetEntryInfoPairByPathsOnUIThreadAfterGetFirst( |
| 834 const base::FilePath& first_path, | 837 const base::FilePath& first_path, |
| 835 const base::FilePath& second_path, | 838 const base::FilePath& second_path, |
| 836 const GetEntryInfoPairCallback& callback, | 839 const GetEntryInfoPairCallback& callback, |
| 837 FileError error, | 840 FileError error, |
| 838 scoped_ptr<ResourceEntry> entry) { | 841 scoped_ptr<ResourceEntry> entry) { |
| 839 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 842 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 840 DCHECK(!callback.is_null()); | 843 DCHECK(!callback.is_null()); |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 940 for (size_t i = 0; i < children.size(); ++i) { | 943 for (size_t i = 0; i < children.size(); ++i) { |
| 941 scoped_ptr<ResourceEntry> child = storage_->GetEntry(children[i]); | 944 scoped_ptr<ResourceEntry> child = storage_->GetEntry(children[i]); |
| 942 DCHECK(child); | 945 DCHECK(child); |
| 943 entries->push_back(*child); | 946 entries->push_back(*child); |
| 944 } | 947 } |
| 945 return entries.Pass(); | 948 return entries.Pass(); |
| 946 } | 949 } |
| 947 | 950 |
| 948 } // namespace internal | 951 } // namespace internal |
| 949 } // namespace drive | 952 } // namespace drive |
| OLD | NEW |