diff options
author | hidehiko@chromium.org <hidehiko@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-07 04:17:13 +0000 |
---|---|---|
committer | hidehiko@chromium.org <hidehiko@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-07 04:17:13 +0000 |
commit | 59c7cdec37e737300ebd5b1f77a27d65771805d5 (patch) | |
tree | 99e800e4e53201d73b0f65d875e00dc7de576f72 | |
parent | bf18d9f72e4e0467bc56c3de97548d1bd9b16658 (diff) | |
download | chromium_src-59c7cdec37e737300ebd5b1f77a27d65771805d5.zip chromium_src-59c7cdec37e737300ebd5b1f77a27d65771805d5.tar.gz chromium_src-59c7cdec37e737300ebd5b1f77a27d65771805d5.tar.bz2 |
Move FileCache, FileCacheMetadata and FileCacheObserver into internal namespace.
These are accessed only from classes under c/b/chromeos/drive/... so it's time
to move them into the internal namespace.
BUG=230235
TEST=Ran unit_tests
R=hashimoto@chromium.org
Review URL: https://codereview.chromium.org/14924005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@198626 0039d316-1c4b-4281-b951-d872f2087c98
31 files changed, 133 insertions, 96 deletions
diff --git a/chrome/browser/chromeos/drive/debug_info_collector.cc b/chrome/browser/chromeos/drive/debug_info_collector.cc index ec5116d..786c796 100644 --- a/chrome/browser/chromeos/drive/debug_info_collector.cc +++ b/chrome/browser/chromeos/drive/debug_info_collector.cc @@ -13,7 +13,7 @@ using content::BrowserThread; namespace drive { DebugInfoCollector::DebugInfoCollector(FileSystemInterface* file_system, - FileCache* file_cache) + internal::FileCache* file_cache) : file_system_(file_system), file_cache_(file_cache) { DCHECK(file_system_); diff --git a/chrome/browser/chromeos/drive/debug_info_collector.h b/chrome/browser/chromeos/drive/debug_info_collector.h index 608ac36..1151b09 100644 --- a/chrome/browser/chromeos/drive/debug_info_collector.h +++ b/chrome/browser/chromeos/drive/debug_info_collector.h @@ -18,7 +18,7 @@ namespace drive { class DebugInfoCollector { public: DebugInfoCollector(FileSystemInterface* file_system, - FileCache* file_cache); + internal::FileCache* file_cache); ~DebugInfoCollector(); // Iterates all files in the file cache and calls |iteration_callback| for @@ -33,7 +33,7 @@ class DebugInfoCollector { private: FileSystemInterface* file_system_; // Not owned. - FileCache* file_cache_; // Not owned. + internal::FileCache* file_cache_; // Not owned. DISALLOW_COPY_AND_ASSIGN(DebugInfoCollector); }; diff --git a/chrome/browser/chromeos/drive/drive_system_service.cc b/chrome/browser/chromeos/drive/drive_system_service.cc index 5e3ff06..e7e1704 100644 --- a/chrome/browser/chromeos/drive/drive_system_service.cc +++ b/chrome/browser/chromeos/drive/drive_system_service.cc @@ -125,16 +125,17 @@ DriveSystemService::DriveSystemService( GetDriveUserAgent())); } scheduler_.reset(new JobScheduler(profile_, drive_service_.get())); - cache_.reset(new FileCache(!test_cache_root.empty() ? test_cache_root : - util::GetCacheRootPath(profile), - blocking_task_runner_, - NULL /* free_disk_space_getter */)); + cache_.reset(new internal::FileCache( + !test_cache_root.empty() ? test_cache_root : + util::GetCacheRootPath(profile), + blocking_task_runner_, + NULL /* free_disk_space_getter */)); webapps_registry_.reset(new DriveWebAppsRegistry); // We can call FileCache::GetCacheDirectoryPath safely even before the cache // gets initialized. resource_metadata_.reset(new internal::ResourceMetadata( - cache_->GetCacheDirectoryPath(FileCache::CACHE_TYPE_META), + cache_->GetCacheDirectoryPath(internal::FileCache::CACHE_TYPE_META), blocking_task_runner_)); file_system_.reset(test_file_system ? test_file_system : @@ -337,7 +338,8 @@ void DriveSystemService::InitializeAfterResourceMetadataInitialized( BrowserContext::GetDownloadManager(profile_) : NULL; download_handler_->Initialize( download_manager, - cache_->GetCacheDirectoryPath(FileCache::CACHE_TYPE_TMP_DOWNLOADS)); + cache_->GetCacheDirectoryPath( + internal::FileCache::CACHE_TYPE_TMP_DOWNLOADS)); // Register for Google Drive invalidation notifications. google_apis::DriveNotificationManager* drive_notification_manager = diff --git a/chrome/browser/chromeos/drive/drive_system_service.h b/chrome/browser/chromeos/drive/drive_system_service.h index e45094d..3c31394 100644 --- a/chrome/browser/chromeos/drive/drive_system_service.h +++ b/chrome/browser/chromeos/drive/drive_system_service.h @@ -33,7 +33,6 @@ namespace drive { class DebugInfoCollector; class DownloadHandler; class DriveWebAppsRegistry; -class FileCache; class FileSystemInterface; class FileSystemProxy; class FileWriteHelper; @@ -42,6 +41,7 @@ class StaleCacheFilesRemover; class SyncClient; namespace internal { +class FileCache; class ResourceMetadata; } // namespace internal @@ -158,7 +158,7 @@ class DriveSystemService bool drive_disabled_; scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; - scoped_ptr<FileCache, util::DestroyHelper> cache_; + scoped_ptr<internal::FileCache, util::DestroyHelper> cache_; scoped_ptr<google_apis::DriveServiceInterface> drive_service_; scoped_ptr<JobScheduler> scheduler_; scoped_ptr<DriveWebAppsRegistry> webapps_registry_; diff --git a/chrome/browser/chromeos/drive/fake_free_disk_space_getter.h b/chrome/browser/chromeos/drive/fake_free_disk_space_getter.h index c40b440b..05bf97b 100644 --- a/chrome/browser/chromeos/drive/fake_free_disk_space_getter.h +++ b/chrome/browser/chromeos/drive/fake_free_disk_space_getter.h @@ -14,7 +14,7 @@ namespace drive { // This class is used to report fake free disk space. In particular, this // class can be used to simulate a case where disk is full, or nearly full. -class FakeFreeDiskSpaceGetter : public FreeDiskSpaceGetterInterface { +class FakeFreeDiskSpaceGetter : public internal::FreeDiskSpaceGetterInterface { public: FakeFreeDiskSpaceGetter(); virtual ~FakeFreeDiskSpaceGetter(); diff --git a/chrome/browser/chromeos/drive/file_cache.cc b/chrome/browser/chromeos/drive/file_cache.cc index 8af47d3..6e312eb 100644 --- a/chrome/browser/chromeos/drive/file_cache.cc +++ b/chrome/browser/chromeos/drive/file_cache.cc @@ -22,6 +22,7 @@ using content::BrowserThread; namespace drive { +namespace internal { namespace { const base::FilePath::CharType kFileCacheMetaDir[] = FILE_PATH_LITERAL("meta"); @@ -1236,4 +1237,5 @@ FileCache::CacheSubDirectoryType FileCache::GetSubDirectoryType( return cache_entry.is_persistent() ? CACHE_TYPE_PERSISTENT : CACHE_TYPE_TMP; } +} // namespace internal } // namespace drive diff --git a/chrome/browser/chromeos/drive/file_cache.h b/chrome/browser/chromeos/drive/file_cache.h index b764a46..931026e 100644 --- a/chrome/browser/chromeos/drive/file_cache.h +++ b/chrome/browser/chromeos/drive/file_cache.h @@ -27,13 +27,6 @@ class SequencedTaskRunner; namespace drive { class FileCacheEntry; -class FileCacheMetadata; -class FileCacheObserver; - -// Callback for GetFileFromCache. -typedef base::Callback<void(FileError error, - const base::FilePath& cache_file_path)> - GetFileFromCacheCallback; // Callback for GetCacheEntry. // |success| indicates if the operation was successful. @@ -42,6 +35,16 @@ typedef base::Callback<void(FileError error, typedef base::Callback<void(bool success, const FileCacheEntry& cache_entry)> GetCacheEntryCallback; +namespace internal { + +class FileCacheMetadata; +class FileCacheObserver; + +// Callback for GetFileFromCache. +typedef base::Callback<void(FileError error, + const base::FilePath& cache_file_path)> + GetFileFromCacheCallback; + // Callback for RequestInitialize. // |success| indicates if the operation was successful. // TODO(satorux): Change this to FileError when it becomes necessary. @@ -405,6 +408,7 @@ class FileCache { // TODO(satorux): Share the constant. const int64 kMinFreeSpace = 512 * 1LL << 20; +} // namespace internal } // namespace drive #endif // CHROME_BROWSER_CHROMEOS_DRIVE_FILE_CACHE_H_ diff --git a/chrome/browser/chromeos/drive/file_cache_metadata.cc b/chrome/browser/chromeos/drive/file_cache_metadata.cc index ec02a01..ae40aed 100644 --- a/chrome/browser/chromeos/drive/file_cache_metadata.cc +++ b/chrome/browser/chromeos/drive/file_cache_metadata.cc @@ -14,6 +14,7 @@ #include "third_party/leveldatabase/src/include/leveldb/db.h" namespace drive { +namespace internal { namespace { @@ -573,4 +574,5 @@ void FileCacheMetadata::AssertOnSequencedWorkerPool() { blocking_task_runner_->RunsTasksOnCurrentThread()); } +} // namespace internal } // namespace drive diff --git a/chrome/browser/chromeos/drive/file_cache_metadata.h b/chrome/browser/chromeos/drive/file_cache_metadata.h index b59adf4..bf5a0c7 100644 --- a/chrome/browser/chromeos/drive/file_cache_metadata.h +++ b/chrome/browser/chromeos/drive/file_cache_metadata.h @@ -29,6 +29,8 @@ typedef base::Callback<void(const std::string& resource_id, const FileCacheEntry& cache_entry)> CacheIterateCallback; +namespace internal { + // FileCacheMetadata is interface to maintain metadata of FileCache's cached // files. This class only manages metadata. File operations are done by // FileCache. @@ -91,6 +93,7 @@ class FileCacheMetadata { DISALLOW_COPY_AND_ASSIGN(FileCacheMetadata); }; +} // namespace internal } // namespace drive #endif // CHROME_BROWSER_CHROMEOS_DRIVE_FILE_CACHE_METADATA_H_ diff --git a/chrome/browser/chromeos/drive/file_cache_metadata_unittest.cc b/chrome/browser/chromeos/drive/file_cache_metadata_unittest.cc index 7b30aa3..c121d91 100644 --- a/chrome/browser/chromeos/drive/file_cache_metadata_unittest.cc +++ b/chrome/browser/chromeos/drive/file_cache_metadata_unittest.cc @@ -14,6 +14,7 @@ #include "testing/gtest/include/gtest/gtest.h" namespace drive { +namespace internal { class FileCacheMetadataTest : public testing::Test { public: @@ -359,4 +360,5 @@ TEST(FileCacheMetadataExtraTest, CannotOpenDB) { EXPECT_FALSE(metadata->Initialize(cache_paths)); } +} // namespace internal } // namespace drive diff --git a/chrome/browser/chromeos/drive/file_cache_observer.h b/chrome/browser/chromeos/drive/file_cache_observer.h index e3e1a265..a66a83c 100644 --- a/chrome/browser/chromeos/drive/file_cache_observer.h +++ b/chrome/browser/chromeos/drive/file_cache_observer.h @@ -8,6 +8,7 @@ #include <string> namespace drive { +namespace internal { // Interface for classes that need to observe events from FileCache. // All events are notified on UI thread. @@ -28,6 +29,7 @@ class FileCacheObserver { virtual ~FileCacheObserver() {} }; +} // namespace internal } // namespace drive #endif // CHROME_BROWSER_CHROMEOS_DRIVE_FILE_CACHE_OBSERVER_H_ diff --git a/chrome/browser/chromeos/drive/file_cache_unittest.cc b/chrome/browser/chromeos/drive/file_cache_unittest.cc index f15c171..23de08e 100644 --- a/chrome/browser/chromeos/drive/file_cache_unittest.cc +++ b/chrome/browser/chromeos/drive/file_cache_unittest.cc @@ -24,6 +24,7 @@ using ::testing::StrictMock; namespace drive { +namespace internal { namespace { struct TestCacheResource { @@ -1409,4 +1410,5 @@ TEST_F(FileCacheTest, UpdatePinnedCache) { FileCache::CACHE_TYPE_PERSISTENT); } -} // namespace drive +} // namespace internal +} // namespace drive diff --git a/chrome/browser/chromeos/drive/file_system.cc b/chrome/browser/chromeos/drive/file_system.cc index b0d7fda..e357f88 100644 --- a/chrome/browser/chromeos/drive/file_system.cc +++ b/chrome/browser/chromeos/drive/file_system.cc @@ -237,7 +237,7 @@ struct FileSystem::AddUploadedFileParams { FileSystem::FileSystem( Profile* profile, - FileCache* cache, + internal::FileCache* cache, google_apis::DriveServiceInterface* drive_service, JobScheduler* scheduler, DriveWebAppsRegistry* webapps_registry, @@ -852,7 +852,7 @@ void FileSystem::GetResolvedFileByPath( FROM_HERE, base::Bind(&CreateDocumentJsonFileOnBlockingPool, cache_->GetCacheDirectoryPath( - FileCache::CACHE_TYPE_TMP_DOCUMENTS), + internal::FileCache::CACHE_TYPE_TMP_DOCUMENTS), GURL(entry_ptr->file_specific_info().alternate_url()), entry_ptr->resource_id(), temp_file_path), @@ -998,8 +998,8 @@ void FileSystem::GetResolvedFileByPathAfterFreeDiskSpace( } // We have enough disk space. Create download destination file. - const base::FilePath temp_download_directory = - cache_->GetCacheDirectoryPath(FileCache::CACHE_TYPE_TMP_DOWNLOADS); + const base::FilePath temp_download_directory = cache_->GetCacheDirectoryPath( + internal::FileCache::CACHE_TYPE_TMP_DOWNLOADS); base::FilePath* file_path = new base::FilePath; base::PostTaskAndReplyWithResult( blocking_task_runner_, @@ -1073,7 +1073,7 @@ void FileSystem::GetResolvedFileByPathAfterDownloadFile( cache_->Store(entry->resource_id(), entry->file_specific_info().file_md5(), downloaded_file_path, - FileCache::FILE_OPERATION_MOVE, + internal::FileCache::FILE_OPERATION_MOVE, base::Bind(&FileSystem::GetResolvedFileByPathAfterStore, weak_ptr_factory_.GetWeakPtr(), base::Passed(¶ms), @@ -1401,7 +1401,7 @@ void FileSystem::AddUploadedFileToCache( cache_->Store(params.resource_id, params.md5, params.file_content_path, - FileCache::FILE_OPERATION_COPY, + internal::FileCache::FILE_OPERATION_COPY, base::Bind(&IgnoreError, params.callback)); } diff --git a/chrome/browser/chromeos/drive/file_system.h b/chrome/browser/chromeos/drive/file_system.h index e5dd662..26525f2 100644 --- a/chrome/browser/chromeos/drive/file_system.h +++ b/chrome/browser/chromeos/drive/file_system.h @@ -52,7 +52,7 @@ class FileSystem : public FileSystemInterface, public file_system::OperationObserver { public: FileSystem(Profile* profile, - FileCache* cache, + internal::FileCache* cache, google_apis::DriveServiceInterface* drive_service, JobScheduler* scheduler, DriveWebAppsRegistry* webapps_registry, @@ -468,7 +468,7 @@ class FileSystem : public FileSystemInterface, Profile* profile_; // Sub components owned by DriveSystemService. - FileCache* cache_; + internal::FileCache* cache_; google_apis::DriveServiceInterface* drive_service_; JobScheduler* scheduler_; DriveWebAppsRegistry* webapps_registry_; diff --git a/chrome/browser/chromeos/drive/file_system/copy_operation.cc b/chrome/browser/chromeos/drive/file_system/copy_operation.cc index 31b06f8..e3b3ed0 100644 --- a/chrome/browser/chromeos/drive/file_system/copy_operation.cc +++ b/chrome/browser/chromeos/drive/file_system/copy_operation.cc @@ -60,7 +60,7 @@ CopyOperation::CopyOperation( JobScheduler* job_scheduler, FileSystemInterface* file_system, internal::ResourceMetadata* metadata, - FileCache* cache, + internal::FileCache* cache, scoped_refptr<base::SequencedTaskRunner> blocking_task_runner, OperationObserver* observer) : job_scheduler_(job_scheduler), @@ -208,7 +208,7 @@ void CopyOperation::ScheduleTransferRegularFileAfterGetEntryInfo( cache_->StoreLocallyModified(entry->resource_id(), entry->file_specific_info().file_md5(), local_file_path, - FileCache::FILE_OPERATION_COPY, + internal::FileCache::FILE_OPERATION_COPY, callback); } diff --git a/chrome/browser/chromeos/drive/file_system/copy_operation.h b/chrome/browser/chromeos/drive/file_system/copy_operation.h index 009418c..9c39e5a 100644 --- a/chrome/browser/chromeos/drive/file_system/copy_operation.h +++ b/chrome/browser/chromeos/drive/file_system/copy_operation.h @@ -13,18 +13,21 @@ namespace base { class FilePath; -} +} // namespace base namespace google_apis { class ResourceEntry; -} +} // namespace google_apis namespace drive { -class FileCache; class JobScheduler; class ResourceEntry; +namespace internal { +class FileCache; +} // namespace internal + namespace file_system { class CreateFileOperation; @@ -39,7 +42,7 @@ class CopyOperation { CopyOperation(JobScheduler* job_scheduler, FileSystemInterface* file_system, internal::ResourceMetadata* metadata, - FileCache* cache, + internal::FileCache* cache, scoped_refptr<base::SequencedTaskRunner> blocking_task_runner, OperationObserver* observer); virtual ~CopyOperation(); @@ -179,7 +182,7 @@ class CopyOperation { JobScheduler* job_scheduler_; FileSystemInterface* file_system_; internal::ResourceMetadata* metadata_; - FileCache* cache_; + internal::FileCache* cache_; scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; OperationObserver* observer_; diff --git a/chrome/browser/chromeos/drive/file_system/drive_operations.cc b/chrome/browser/chromeos/drive/file_system/drive_operations.cc index c95bb24..5dab6c9 100644 --- a/chrome/browser/chromeos/drive/file_system/drive_operations.cc +++ b/chrome/browser/chromeos/drive/file_system/drive_operations.cc @@ -29,7 +29,7 @@ DriveOperations::~DriveOperations() { void DriveOperations::Init( JobScheduler* job_scheduler, FileSystemInterface* file_system, - FileCache* cache, + internal::FileCache* cache, internal::ResourceMetadata* metadata, scoped_refptr<base::SequencedTaskRunner> blocking_task_runner, OperationObserver* observer) { diff --git a/chrome/browser/chromeos/drive/file_system/drive_operations.h b/chrome/browser/chromeos/drive/file_system/drive_operations.h index 5debe80..4c8c3a9 100644 --- a/chrome/browser/chromeos/drive/file_system/drive_operations.h +++ b/chrome/browser/chromeos/drive/file_system/drive_operations.h @@ -12,14 +12,17 @@ namespace base { class FilePath; -} +} // namespace base namespace drive { class FileSystemInterface; -class FileCache; class JobScheduler; +namespace internal { +class FileCache; +} // namespace internal + namespace file_system { class CopyOperation; @@ -39,7 +42,7 @@ class DriveOperations { // Allocates the operation objects and initializes the operation pointers. void Init(JobScheduler* job_scheduler, FileSystemInterface* file_system, - FileCache* cache, + internal::FileCache* cache, internal::ResourceMetadata* metadata, scoped_refptr<base::SequencedTaskRunner> blocking_task_runner, OperationObserver* observer); diff --git a/chrome/browser/chromeos/drive/file_system/move_operation.h b/chrome/browser/chromeos/drive/file_system/move_operation.h index 43a2e4a..c4367f6 100644 --- a/chrome/browser/chromeos/drive/file_system/move_operation.h +++ b/chrome/browser/chromeos/drive/file_system/move_operation.h @@ -19,7 +19,6 @@ class FilePath; namespace drive { -class FileCache; class JobScheduler; class ResourceEntry; diff --git a/chrome/browser/chromeos/drive/file_system/remove_operation.cc b/chrome/browser/chromeos/drive/file_system/remove_operation.cc index f50406e..9568813 100644 --- a/chrome/browser/chromeos/drive/file_system/remove_operation.cc +++ b/chrome/browser/chromeos/drive/file_system/remove_operation.cc @@ -24,7 +24,7 @@ void EmptyFileOperationCallback(FileError error) {} RemoveOperation::RemoveOperation( JobScheduler* job_scheduler, - FileCache* cache, + internal::FileCache* cache, internal::ResourceMetadata* metadata, OperationObserver* observer) : job_scheduler_(job_scheduler), diff --git a/chrome/browser/chromeos/drive/file_system/remove_operation.h b/chrome/browser/chromeos/drive/file_system/remove_operation.h index bcaa82e..eda6633 100644 --- a/chrome/browser/chromeos/drive/file_system/remove_operation.h +++ b/chrome/browser/chromeos/drive/file_system/remove_operation.h @@ -8,25 +8,26 @@ #include "base/basictypes.h" #include "base/memory/scoped_ptr.h" #include "base/memory/weak_ptr.h" -#include "chrome/browser/chromeos/drive/resource_metadata.h" +#include "chrome/browser/chromeos/drive/file_errors.h" #include "chrome/browser/google_apis/gdata_errorcode.h" class GURL; namespace base { class FilePath; -} - -namespace google_apis { -} +} // namespace base namespace drive { -class FileCache; class FileSystem; class JobScheduler; class ResourceEntry; +namespace internal { +class FileCache; +class ResourceMetadata; +} // namespace internal + namespace file_system { class OperationObserver; @@ -37,7 +38,7 @@ class OperationObserver; class RemoveOperation { public: RemoveOperation(JobScheduler* job_scheduler, - FileCache* cache, + internal::FileCache* cache, internal::ResourceMetadata* metadata, OperationObserver* observer); virtual ~RemoveOperation(); @@ -73,7 +74,7 @@ class RemoveOperation { const base::FilePath& directory_path); JobScheduler* job_scheduler_; - FileCache* cache_; + internal::FileCache* cache_; internal::ResourceMetadata* metadata_; OperationObserver* observer_; diff --git a/chrome/browser/chromeos/drive/file_system/update_operation.cc b/chrome/browser/chromeos/drive/file_system/update_operation.cc index cbd82c5..9cb8cff 100644 --- a/chrome/browser/chromeos/drive/file_system/update_operation.cc +++ b/chrome/browser/chromeos/drive/file_system/update_operation.cc @@ -19,7 +19,7 @@ namespace drive { namespace file_system { UpdateOperation::UpdateOperation( - FileCache* cache, + internal::FileCache* cache, internal::ResourceMetadata* metadata, JobScheduler* scheduler, scoped_refptr<base::SequencedTaskRunner> blocking_task_runner, diff --git a/chrome/browser/chromeos/drive/file_system/update_operation.h b/chrome/browser/chromeos/drive/file_system/update_operation.h index e6a68da..a32ba28 100644 --- a/chrome/browser/chromeos/drive/file_system/update_operation.h +++ b/chrome/browser/chromeos/drive/file_system/update_operation.h @@ -16,14 +16,17 @@ class GURL; namespace base { class FilePath; -} +} // namespace base namespace drive { -class FileCache; class JobScheduler; class ResourceEntry; +namespace internal { +class FileCache; +} // namespace internal + namespace file_system { class OperationObserver; @@ -33,7 +36,7 @@ class OperationObserver; // metadata to reflect the new state. class UpdateOperation { public: - UpdateOperation(FileCache* cache, + UpdateOperation(internal::FileCache* cache, internal::ResourceMetadata* metadata, JobScheduler* scheduler, scoped_refptr<base::SequencedTaskRunner> blocking_task_runner, @@ -94,7 +97,7 @@ class UpdateOperation { const base::FilePath& drive_file_path, scoped_ptr<ResourceEntry> entry); - FileCache* cache_; + internal::FileCache* cache_; internal::ResourceMetadata* metadata_; JobScheduler* scheduler_; scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; diff --git a/chrome/browser/chromeos/drive/file_system_unittest.cc b/chrome/browser/chromeos/drive/file_system_unittest.cc index bd38083..5e61337 100644 --- a/chrome/browser/chromeos/drive/file_system_unittest.cc +++ b/chrome/browser/chromeos/drive/file_system_unittest.cc @@ -43,7 +43,7 @@ using ::testing::_; namespace drive { namespace { -const int64 kLotsOfSpace = kMinFreeSpace * 10; +const int64 kLotsOfSpace = internal::kMinFreeSpace * 10; struct SearchResultPair { const char* path; @@ -143,9 +143,9 @@ class DriveFileSystemTest : public testing::Test { blocking_task_runner_ = pool->GetSequencedTaskRunner(pool->GetSequenceToken()); - cache_.reset(new FileCache(util::GetCacheRootPath(profile_.get()), - blocking_task_runner_, - fake_free_disk_space_getter_.get())); + cache_.reset(new internal::FileCache(util::GetCacheRootPath(profile_.get()), + blocking_task_runner_, + fake_free_disk_space_getter_.get())); drive_webapps_registry_.reset(new DriveWebAppsRegistry); @@ -162,7 +162,7 @@ class DriveFileSystemTest : public testing::Test { void SetUpResourceMetadataAndFileSystem() { resource_metadata_.reset(new internal::ResourceMetadata( - cache_->GetCacheDirectoryPath(FileCache::CACHE_TYPE_META), + cache_->GetCacheDirectoryPath(internal::FileCache::CACHE_TYPE_META), blocking_task_runner_)); file_system_.reset(new FileSystem(profile_.get(), @@ -316,7 +316,7 @@ class DriveFileSystemTest : public testing::Test { fake_drive_service_->GetRootResourceId(); scoped_ptr<internal::ResourceMetadata, test_util::DestroyHelperForTests> resource_metadata(new internal::ResourceMetadata( - cache_->GetCacheDirectoryPath(FileCache::CACHE_TYPE_META), + cache_->GetCacheDirectoryPath(internal::FileCache::CACHE_TYPE_META), blocking_task_runner_)); FileError error = FILE_ERROR_FAILED; @@ -446,7 +446,7 @@ class DriveFileSystemTest : public testing::Test { scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; scoped_ptr<TestingProfile> profile_; - scoped_ptr<FileCache, test_util::DestroyHelperForTests> cache_; + scoped_ptr<internal::FileCache, test_util::DestroyHelperForTests> cache_; scoped_ptr<FileSystem> file_system_; scoped_ptr<google_apis::FakeDriveService> fake_drive_service_; scoped_ptr<JobScheduler> scheduler_; @@ -1000,7 +1000,7 @@ TEST_F(DriveFileSystemTest, TransferFileFromRemoteToLocal_RegularFile) { // Pretend we have enough space. fake_free_disk_space_getter_->set_fake_free_disk_space( - file_size + kMinFreeSpace); + file_size + internal::kMinFreeSpace); FileError error = FILE_ERROR_FAILED; file_system_->TransferFileFromRemoteToLocal( @@ -1556,7 +1556,7 @@ TEST_F(DriveFileSystemTest, GetFileByPath_FromGData_EnoughSpace) { // Pretend we have enough space. fake_free_disk_space_getter_->set_fake_free_disk_space( - file_size + kMinFreeSpace); + file_size + internal::kMinFreeSpace); FileError error = FILE_ERROR_FAILED; base::FilePath file_path; @@ -1616,12 +1616,12 @@ TEST_F(DriveFileSystemTest, GetFileByPath_FromGData_NoEnoughSpaceButCanFreeUp) { // but then start reporting we have space. This is to emulate that // the disk space was freed up by removing temporary files. fake_free_disk_space_getter_->set_fake_free_disk_space( - file_size + kMinFreeSpace); + file_size + internal::kMinFreeSpace); fake_free_disk_space_getter_->set_fake_free_disk_space(0); fake_free_disk_space_getter_->set_fake_free_disk_space( - file_size + kMinFreeSpace); + file_size + internal::kMinFreeSpace); fake_free_disk_space_getter_->set_fake_free_disk_space( - file_size + kMinFreeSpace); + file_size + internal::kMinFreeSpace); // Store something of the file size in the temporary cache directory. const std::string content(file_size, 'x'); @@ -1633,7 +1633,7 @@ TEST_F(DriveFileSystemTest, GetFileByPath_FromGData_NoEnoughSpaceButCanFreeUp) { FileError error = FILE_ERROR_FAILED; cache_->Store("<resource_id>", "<md5>", tmp_file, - FileCache::FILE_OPERATION_COPY, + internal::FileCache::FILE_OPERATION_COPY, google_apis::test_util::CreateCopyResultCallback(&error)); google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(FILE_ERROR_OK, error); @@ -1666,9 +1666,11 @@ TEST_F(DriveFileSystemTest, GetFileByPath_FromGData_EnoughSpaceButBecomeFull) { // the disk space becomes full after the file is downloaded for some reason // (ex. the actual file was larger than the expected size). fake_free_disk_space_getter_->set_fake_free_disk_space( - file_size + kMinFreeSpace); - fake_free_disk_space_getter_->set_fake_free_disk_space(kMinFreeSpace - 1); - fake_free_disk_space_getter_->set_fake_free_disk_space(kMinFreeSpace - 1); + file_size + internal::kMinFreeSpace); + fake_free_disk_space_getter_->set_fake_free_disk_space( + internal::kMinFreeSpace - 1); + fake_free_disk_space_getter_->set_fake_free_disk_space( + internal::kMinFreeSpace - 1); FileError error = FILE_ERROR_OK; base::FilePath file_path; @@ -1696,7 +1698,7 @@ TEST_F(DriveFileSystemTest, GetFileByPath_FromCache) { entry->file_specific_info().file_md5(), google_apis::test_util::GetTestFilePath( "chromeos/gdata/root_feed.json"), - FileCache::FILE_OPERATION_COPY, + internal::FileCache::FILE_OPERATION_COPY, google_apis::test_util::CreateCopyResultCallback(&error)); google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(FILE_ERROR_OK, error); @@ -1860,7 +1862,7 @@ TEST_F(DriveFileSystemTest, GetFileByResourceId_FromCache) { entry->file_specific_info().file_md5(), google_apis::test_util::GetTestFilePath( "chromeos/gdata/root_feed.json"), - FileCache::FILE_OPERATION_COPY, + internal::FileCache::FILE_OPERATION_COPY, google_apis::test_util::CreateCopyResultCallback(&error)); google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(FILE_ERROR_OK, error); @@ -1908,7 +1910,7 @@ TEST_F(DriveFileSystemTest, UpdateFileByResourceId_PersistentFile) { // Anything works. google_apis::test_util::GetTestFilePath( "chromeos/gdata/root_feed.json"), - FileCache::FILE_OPERATION_COPY, + internal::FileCache::FILE_OPERATION_COPY, google_apis::test_util::CreateCopyResultCallback(&error)); google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(FILE_ERROR_OK, error); @@ -2098,7 +2100,7 @@ TEST_F(DriveFileSystemTest, OpenAndCloseFile) { // Pretend we have enough space. fake_free_disk_space_getter_->set_fake_free_disk_space( - file_size + kMinFreeSpace); + file_size + internal::kMinFreeSpace); // Open kFileInRoot ("drive/root/File 1.txt"). FileError error = FILE_ERROR_FAILED; @@ -2209,7 +2211,7 @@ TEST_F(DriveFileSystemTest, MarkCacheFileAsMountedAndUnmounted) { entry->file_specific_info().file_md5(), google_apis::test_util::GetTestFilePath( "chromeos/gdata/root_feed.json"), - FileCache::FILE_OPERATION_COPY, + internal::FileCache::FILE_OPERATION_COPY, google_apis::test_util::CreateCopyResultCallback(&error)); google_apis::test_util::RunBlockingPoolTask(); ASSERT_EQ(FILE_ERROR_OK, error); diff --git a/chrome/browser/chromeos/drive/mock_file_cache_observer.h b/chrome/browser/chromeos/drive/mock_file_cache_observer.h index 326dec0..0127e7d 100644 --- a/chrome/browser/chromeos/drive/mock_file_cache_observer.h +++ b/chrome/browser/chromeos/drive/mock_file_cache_observer.h @@ -12,8 +12,8 @@ namespace drive { -// Mock for FileCache::Observer. -class MockCacheObserver : public FileCacheObserver { +// Mock for FileCacheObserver. +class MockCacheObserver : public internal::FileCacheObserver { public: MockCacheObserver(); virtual ~MockCacheObserver(); diff --git a/chrome/browser/chromeos/drive/stale_cache_files_remover.cc b/chrome/browser/chromeos/drive/stale_cache_files_remover.cc index 8d9b145..37ff2ad 100644 --- a/chrome/browser/chromeos/drive/stale_cache_files_remover.cc +++ b/chrome/browser/chromeos/drive/stale_cache_files_remover.cc @@ -29,7 +29,7 @@ void EmitErrorLog(const std::string& resource_id, StaleCacheFilesRemover::StaleCacheFilesRemover( FileSystemInterface* file_system, - FileCache* cache) + internal::FileCache* cache) : cache_(cache), file_system_(file_system), weak_ptr_factory_(this) { diff --git a/chrome/browser/chromeos/drive/stale_cache_files_remover.h b/chrome/browser/chromeos/drive/stale_cache_files_remover.h index 751cf80..b96a316 100644 --- a/chrome/browser/chromeos/drive/stale_cache_files_remover.h +++ b/chrome/browser/chromeos/drive/stale_cache_files_remover.h @@ -17,7 +17,10 @@ namespace drive{ class FileCacheEntry; class FileSystemInterface; + +namespace internal { class FileCache; +} // namespace internal // This class removes stale cache files, which are present locally, but no // longer present on the server. This can happen if files are removed from the @@ -25,7 +28,7 @@ class FileCache; class StaleCacheFilesRemover : public FileSystemObserver { public: StaleCacheFilesRemover(FileSystemInterface* file_system, - FileCache* cache); + internal::FileCache* cache); virtual ~StaleCacheFilesRemover(); private: @@ -49,7 +52,7 @@ class StaleCacheFilesRemover : public FileSystemObserver { const base::FilePath& drive_file_path, scoped_ptr<ResourceEntry> entry); - FileCache* cache_; // Not owned. + internal::FileCache* cache_; // Not owned. FileSystemInterface* file_system_; // Not owned. // Note: This should remain the last member so it'll be destroyed and diff --git a/chrome/browser/chromeos/drive/stale_cache_files_remover_unittest.cc b/chrome/browser/chromeos/drive/stale_cache_files_remover_unittest.cc index 8264e8e..43eee4f 100644 --- a/chrome/browser/chromeos/drive/stale_cache_files_remover_unittest.cc +++ b/chrome/browser/chromeos/drive/stale_cache_files_remover_unittest.cc @@ -24,7 +24,7 @@ namespace drive { namespace { -const int64 kLotsOfSpace = kMinFreeSpace * 10; +const int64 kLotsOfSpace = internal::kMinFreeSpace * 10; } // namespace @@ -54,14 +54,14 @@ class StaleCacheFilesRemoverTest : public testing::Test { blocking_task_runner_ = pool->GetSequencedTaskRunner(pool->GetSequenceToken()); - cache_.reset(new FileCache(util::GetCacheRootPath(profile_.get()), - blocking_task_runner_, - fake_free_disk_space_getter_.get())); + cache_.reset(new internal::FileCache(util::GetCacheRootPath(profile_.get()), + blocking_task_runner_, + fake_free_disk_space_getter_.get())); drive_webapps_registry_.reset(new DriveWebAppsRegistry); resource_metadata_.reset(new internal::ResourceMetadata( - cache_->GetCacheDirectoryPath(FileCache::CACHE_TYPE_META), + cache_->GetCacheDirectoryPath(internal::FileCache::CACHE_TYPE_META), blocking_task_runner_)); file_system_.reset(new FileSystem(profile_.get(), @@ -100,7 +100,7 @@ class StaleCacheFilesRemoverTest : public testing::Test { scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; scoped_ptr<TestingProfile> profile_; - scoped_ptr<FileCache, test_util::DestroyHelperForTests> cache_; + scoped_ptr<internal::FileCache, test_util::DestroyHelperForTests> cache_; scoped_ptr<FileSystem> file_system_; scoped_ptr<google_apis::FakeDriveService> fake_drive_service_; scoped_ptr<JobScheduler> scheduler_; @@ -121,7 +121,8 @@ TEST_F(StaleCacheFilesRemoverTest, RemoveStaleCacheFiles) { // Create a stale cache file. FileError error = FILE_ERROR_OK; - cache_->Store(resource_id, md5, dummy_file, FileCache::FILE_OPERATION_COPY, + cache_->Store(resource_id, md5, dummy_file, + internal::FileCache::FILE_OPERATION_COPY, google_apis::test_util::CreateCopyResultCallback(&error)); google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(FILE_ERROR_OK, error); diff --git a/chrome/browser/chromeos/drive/sync_client.cc b/chrome/browser/chromeos/drive/sync_client.cc index 9be0cb4..04443fb 100644 --- a/chrome/browser/chromeos/drive/sync_client.cc +++ b/chrome/browser/chromeos/drive/sync_client.cc @@ -55,7 +55,7 @@ void CollectBacklog(std::vector<std::string>* to_fetch, } // namespace SyncClient::SyncClient(FileSystemInterface* file_system, - FileCache* cache) + internal::FileCache* cache) : file_system_(file_system), cache_(cache), delay_(base::TimeDelta::FromSeconds(kDelaySeconds)), diff --git a/chrome/browser/chromeos/drive/sync_client.h b/chrome/browser/chromeos/drive/sync_client.h index 8382cf0..432584c 100644 --- a/chrome/browser/chromeos/drive/sync_client.h +++ b/chrome/browser/chromeos/drive/sync_client.h @@ -17,11 +17,14 @@ namespace drive { -class FileCache; class FileCacheEntry; class FileSystemInterface; class ResourceEntry; +namespace internal { +class FileCache; +} // namespace internal + // The SyncClient is used to synchronize pinned files on Drive and the // cache on the local drive. The sync client works as follows. // @@ -36,7 +39,7 @@ class ResourceEntry; // client resumes fetching operations next time the user logs in, based on // the states left in the cache. class SyncClient : public FileSystemObserver, - public FileCacheObserver { + public internal::FileCacheObserver { public: // Types of sync tasks. enum SyncType { @@ -44,7 +47,7 @@ class SyncClient : public FileSystemObserver, UPLOAD, // Upload a file to the Drive server. }; - SyncClient(FileSystemInterface* file_system, FileCache* cache); + SyncClient(FileSystemInterface* file_system, internal::FileCache* cache); virtual ~SyncClient(); // FileSystemInterface::Observer overrides. @@ -137,7 +140,7 @@ class SyncClient : public FileSystemObserver, FileError error); FileSystemInterface* file_system_; // Owned by DriveSystemService. - FileCache* cache_; // Owned by DriveSystemService. + internal::FileCache* cache_; // Owned by DriveSystemService. // List of the resource ids of resources which have a fetch task created. std::set<std::string> fetch_list_; diff --git a/chrome/browser/chromeos/drive/sync_client_unittest.cc b/chrome/browser/chromeos/drive/sync_client_unittest.cc index 1395a11..1705045 100644 --- a/chrome/browser/chromeos/drive/sync_client_unittest.cc +++ b/chrome/browser/chromeos/drive/sync_client_unittest.cc @@ -63,7 +63,7 @@ class SyncClientTest : public testing::Test { // Initialize the cache. scoped_refptr<base::SequencedWorkerPool> pool = content::BrowserThread::GetBlockingPool(); - cache_.reset(new FileCache( + cache_.reset(new internal::FileCache( temp_dir_.path(), pool->GetSequencedTaskRunner(pool->GetSequenceToken()), NULL /* free_disk_space_getter */)); @@ -117,7 +117,7 @@ class SyncClientTest : public testing::Test { const std::string resource_id_fetched = "resource_id_fetched"; const std::string md5_fetched = "md5"; cache_->Store(resource_id_fetched, md5_fetched, temp_file, - FileCache::FILE_OPERATION_COPY, + internal::FileCache::FILE_OPERATION_COPY, google_apis::test_util::CreateCopyResultCallback(&error)); google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(FILE_ERROR_OK, error); @@ -130,7 +130,7 @@ class SyncClientTest : public testing::Test { const std::string resource_id_dirty = "resource_id_dirty"; const std::string md5_dirty = ""; // Don't care. cache_->Store(resource_id_dirty, md5_dirty, temp_file, - FileCache::FILE_OPERATION_COPY, + internal::FileCache::FILE_OPERATION_COPY, google_apis::test_util::CreateCopyResultCallback(&error)); google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(FILE_ERROR_OK, error); @@ -213,7 +213,7 @@ class SyncClientTest : public testing::Test { content::TestBrowserThread ui_thread_; base::ScopedTempDir temp_dir_; scoped_ptr<StrictMock<MockFileSystem> > mock_file_system_; - scoped_ptr<FileCache, test_util::DestroyHelperForTests> cache_; + scoped_ptr<internal::FileCache, test_util::DestroyHelperForTests> cache_; scoped_ptr<SyncClient> sync_client_; }; |