diff options
Diffstat (limited to 'chrome/browser/sync_file_system')
119 files changed, 796 insertions, 621 deletions
diff --git a/chrome/browser/sync_file_system/drive_backend/callback_helper.h b/chrome/browser/sync_file_system/drive_backend/callback_helper.h index d976acc..80a2e44 100644 --- a/chrome/browser/sync_file_system/drive_backend/callback_helper.h +++ b/chrome/browser/sync_file_system/drive_backend/callback_helper.h @@ -10,6 +10,7 @@ #include "base/bind.h" #include "base/location.h" #include "base/logging.h" +#include "base/macros.h" #include "base/sequenced_task_runner.h" #include "base/thread_task_runner_handle.h" diff --git a/chrome/browser/sync_file_system/drive_backend/callback_tracker.h b/chrome/browser/sync_file_system/drive_backend/callback_tracker.h index f3b1172..324e438 100644 --- a/chrome/browser/sync_file_system/drive_backend/callback_tracker.h +++ b/chrome/browser/sync_file_system/drive_backend/callback_tracker.h @@ -9,6 +9,7 @@ #include "base/bind.h" #include "base/callback_forward.h" +#include "base/macros.h" #include "base/memory/weak_ptr.h" #include "chrome/browser/sync_file_system/drive_backend/callback_tracker_internal.h" diff --git a/chrome/browser/sync_file_system/drive_backend/callback_tracker_internal.h b/chrome/browser/sync_file_system/drive_backend/callback_tracker_internal.h index 665d2c1..0fb9eb4 100644 --- a/chrome/browser/sync_file_system/drive_backend/callback_tracker_internal.h +++ b/chrome/browser/sync_file_system/drive_backend/callback_tracker_internal.h @@ -7,6 +7,7 @@ #include "base/callback.h" #include "base/callback_internal.h" +#include "base/macros.h" #include "base/memory/scoped_ptr.h" #include "base/memory/weak_ptr.h" diff --git a/chrome/browser/sync_file_system/drive_backend/conflict_resolver.cc b/chrome/browser/sync_file_system/drive_backend/conflict_resolver.cc index 3a9e673..91c9c48 100644 --- a/chrome/browser/sync_file_system/drive_backend/conflict_resolver.cc +++ b/chrome/browser/sync_file_system/drive_backend/conflict_resolver.cc @@ -4,6 +4,8 @@ #include "chrome/browser/sync_file_system/drive_backend/conflict_resolver.h" +#include <stdint.h> + #include "base/callback.h" #include "base/format_macros.h" #include "base/location.h" @@ -96,7 +98,7 @@ void ConflictResolver::RunExclusive(scoped_ptr<SyncTaskToken> token) { if (metadata_database()->GetConflictingTrackers(&trackers)) { target_file_id_ = PickPrimaryFile(trackers); DCHECK(!target_file_id_.empty()); - int64 primary_tracker_id = -1; + int64_t primary_tracker_id = -1; for (TrackerIDSet::const_iterator itr = trackers.begin(); itr != trackers.end(); ++itr) { FileTracker tracker; diff --git a/chrome/browser/sync_file_system/drive_backend/conflict_resolver.h b/chrome/browser/sync_file_system/drive_backend/conflict_resolver.h index e0cfef7..ae2e1f5 100644 --- a/chrome/browser/sync_file_system/drive_backend/conflict_resolver.h +++ b/chrome/browser/sync_file_system/drive_backend/conflict_resolver.h @@ -9,6 +9,7 @@ #include <utility> #include <vector> +#include "base/macros.h" #include "base/memory/scoped_ptr.h" #include "base/memory/weak_ptr.h" #include "chrome/browser/sync_file_system/drive_backend/sync_task.h" diff --git a/chrome/browser/sync_file_system/drive_backend/conflict_resolver_unittest.cc b/chrome/browser/sync_file_system/drive_backend/conflict_resolver_unittest.cc index 64dc3ec..dec53c9 100644 --- a/chrome/browser/sync_file_system/drive_backend/conflict_resolver_unittest.cc +++ b/chrome/browser/sync_file_system/drive_backend/conflict_resolver_unittest.cc @@ -8,6 +8,7 @@ #include "base/callback.h" #include "base/files/file_util.h" #include "base/files/scoped_temp_dir.h" +#include "base/macros.h" #include "base/run_loop.h" #include "base/thread_task_runner_handle.h" #include "chrome/browser/sync_file_system/drive_backend/drive_backend_constants.h" diff --git a/chrome/browser/sync_file_system/drive_backend/drive_backend_constants.cc b/chrome/browser/sync_file_system/drive_backend/drive_backend_constants.cc index 8c96289..bfcd4b0 100644 --- a/chrome/browser/sync_file_system/drive_backend/drive_backend_constants.cc +++ b/chrome/browser/sync_file_system/drive_backend/drive_backend_constants.cc @@ -14,8 +14,8 @@ const base::FilePath::CharType kDatabaseName[] = FILE_PATH_LITERAL("DriveMetadata_v2"); const char kDatabaseVersionKey[] = "VERSION"; -const int64 kCurrentDatabaseVersion = 3; -const int64 kDatabaseOnDiskVersion = 4; +const int64_t kCurrentDatabaseVersion = 3; +const int64_t kDatabaseOnDiskVersion = 4; const char kServiceMetadataKey[] = "SERVICE"; const char kFileMetadataKeyPrefix[] = "FILE: "; const char kFileTrackerKeyPrefix[] = "TRACKER: "; @@ -32,9 +32,9 @@ const char kDirtyIDKeyPrefix[] = "DIRTY: "; const char kDemotedDirtyIDKeyPrefix[] = "DEMOTED_DIRTY: "; const int kMaxRetry = 5; -const int64 kListChangesRetryDelaySeconds = 60 * 60; +const int64_t kListChangesRetryDelaySeconds = 60 * 60; -const int64 kInvalidTrackerID = 0; +const int64_t kInvalidTrackerID = 0; } // namespace drive_backend } // namespace sync_file_system diff --git a/chrome/browser/sync_file_system/drive_backend/drive_backend_constants.h b/chrome/browser/sync_file_system/drive_backend/drive_backend_constants.h index 292393e..f342e5d5 100644 --- a/chrome/browser/sync_file_system/drive_backend/drive_backend_constants.h +++ b/chrome/browser/sync_file_system/drive_backend/drive_backend_constants.h @@ -5,6 +5,8 @@ #ifndef CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_DRIVE_BACKEND_CONSTANTS_H_ #define CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_DRIVE_BACKEND_CONSTANTS_H_ +#include <stdint.h> + #include "base/files/file_path.h" namespace sync_file_system { @@ -16,8 +18,8 @@ extern const char kMimeTypeOctetStream[]; extern const base::FilePath::CharType kDatabaseName[]; extern const char kDatabaseVersionKey[]; -extern const int64 kCurrentDatabaseVersion; -extern const int64 kDatabaseOnDiskVersion; +extern const int64_t kCurrentDatabaseVersion; +extern const int64_t kDatabaseOnDiskVersion; extern const char kServiceMetadataKey[]; extern const char kFileMetadataKeyPrefix[]; extern const char kFileTrackerKeyPrefix[]; @@ -34,9 +36,9 @@ extern const char kDirtyIDKeyPrefix[]; extern const char kDemotedDirtyIDKeyPrefix[]; extern const int kMaxRetry; -extern const int64 kListChangesRetryDelaySeconds; +extern const int64_t kListChangesRetryDelaySeconds; -extern const int64 kInvalidTrackerID; +extern const int64_t kInvalidTrackerID; } // namespace drive_backend } // namespace sync_file_system diff --git a/chrome/browser/sync_file_system/drive_backend/drive_backend_sync_unittest.cc b/chrome/browser/sync_file_system/drive_backend/drive_backend_sync_unittest.cc index 110a6d4..b2589ca 100644 --- a/chrome/browser/sync_file_system/drive_backend/drive_backend_sync_unittest.cc +++ b/chrome/browser/sync_file_system/drive_backend/drive_backend_sync_unittest.cc @@ -2,10 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include <stddef.h> +#include <stdint.h> + #include <algorithm> #include <stack> #include "base/files/file_util.h" +#include "base/macros.h" #include "base/message_loop/message_loop.h" #include "base/run_loop.h" #include "base/thread_task_runner_handle.h" @@ -156,11 +160,11 @@ class DriveBackendSyncTest : public testing::Test, RevokeSyncableFileSystem(); } - void OnRemoteChangeQueueUpdated(int64 pending_changes_hint) override { + void OnRemoteChangeQueueUpdated(int64_t pending_changes_hint) override { pending_remote_changes_ = pending_changes_hint; } - void OnLocalChangeAvailable(int64 pending_changes_hint) override { + void OnLocalChangeAvailable(int64_t pending_changes_hint) override { pending_local_changes_ = pending_changes_hint; } @@ -274,8 +278,8 @@ class DriveBackendSyncTest : public testing::Test, storage::FileSystemURL url(CreateURL(app_id, path)); ASSERT_TRUE(ContainsKey(file_systems_, app_id)); EXPECT_EQ(base::File::FILE_OK, file_systems_[app_id]->CreateFile(url)); - int64 bytes_written = file_systems_[app_id]->WriteString(url, content); - EXPECT_EQ(static_cast<int64>(content.size()), bytes_written); + int64_t bytes_written = file_systems_[app_id]->WriteString(url, content); + EXPECT_EQ(static_cast<int64_t>(content.size()), bytes_written); base::RunLoop().RunUntilIdle(); } @@ -283,9 +287,9 @@ class DriveBackendSyncTest : public testing::Test, const base::FilePath::StringType& path, const std::string& content) { ASSERT_TRUE(ContainsKey(file_systems_, app_id)); - int64 bytes_written = file_systems_[app_id]->WriteString( - CreateURL(app_id, path), content); - EXPECT_EQ(static_cast<int64>(content.size()), bytes_written); + int64_t bytes_written = + file_systems_[app_id]->WriteString(CreateURL(app_id, path), content); + EXPECT_EQ(static_cast<int64_t>(content.size()), bytes_written); base::RunLoop().RunUntilIdle(); } @@ -319,7 +323,7 @@ class DriveBackendSyncTest : public testing::Test, return status; } - int64 GetLargestChangeID() { + int64_t GetLargestChangeID() { scoped_ptr<google_apis::AboutResource> about_resource; EXPECT_EQ(google_apis::HTTP_SUCCESS, fake_drive_service_helper()->GetAboutResource(&about_resource)); @@ -374,14 +378,12 @@ class DriveBackendSyncTest : public testing::Test, continue; base::RunLoop run_loop; - int64 largest_fetched_change_id = -1; + int64_t largest_fetched_change_id = -1; PostTaskAndReplyWithResult( - worker_task_runner_.get(), - FROM_HERE, + worker_task_runner_.get(), FROM_HERE, base::Bind(&MetadataDatabase::GetLargestFetchedChangeID, base::Unretained(metadata_database())), - base::Bind(&SetValueAndCallClosure<int64>, - run_loop.QuitClosure(), + base::Bind(&SetValueAndCallClosure<int64_t>, run_loop.QuitClosure(), &largest_fetched_change_id)); run_loop.Run(); if (largest_fetched_change_id != GetLargestChangeID()) { @@ -627,8 +629,8 @@ class DriveBackendSyncTest : public testing::Test, scoped_ptr<SyncEngine> remote_sync_service_; scoped_ptr<LocalFileSyncService> local_sync_service_; - int64 pending_remote_changes_; - int64 pending_local_changes_; + int64_t pending_remote_changes_; + int64_t pending_local_changes_; scoped_ptr<FakeDriveServiceHelper> fake_drive_service_helper_; std::map<std::string, CannedSyncableFileSystem*> file_systems_; diff --git a/chrome/browser/sync_file_system/drive_backend/drive_backend_test_util.cc b/chrome/browser/sync_file_system/drive_backend/drive_backend_test_util.cc index 2904e26..4f13ff0 100644 --- a/chrome/browser/sync_file_system/drive_backend/drive_backend_test_util.cc +++ b/chrome/browser/sync_file_system/drive_backend/drive_backend_test_util.cc @@ -88,12 +88,12 @@ scoped_ptr<FileMetadata> CreateFileMetadata(const std::string& file_id, } scoped_ptr<FileTracker> CreateTracker(const FileMetadata& metadata, - int64 tracker_id, + int64_t tracker_id, const FileTracker* parent_tracker) { scoped_ptr<FileTracker> tracker(new FileTracker); tracker->set_tracker_id(tracker_id); - int64 parent_id = parent_tracker ? - parent_tracker->tracker_id() : kInvalidTrackerID; + int64_t parent_id = + parent_tracker ? parent_tracker->tracker_id() : kInvalidTrackerID; tracker->set_parent_tracker_id(parent_id); tracker->set_file_id(metadata.file_id()); if (parent_tracker) @@ -108,7 +108,7 @@ scoped_ptr<FileTracker> CreateTracker(const FileMetadata& metadata, scoped_ptr<FileTracker> CreatePlaceholderTracker( const std::string& file_id, - int64 tracker_id, + int64_t tracker_id, const FileTracker* parent_tracker) { scoped_ptr<FileTracker> tracker(new FileTracker); tracker->set_tracker_id(tracker_id); diff --git a/chrome/browser/sync_file_system/drive_backend/drive_backend_test_util.h b/chrome/browser/sync_file_system/drive_backend/drive_backend_test_util.h index d016381..e399f12 100644 --- a/chrome/browser/sync_file_system/drive_backend/drive_backend_test_util.h +++ b/chrome/browser/sync_file_system/drive_backend/drive_backend_test_util.h @@ -5,6 +5,8 @@ #ifndef CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_DRIVE_BACKEND_TEST_UTIL_H_ #define CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_DRIVE_BACKEND_TEST_UTIL_H_ +#include <stdint.h> + #include "base/memory/scoped_ptr.h" #include "chrome/browser/sync_file_system/sync_status_code.h" #include "google_apis/drive/drive_api_error_codes.h" @@ -36,11 +38,11 @@ scoped_ptr<FileMetadata> CreateFileMetadata(const std::string& file_id, const std::string& title, const std::string& md5); scoped_ptr<FileTracker> CreateTracker(const FileMetadata& metadata, - int64 tracker_id, + int64_t tracker_id, const FileTracker* parent_tracker); scoped_ptr<FileTracker> CreatePlaceholderTracker( const std::string& file_id, - int64 tracker_id, + int64_t tracker_id, const FileTracker* parent_tracker); // The return value type of GetFileResourceKind(). diff --git a/chrome/browser/sync_file_system/drive_backend/drive_backend_util.cc b/chrome/browser/sync_file_system/drive_backend/drive_backend_util.cc index d41d311..40c25e3 100644 --- a/chrome/browser/sync_file_system/drive_backend/drive_backend_util.cc +++ b/chrome/browser/sync_file_system/drive_backend/drive_backend_util.cc @@ -19,7 +19,7 @@ namespace sync_file_system { namespace drive_backend { -void PutVersionToDB(int64 version, LevelDBWrapper* db) { +void PutVersionToDB(int64_t version, LevelDBWrapper* db) { DCHECK(db); db->Put(kDatabaseVersionKey, base::Int64ToString(version)); } @@ -59,7 +59,7 @@ void PutFileMetadataDeletionToDB(const std::string& file_id, db->Delete(kFileMetadataKeyPrefix + file_id); } -void PutFileTrackerDeletionToDB(int64 tracker_id, LevelDBWrapper* db) { +void PutFileTrackerDeletionToDB(int64_t tracker_id, LevelDBWrapper* db) { DCHECK(db); db->Delete(kFileTrackerKeyPrefix + base::Int64ToString(tracker_id)); } diff --git a/chrome/browser/sync_file_system/drive_backend/drive_backend_util.h b/chrome/browser/sync_file_system/drive_backend/drive_backend_util.h index 4702994..d393776 100644 --- a/chrome/browser/sync_file_system/drive_backend/drive_backend_util.h +++ b/chrome/browser/sync_file_system/drive_backend/drive_backend_util.h @@ -5,6 +5,8 @@ #ifndef CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_DRIVE_BACKEND_UTIL_H_ #define CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_DRIVE_BACKEND_UTIL_H_ +#include <stdint.h> + #include <string> #include "base/bind.h" @@ -25,7 +27,7 @@ namespace drive_backend { class LevelDBWrapper; -void PutVersionToDB(int64 version, LevelDBWrapper* db); +void PutVersionToDB(int64_t version, LevelDBWrapper* db); void PutServiceMetadataToDB(const ServiceMetadata& service_metadata, LevelDBWrapper* db); @@ -34,7 +36,7 @@ void PutFileTrackerToDB(const FileTracker& tracker, LevelDBWrapper* db); void PutFileMetadataDeletionToDB(const std::string& file_id, LevelDBWrapper* db); -void PutFileTrackerDeletionToDB(int64 tracker_id, LevelDBWrapper* db); +void PutFileTrackerDeletionToDB(int64_t tracker_id, LevelDBWrapper* db); bool HasFileAsParent(const FileDetails& details, const std::string& file_id); diff --git a/chrome/browser/sync_file_system/drive_backend/drive_service_on_worker.cc b/chrome/browser/sync_file_system/drive_backend/drive_service_on_worker.cc index a7bf05b..7dc6f28 100644 --- a/chrome/browser/sync_file_system/drive_backend/drive_service_on_worker.cc +++ b/chrome/browser/sync_file_system/drive_backend/drive_service_on_worker.cc @@ -106,7 +106,7 @@ google_apis::CancelCallback DriveServiceOnWorker::GetAboutResource( } google_apis::CancelCallback DriveServiceOnWorker::GetChangeList( - int64 start_changestamp, + int64_t start_changestamp, const google_apis::ChangeListCallback& callback) { DCHECK(sequence_checker_.CalledOnValidSequencedThread()); @@ -335,7 +335,7 @@ google_apis::CancelCallback DriveServiceOnWorker::AddResourceToDirectory( google_apis::CancelCallback DriveServiceOnWorker::InitiateUploadNewFile( const std::string& content_type, - int64 content_length, + int64_t content_length, const std::string& parent_resource_id, const std::string& title, const drive::UploadNewFileOptions& options, @@ -346,7 +346,7 @@ google_apis::CancelCallback DriveServiceOnWorker::InitiateUploadNewFile( google_apis::CancelCallback DriveServiceOnWorker::InitiateUploadExistingFile( const std::string& content_type, - int64 content_length, + int64_t content_length, const std::string& resource_id, const drive::UploadExistingFileOptions& options, const google_apis::InitiateUploadCallback& callback) { @@ -356,9 +356,9 @@ google_apis::CancelCallback DriveServiceOnWorker::InitiateUploadExistingFile( google_apis::CancelCallback DriveServiceOnWorker::ResumeUpload( const GURL& upload_url, - int64 start_position, - int64 end_position, - int64 content_length, + int64_t start_position, + int64_t end_position, + int64_t content_length, const std::string& content_type, const base::FilePath& local_file_path, const google_apis::drive::UploadRangeCallback& callback, @@ -369,7 +369,7 @@ google_apis::CancelCallback DriveServiceOnWorker::ResumeUpload( google_apis::CancelCallback DriveServiceOnWorker::GetUploadStatus( const GURL& upload_url, - int64 content_length, + int64_t content_length, const google_apis::drive::UploadRangeCallback& callback) { NOTREACHED(); return google_apis::CancelCallback(); @@ -377,7 +377,7 @@ google_apis::CancelCallback DriveServiceOnWorker::GetUploadStatus( google_apis::CancelCallback DriveServiceOnWorker::MultipartUploadNewFile( const std::string& content_type, - int64 content_length, + int64_t content_length, const std::string& parent_resource_id, const std::string& title, const base::FilePath& local_file_path, @@ -390,7 +390,7 @@ google_apis::CancelCallback DriveServiceOnWorker::MultipartUploadNewFile( google_apis::CancelCallback DriveServiceOnWorker::MultipartUploadExistingFile( const std::string& content_type, - int64 content_length, + int64_t content_length, const std::string& parent_resource_id, const base::FilePath& local_file_path, const drive::UploadExistingFileOptions& options, diff --git a/chrome/browser/sync_file_system/drive_backend/drive_service_on_worker.h b/chrome/browser/sync_file_system/drive_backend/drive_service_on_worker.h index 57eafe7..12d6afc 100644 --- a/chrome/browser/sync_file_system/drive_backend/drive_service_on_worker.h +++ b/chrome/browser/sync_file_system/drive_backend/drive_service_on_worker.h @@ -5,6 +5,9 @@ #ifndef CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_DRIVE_SERVICE_ON_WORKER_H_ #define CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_DRIVE_SERVICE_ON_WORKER_H_ +#include <stdint.h> + +#include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/memory/weak_ptr.h" #include "base/sequence_checker.h" @@ -54,7 +57,7 @@ class DriveServiceOnWorker : public drive::DriveServiceInterface { const google_apis::AboutResourceCallback& callback) override; google_apis::CancelCallback GetChangeList( - int64 start_changestamp, + int64_t start_changestamp, const google_apis::ChangeListCallback& callback) override; google_apis::CancelCallback GetRemainingChangeList( @@ -131,33 +134,33 @@ class DriveServiceOnWorker : public drive::DriveServiceInterface { const google_apis::EntryActionCallback& callback) override; google_apis::CancelCallback InitiateUploadNewFile( const std::string& content_type, - int64 content_length, + int64_t content_length, const std::string& parent_resource_id, const std::string& title, const drive::UploadNewFileOptions& options, const google_apis::InitiateUploadCallback& callback) override; google_apis::CancelCallback InitiateUploadExistingFile( const std::string& content_type, - int64 content_length, + int64_t content_length, const std::string& resource_id, const drive::UploadExistingFileOptions& options, const google_apis::InitiateUploadCallback& callback) override; google_apis::CancelCallback ResumeUpload( const GURL& upload_url, - int64 start_position, - int64 end_position, - int64 content_length, + int64_t start_position, + int64_t end_position, + int64_t content_length, const std::string& content_type, const base::FilePath& local_file_path, const google_apis::drive::UploadRangeCallback& callback, const google_apis::ProgressCallback& progress_callback) override; google_apis::CancelCallback GetUploadStatus( const GURL& upload_url, - int64 content_length, + int64_t content_length, const google_apis::drive::UploadRangeCallback& callback) override; google_apis::CancelCallback MultipartUploadNewFile( const std::string& content_type, - int64 content_length, + int64_t content_length, const std::string& parent_resource_id, const std::string& title, const base::FilePath& local_file_path, @@ -166,7 +169,7 @@ class DriveServiceOnWorker : public drive::DriveServiceInterface { const google_apis::ProgressCallback& progress_callback) override; google_apis::CancelCallback MultipartUploadExistingFile( const std::string& content_type, - int64 content_length, + int64_t content_length, const std::string& resource_id, const base::FilePath& local_file_path, const drive::UploadExistingFileOptions& options, diff --git a/chrome/browser/sync_file_system/drive_backend/drive_service_wrapper.cc b/chrome/browser/sync_file_system/drive_backend/drive_service_wrapper.cc index 534f244..e7a2984 100644 --- a/chrome/browser/sync_file_system/drive_backend/drive_service_wrapper.cc +++ b/chrome/browser/sync_file_system/drive_backend/drive_service_wrapper.cc @@ -61,7 +61,7 @@ void DriveServiceWrapper::GetAboutResource( } void DriveServiceWrapper::GetChangeList( - int64 start_changestamp, + int64_t start_changestamp, const google_apis::ChangeListCallback& callback) { DCHECK(sequece_checker_.CalledOnValidSequencedThread()); drive_service_->GetChangeList(start_changestamp, callback); diff --git a/chrome/browser/sync_file_system/drive_backend/drive_service_wrapper.h b/chrome/browser/sync_file_system/drive_backend/drive_service_wrapper.h index fa7160e..9eca838 100644 --- a/chrome/browser/sync_file_system/drive_backend/drive_service_wrapper.h +++ b/chrome/browser/sync_file_system/drive_backend/drive_service_wrapper.h @@ -5,6 +5,9 @@ #ifndef CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_DRIVE_SERVICE_WRAPPER_H_ #define CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_DRIVE_SERVICE_WRAPPER_H_ +#include <stdint.h> + +#include "base/macros.h" #include "base/memory/weak_ptr.h" #include "base/sequence_checker.h" #include "components/drive/service/drive_service_interface.h" @@ -40,9 +43,8 @@ class DriveServiceWrapper : public base::SupportsWeakPtr<DriveServiceWrapper> { void GetAboutResource( const google_apis::AboutResourceCallback& callback); - void GetChangeList( - int64 start_changestamp, - const google_apis::ChangeListCallback& callback); + void GetChangeList(int64_t start_changestamp, + const google_apis::ChangeListCallback& callback); void GetRemainingChangeList( const GURL& next_link, diff --git a/chrome/browser/sync_file_system/drive_backend/drive_uploader_on_worker.h b/chrome/browser/sync_file_system/drive_backend/drive_uploader_on_worker.h index cfd2c39..b7a6924 100644 --- a/chrome/browser/sync_file_system/drive_backend/drive_uploader_on_worker.h +++ b/chrome/browser/sync_file_system/drive_backend/drive_uploader_on_worker.h @@ -7,6 +7,7 @@ #include <string> +#include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/memory/weak_ptr.h" #include "base/sequence_checker.h" diff --git a/chrome/browser/sync_file_system/drive_backend/drive_uploader_wrapper.h b/chrome/browser/sync_file_system/drive_backend/drive_uploader_wrapper.h index 4bdd548..621aafa 100644 --- a/chrome/browser/sync_file_system/drive_backend/drive_uploader_wrapper.h +++ b/chrome/browser/sync_file_system/drive_backend/drive_uploader_wrapper.h @@ -5,6 +5,7 @@ #ifndef CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_DRIVE_UPLOADER_WRAPPER_H_ #define CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_DRIVE_UPLOADER_WRAPPER_H_ +#include "base/macros.h" #include "base/memory/weak_ptr.h" #include "base/sequence_checker.h" #include "components/drive/drive_uploader.h" diff --git a/chrome/browser/sync_file_system/drive_backend/fake_drive_uploader.h b/chrome/browser/sync_file_system/drive_backend/fake_drive_uploader.h index da79223..e46373b 100644 --- a/chrome/browser/sync_file_system/drive_backend/fake_drive_uploader.h +++ b/chrome/browser/sync_file_system/drive_backend/fake_drive_uploader.h @@ -8,6 +8,7 @@ #include <string> #include "base/files/file_util.h" +#include "base/macros.h" #include "base/strings/stringprintf.h" #include "base/values.h" #include "chrome/browser/sync_file_system/drive_backend/fake_drive_service_helper.h" diff --git a/chrome/browser/sync_file_system/drive_backend/fake_sync_worker.h b/chrome/browser/sync_file_system/drive_backend/fake_sync_worker.h index 2103427..f242d43 100644 --- a/chrome/browser/sync_file_system/drive_backend/fake_sync_worker.h +++ b/chrome/browser/sync_file_system/drive_backend/fake_sync_worker.h @@ -9,6 +9,7 @@ #include <string> #include "base/callback.h" +#include "base/macros.h" #include "base/memory/scoped_ptr.h" #include "base/observer_list.h" #include "base/sequence_checker.h" diff --git a/chrome/browser/sync_file_system/drive_backend/folder_creator.cc b/chrome/browser/sync_file_system/drive_backend/folder_creator.cc index 1681184..40baec3 100644 --- a/chrome/browser/sync_file_system/drive_backend/folder_creator.cc +++ b/chrome/browser/sync_file_system/drive_backend/folder_creator.cc @@ -4,6 +4,8 @@ #include "chrome/browser/sync_file_system/drive_backend/folder_creator.h" +#include <stddef.h> + #include "chrome/browser/sync_file_system/drive_backend/drive_backend_util.h" #include "chrome/browser/sync_file_system/drive_backend/metadata_database.h" #include "components/drive/drive_api_util.h" diff --git a/chrome/browser/sync_file_system/drive_backend/folder_creator.h b/chrome/browser/sync_file_system/drive_backend/folder_creator.h index 2bce176..d00e7f2 100644 --- a/chrome/browser/sync_file_system/drive_backend/folder_creator.h +++ b/chrome/browser/sync_file_system/drive_backend/folder_creator.h @@ -7,6 +7,7 @@ #include <string> +#include "base/macros.h" #include "base/memory/scoped_ptr.h" #include "base/memory/scoped_vector.h" #include "base/memory/weak_ptr.h" diff --git a/chrome/browser/sync_file_system/drive_backend/leveldb_wrapper.h b/chrome/browser/sync_file_system/drive_backend/leveldb_wrapper.h index 424db40..036e943 100644 --- a/chrome/browser/sync_file_system/drive_backend/leveldb_wrapper.h +++ b/chrome/browser/sync_file_system/drive_backend/leveldb_wrapper.h @@ -5,10 +5,11 @@ #ifndef CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_LEVELDB_WRAPPER_H_ #define CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_LEVELDB_WRAPPER_H_ +#include <stdint.h> + #include <map> #include <string> -#include "base/basictypes.h" #include "base/macros.h" #include "base/memory/scoped_ptr.h" #include "third_party/leveldatabase/src/include/leveldb/slice.h" @@ -93,8 +94,8 @@ class LevelDBWrapper { // Returns the number of pending PUT/DELETE operations. // Each counter counts operations independently, so operations on a key // may be counted more than once. - int64 num_puts() { return num_puts_; } - int64 num_deletes() { return num_deletes_; } + int64_t num_puts() { return num_puts_; } + int64_t num_deletes() { return num_deletes_; } // TODO(peria): Rename this method to GetLevelDBForTesting, after removing // usages of drive_backend::MigrateDatabaseFromVxToVy() under @@ -105,8 +106,8 @@ class LevelDBWrapper { scoped_ptr<leveldb::DB> db_; PendingOperationMap pending_; - int64 num_puts_; - int64 num_deletes_; + int64_t num_puts_; + int64_t num_deletes_; DISALLOW_COPY_AND_ASSIGN(LevelDBWrapper); }; diff --git a/chrome/browser/sync_file_system/drive_backend/leveldb_wrapper_unittest.cc b/chrome/browser/sync_file_system/drive_backend/leveldb_wrapper_unittest.cc index a8afb55..a61fc11 100644 --- a/chrome/browser/sync_file_system/drive_backend/leveldb_wrapper_unittest.cc +++ b/chrome/browser/sync_file_system/drive_backend/leveldb_wrapper_unittest.cc @@ -4,10 +4,13 @@ #include "chrome/browser/sync_file_system/drive_backend/leveldb_wrapper.h" +#include <stddef.h> + #include <string> #include "base/files/scoped_temp_dir.h" #include "base/logging.h" +#include "base/macros.h" #include "base/strings/string_number_conversions.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/leveldatabase/src/helpers/memenv/memenv.h" diff --git a/chrome/browser/sync_file_system/drive_backend/list_changes_task.cc b/chrome/browser/sync_file_system/drive_backend/list_changes_task.cc index 783ca26..de9b3cc 100644 --- a/chrome/browser/sync_file_system/drive_backend/list_changes_task.cc +++ b/chrome/browser/sync_file_system/drive_backend/list_changes_task.cc @@ -4,6 +4,8 @@ #include "chrome/browser/sync_file_system/drive_backend/list_changes_task.h" +#include <stddef.h> + #include <vector> #include "base/bind.h" @@ -108,7 +110,7 @@ void ListChangesTask::DidListChanges( change_list->largest_change_id())); } -void ListChangesTask::CheckInChangeList(int64 largest_change_id, +void ListChangesTask::CheckInChangeList(int64_t largest_change_id, scoped_ptr<SyncTaskToken> token) { token->RecordLog(base::StringPrintf( "Got %" PRIuS " changes, updating MetadataDatabase.", diff --git a/chrome/browser/sync_file_system/drive_backend/list_changes_task.h b/chrome/browser/sync_file_system/drive_backend/list_changes_task.h index d94cb7a..7e9255e 100644 --- a/chrome/browser/sync_file_system/drive_backend/list_changes_task.h +++ b/chrome/browser/sync_file_system/drive_backend/list_changes_task.h @@ -5,6 +5,9 @@ #ifndef CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_LIST_CHANGES_TASK_H_ #define CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_LIST_CHANGES_TASK_H_ +#include <stdint.h> + +#include "base/macros.h" #include "base/memory/scoped_ptr.h" #include "base/memory/scoped_vector.h" #include "base/memory/weak_ptr.h" @@ -38,7 +41,7 @@ class ListChangesTask : public SyncTask { void DidListChanges(scoped_ptr<SyncTaskToken> token, google_apis::DriveApiErrorCode error, scoped_ptr<google_apis::ChangeList> change_list); - void CheckInChangeList(int64 largest_change_id, + void CheckInChangeList(int64_t largest_change_id, scoped_ptr<SyncTaskToken> token); bool IsContextReady(); diff --git a/chrome/browser/sync_file_system/drive_backend/list_changes_task_unittest.cc b/chrome/browser/sync_file_system/drive_backend/list_changes_task_unittest.cc index 8216c1f..0c7e1f3 100644 --- a/chrome/browser/sync_file_system/drive_backend/list_changes_task_unittest.cc +++ b/chrome/browser/sync_file_system/drive_backend/list_changes_task_unittest.cc @@ -4,10 +4,13 @@ #include "chrome/browser/sync_file_system/drive_backend/list_changes_task.h" +#include <stddef.h> + #include <string> #include "base/files/scoped_temp_dir.h" #include "base/format_macros.h" +#include "base/macros.h" #include "base/run_loop.h" #include "base/thread_task_runner_handle.h" #include "chrome/browser/sync_file_system/drive_backend/drive_backend_constants.h" diff --git a/chrome/browser/sync_file_system/drive_backend/local_to_remote_syncer.cc b/chrome/browser/sync_file_system/drive_backend/local_to_remote_syncer.cc index 220d384..f205186 100644 --- a/chrome/browser/sync_file_system/drive_backend/local_to_remote_syncer.cc +++ b/chrome/browser/sync_file_system/drive_backend/local_to_remote_syncer.cc @@ -37,7 +37,7 @@ namespace drive_backend { namespace { scoped_ptr<FileTracker> FindTrackerByID(MetadataDatabase* metadata_database, - int64 tracker_id) { + int64_t tracker_id) { scoped_ptr<FileTracker> tracker(new FileTracker); if (metadata_database->FindTrackerByTrackerID(tracker_id, tracker.get())) return tracker.Pass(); @@ -46,7 +46,7 @@ scoped_ptr<FileTracker> FindTrackerByID(MetadataDatabase* metadata_database, bool GetKnownChangeID(MetadataDatabase* metadata_database, const std::string& file_id, - int64* change_id) { + int64_t* change_id) { FileMetadata remote_file_metadata; if (!metadata_database->FindFileByFileID(file_id, &remote_file_metadata)) return false; @@ -295,7 +295,7 @@ void LocalToRemoteSyncer::ContinueAsBackgroundTask( // - Others, SyncEngineInitializer and RegisterAppTask doesn't affect to // LocalToRemoteSyncer. if (remote_file_tracker_) { - int64 latest_change_id = 0; + int64_t latest_change_id = 0; if (!GetKnownChangeID(metadata_database(), remote_file_tracker_->file_id(), &latest_change_id) || diff --git a/chrome/browser/sync_file_system/drive_backend/local_to_remote_syncer.h b/chrome/browser/sync_file_system/drive_backend/local_to_remote_syncer.h index f0b77ed..6cec015 100644 --- a/chrome/browser/sync_file_system/drive_backend/local_to_remote_syncer.h +++ b/chrome/browser/sync_file_system/drive_backend/local_to_remote_syncer.h @@ -5,8 +5,11 @@ #ifndef CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_LOCAL_TO_REMOTE_SYNCER_H_ #define CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_LOCAL_TO_REMOTE_SYNCER_H_ +#include <stdint.h> + #include <string> +#include "base/macros.h" #include "base/memory/scoped_ptr.h" #include "base/memory/weak_ptr.h" #include "chrome/browser/sync_file_system/drive_backend/sync_task.h" @@ -117,7 +120,7 @@ class LocalToRemoteSyncer : public SyncTask { scoped_ptr<FileTracker> remote_file_tracker_; scoped_ptr<FileTracker> remote_parent_folder_tracker_; base::FilePath target_path_; - int64 remote_file_change_id_; + int64_t remote_file_change_id_; bool retry_on_success_; bool needs_remote_change_listing_; diff --git a/chrome/browser/sync_file_system/drive_backend/local_to_remote_syncer_unittest.cc b/chrome/browser/sync_file_system/drive_backend/local_to_remote_syncer_unittest.cc index 89bd5a3..c0804d1 100644 --- a/chrome/browser/sync_file_system/drive_backend/local_to_remote_syncer_unittest.cc +++ b/chrome/browser/sync_file_system/drive_backend/local_to_remote_syncer_unittest.cc @@ -8,6 +8,7 @@ #include "base/callback.h" #include "base/files/scoped_temp_dir.h" #include "base/logging.h" +#include "base/macros.h" #include "base/run_loop.h" #include "base/thread_task_runner_handle.h" #include "chrome/browser/sync_file_system/drive_backend/drive_backend_constants.h" diff --git a/chrome/browser/sync_file_system/drive_backend/metadata_database.cc b/chrome/browser/sync_file_system/drive_backend/metadata_database.cc index 52c741c..02561d0 100644 --- a/chrome/browser/sync_file_system/drive_backend/metadata_database.cc +++ b/chrome/browser/sync_file_system/drive_backend/metadata_database.cc @@ -12,6 +12,7 @@ #include "base/files/file_path.h" #include "base/files/file_util.h" #include "base/location.h" +#include "base/macros.h" #include "base/memory/scoped_vector.h" #include "base/single_thread_task_runner.h" #include "base/stl_util.h" @@ -112,7 +113,7 @@ void PopulateFileDetailsByFileResource( } scoped_ptr<FileMetadata> CreateFileMetadataFromFileResource( - int64 change_id, + int64_t change_id, const google_apis::FileResource& resource) { scoped_ptr<FileMetadata> file(new FileMetadata); file->set_file_id(resource.file_id()); @@ -146,9 +147,8 @@ scoped_ptr<FileMetadata> CreateFileMetadataFromChangeResource( return file.Pass(); } -scoped_ptr<FileMetadata> CreateDeletedFileMetadata( - int64 change_id, - const std::string& file_id) { +scoped_ptr<FileMetadata> CreateDeletedFileMetadata(int64_t change_id, + const std::string& file_id) { scoped_ptr<FileMetadata> file(new FileMetadata); file->set_file_id(file_id); @@ -159,7 +159,7 @@ scoped_ptr<FileMetadata> CreateDeletedFileMetadata( } scoped_ptr<FileTracker> CreateSyncRootTracker( - int64 tracker_id, + int64_t tracker_id, const FileMetadata& sync_root_metadata) { scoped_ptr<FileTracker> sync_root_tracker(new FileTracker); sync_root_tracker->set_tracker_id(tracker_id); @@ -174,8 +174,8 @@ scoped_ptr<FileTracker> CreateSyncRootTracker( } scoped_ptr<FileTracker> CreateInitialAppRootTracker( - int64 tracker_id, - int64 parent_tracker_id, + int64_t tracker_id, + int64_t parent_tracker_id, const FileMetadata& app_root_metadata) { scoped_ptr<FileTracker> app_root_tracker(new FileTracker); app_root_tracker->set_tracker_id(tracker_id); @@ -242,7 +242,7 @@ SyncStatusCode MigrateDatabaseIfNeeded(LevelDBWrapper* db) { DCHECK(db); std::string value; leveldb::Status status = db->Get(kDatabaseVersionKey, &value); - int64 version = 0; + int64_t version = 0; if (status.ok()) { if (!base::StringToInt64(value, &version)) return SYNC_DATABASE_ERROR_FAILED; @@ -294,7 +294,7 @@ void MarkTrackerSetDirty(const TrackerIDSet& trackers, } } -void MarkTrackersDirtyByPath(int64 parent_tracker_id, +void MarkTrackersDirtyByPath(int64_t parent_tracker_id, const std::string& title, MetadataDatabaseIndexInterface* index) { if (parent_tracker_id == kInvalidTrackerID || title.empty()) @@ -309,12 +309,12 @@ void MarkTrackersDirtyByFileID(const std::string& file_id, MarkTrackerSetDirty(index->GetFileTrackerIDsByFileID(file_id), index); } -void MarkTrackersDirtyRecursively(int64 root_tracker_id, +void MarkTrackersDirtyRecursively(int64_t root_tracker_id, MetadataDatabaseIndexInterface* index) { - std::vector<int64> stack; + std::vector<int64_t> stack; stack.push_back(root_tracker_id); while (!stack.empty()) { - int64 tracker_id = stack.back(); + int64_t tracker_id = stack.back(); stack.pop_back(); AppendContents(index->GetFileTrackerIDsByParent(tracker_id), &stack); @@ -326,17 +326,17 @@ void MarkTrackersDirtyRecursively(int64 root_tracker_id, } } -void RemoveAllDescendantTrackers(int64 root_tracker_id, +void RemoveAllDescendantTrackers(int64_t root_tracker_id, MetadataDatabaseIndexInterface* index) { - std::vector<int64> pending_trackers; + std::vector<int64_t> pending_trackers; AppendContents(index->GetFileTrackerIDsByParent(root_tracker_id), &pending_trackers); - std::vector<int64> to_be_removed; + std::vector<int64_t> to_be_removed; // List trackers to remove. while (!pending_trackers.empty()) { - int64 tracker_id = pending_trackers.back(); + int64_t tracker_id = pending_trackers.back(); pending_trackers.pop_back(); AppendContents(index->GetFileTrackerIDsByParent(tracker_id), &pending_trackers); @@ -345,7 +345,7 @@ void RemoveAllDescendantTrackers(int64 root_tracker_id, // Remove trackers in the reversed order. base::hash_set<std::string> affected_file_ids; - for (std::vector<int64>::reverse_iterator itr = to_be_removed.rbegin(); + for (std::vector<int64_t>::reverse_iterator itr = to_be_removed.rbegin(); itr != to_be_removed.rend(); ++itr) { FileTracker tracker; index->GetFileTracker(*itr, &tracker); @@ -365,11 +365,10 @@ void RemoveAllDescendantTrackers(int64 root_tracker_id, } } -bool FilterFileTrackersByParent( - const MetadataDatabaseIndexInterface* index, - const TrackerIDSet& trackers, - int64 parent_tracker_id, - FileTracker* tracker_out) { +bool FilterFileTrackersByParent(const MetadataDatabaseIndexInterface* index, + const TrackerIDSet& trackers, + int64_t parent_tracker_id, + FileTracker* tracker_out) { FileTracker tracker; for (TrackerIDSet::const_iterator itr = trackers.begin(); itr != trackers.end(); ++itr) { @@ -390,7 +389,7 @@ bool FilterFileTrackersByParent( bool FilterFileTrackersByParentAndTitle( const MetadataDatabaseIndexInterface* index, const TrackerIDSet& trackers, - int64 parent_tracker_id, + int64_t parent_tracker_id, const std::string& title, FileTracker* result) { bool found = false; @@ -452,7 +451,7 @@ enum DirtyingOption { MARK_SAME_PATH_TRACKERS_DIRTY = 1 << 2, }; -void ActivateFileTracker(int64 tracker_id, +void ActivateFileTracker(int64_t tracker_id, int dirtying_options, MetadataDatabaseIndexInterface* index) { DCHECK(dirtying_options == MARK_NOTHING_DIRTY || @@ -474,7 +473,7 @@ void ActivateFileTracker(int64 tracker_id, index->StoreFileTracker(tracker.Pass()); } -void DeactivateFileTracker(int64 tracker_id, +void DeactivateFileTracker(int64_t tracker_id, int dirtying_options, MetadataDatabaseIndexInterface* index) { RemoveAllDescendantTrackers(tracker_id, index); @@ -494,7 +493,7 @@ void DeactivateFileTracker(int64 tracker_id, index->StoreFileTracker(tracker.Pass()); } -void RemoveFileTracker(int64 tracker_id, +void RemoveFileTracker(int64_t tracker_id, int dirtying_options, MetadataDatabaseIndexInterface* index) { DCHECK(!(dirtying_options & MARK_ITSELF_DIRTY)); @@ -504,7 +503,7 @@ void RemoveFileTracker(int64 tracker_id, return; std::string file_id = tracker.file_id(); - int64 parent_tracker_id = tracker.parent_tracker_id(); + int64_t parent_tracker_id = tracker.parent_tracker_id(); std::string title = GetTrackerTitle(tracker); RemoveAllDescendantTrackers(tracker_id, index); @@ -595,20 +594,20 @@ void MetadataDatabase::ClearDatabase( base::DeleteFile(database_path, true /* recursive */); } -int64 MetadataDatabase::GetLargestFetchedChangeID() const { +int64_t MetadataDatabase::GetLargestFetchedChangeID() const { return index_->GetLargestChangeID(); } -int64 MetadataDatabase::GetSyncRootTrackerID() const { +int64_t MetadataDatabase::GetSyncRootTrackerID() const { return index_->GetSyncRootTrackerID(); } -int64 MetadataDatabase::GetLargestKnownChangeID() const { +int64_t MetadataDatabase::GetLargestKnownChangeID() const { DCHECK_LE(GetLargestFetchedChangeID(), largest_known_change_id_); return largest_known_change_id_; } -void MetadataDatabase::UpdateLargestKnownChangeID(int64 change_id) { +void MetadataDatabase::UpdateLargestKnownChangeID(int64_t change_id) { if (largest_known_change_id_ < change_id) largest_known_change_id_ = change_id; } @@ -622,7 +621,7 @@ bool MetadataDatabase::HasSyncRoot() const { } SyncStatusCode MetadataDatabase::PopulateInitialData( - int64 largest_change_id, + int64_t largest_change_id, const google_apis::FileResource& sync_root_folder, const ScopedVector<google_apis::FileResource>& app_root_folders) { index_->SetLargestChangeID(largest_change_id); @@ -641,7 +640,7 @@ SyncStatusCode MetadataDatabase::PopulateInitialData( } bool MetadataDatabase::IsAppEnabled(const std::string& app_id) const { - int64 tracker_id = index_->GetAppRootTracker(app_id); + int64_t tracker_id = index_->GetAppRootTracker(app_id); if (tracker_id == kInvalidTrackerID) return false; @@ -670,7 +669,7 @@ SyncStatusCode MetadataDatabase::RegisterApp(const std::string& app_id, return SYNC_STATUS_HAS_CONFLICT; } - int64 sync_root_tracker_id = index_->GetSyncRootTrackerID(); + int64_t sync_root_tracker_id = index_->GetSyncRootTrackerID(); if (!sync_root_tracker_id) { util::Log(logging::LOG_WARNING, FROM_HERE, "Sync-root needs to be set up before registering app-root"); @@ -694,7 +693,7 @@ SyncStatusCode MetadataDatabase::RegisterApp(const std::string& app_id, } SyncStatusCode MetadataDatabase::DisableApp(const std::string& app_id) { - int64 tracker_id = index_->GetAppRootTracker(app_id); + int64_t tracker_id = index_->GetAppRootTracker(app_id); scoped_ptr<FileTracker> tracker(new FileTracker); if (!index_->GetFileTracker(tracker_id, tracker.get())) { return SYNC_DATABASE_ERROR_NOT_FOUND; @@ -716,7 +715,7 @@ SyncStatusCode MetadataDatabase::DisableApp(const std::string& app_id) { } SyncStatusCode MetadataDatabase::EnableApp(const std::string& app_id) { - int64 tracker_id = index_->GetAppRootTracker(app_id); + int64_t tracker_id = index_->GetAppRootTracker(app_id); scoped_ptr<FileTracker> tracker(new FileTracker); if (!index_->GetFileTracker(tracker_id, tracker.get())) { return SYNC_DATABASE_ERROR_NOT_FOUND; @@ -737,7 +736,7 @@ SyncStatusCode MetadataDatabase::EnableApp(const std::string& app_id) { } SyncStatusCode MetadataDatabase::UnregisterApp(const std::string& app_id) { - int64 tracker_id = index_->GetAppRootTracker(app_id); + int64_t tracker_id = index_->GetAppRootTracker(app_id); scoped_ptr<FileTracker> tracker(new FileTracker); if (!index_->GetFileTracker(tracker_id, tracker.get()) || tracker->tracker_kind() == TRACKER_KIND_REGULAR) { @@ -757,7 +756,7 @@ SyncStatusCode MetadataDatabase::UnregisterApp(const std::string& app_id) { bool MetadataDatabase::FindAppRootTracker(const std::string& app_id, FileTracker* tracker_out) const { - int64 app_root_tracker_id = index_->GetAppRootTracker(app_id); + int64_t app_root_tracker_id = index_->GetAppRootTracker(app_id); if (!app_root_tracker_id) return false; @@ -787,7 +786,7 @@ bool MetadataDatabase::FindTrackersByFileID(const std::string& file_id, } bool MetadataDatabase::FindTrackersByParentAndTitle( - int64 parent_tracker_id, + int64_t parent_tracker_id, const std::string& title, TrackerIDSet* trackers_out) const { TrackerIDSet trackers = @@ -800,12 +799,12 @@ bool MetadataDatabase::FindTrackersByParentAndTitle( return true; } -bool MetadataDatabase::FindTrackerByTrackerID(int64 tracker_id, +bool MetadataDatabase::FindTrackerByTrackerID(int64_t tracker_id, FileTracker* tracker_out) const { return index_->GetFileTracker(tracker_id, tracker_out); } -bool MetadataDatabase::BuildPathForTracker(int64 tracker_id, +bool MetadataDatabase::BuildPathForTracker(int64_t tracker_id, base::FilePath* path) const { FileTracker current; if (!FindTrackerByTrackerID(tracker_id, ¤t) || !current.active()) @@ -890,7 +889,7 @@ bool MetadataDatabase::FindNearestActiveAncestor( } SyncStatusCode MetadataDatabase::UpdateByChangeList( - int64 largest_change_id, + int64_t largest_change_id, ScopedVector<google_apis::ChangeResource> changes) { DCHECK_LE(index_->GetLargestChangeID(), largest_change_id); @@ -954,7 +953,7 @@ SyncStatusCode MetadataDatabase::UpdateByDeletedRemoteFileList( } SyncStatusCode MetadataDatabase::ReplaceActiveTrackerWithNewResource( - int64 parent_tracker_id, + int64_t parent_tracker_id, const google_apis::FileResource& resource) { DCHECK(!index_->GetFileMetadata(resource.file_id(), nullptr)); DCHECK(index_->GetFileTracker(parent_tracker_id, nullptr)); @@ -977,7 +976,7 @@ SyncStatusCode MetadataDatabase::ReplaceActiveTrackerWithNewResource( return SYNC_STATUS_FAILED; } - int64 tracker_id = to_be_activated.tracker_id(); + int64_t tracker_id = to_be_activated.tracker_id(); if (same_path_trackers.has_active()) { DeactivateFileTracker(same_path_trackers.active_tracker(), MARK_ITSELF_DIRTY | @@ -1009,7 +1008,7 @@ SyncStatusCode MetadataDatabase::PopulateFolderByChildList( base::hash_set<std::string> children(child_file_ids.begin(), child_file_ids.end()); - std::vector<int64> known_children = + std::vector<int64_t> known_children = index_->GetFileTrackerIDsByParent(folder_tracker->tracker_id()); for (size_t i = 0; i < known_children.size(); ++i) { FileTracker tracker; @@ -1032,7 +1031,7 @@ SyncStatusCode MetadataDatabase::PopulateFolderByChildList( } SyncStatusCode MetadataDatabase::UpdateTracker( - int64 tracker_id, + int64_t tracker_id, const FileDetails& updated_details) { FileTracker tracker; if (!index_->GetFileTracker(tracker_id, &tracker)) { @@ -1127,7 +1126,7 @@ SyncStatusCode MetadataDatabase::UpdateTracker( } MetadataDatabase::ActivationStatus MetadataDatabase::TryActivateTracker( - int64 parent_tracker_id, + int64_t parent_tracker_id, const std::string& file_id, SyncStatusCode* status_out) { FileMetadata metadata; @@ -1191,7 +1190,7 @@ MetadataDatabase::ActivationStatus MetadataDatabase::TryActivateTracker( return ACTIVATION_PENDING; } -void MetadataDatabase::DemoteTracker(int64 tracker_id) { +void MetadataDatabase::DemoteTracker(int64_t tracker_id) { index_->DemoteDirtyTracker(tracker_id); WriteToDatabase(); } @@ -1202,14 +1201,14 @@ bool MetadataDatabase::PromoteDemotedTrackers() { return promoted; } -void MetadataDatabase::PromoteDemotedTracker(int64 tracker_id) { +void MetadataDatabase::PromoteDemotedTracker(int64_t tracker_id) { index_->PromoteDemotedDirtyTracker(tracker_id); WriteToDatabase(); } bool MetadataDatabase::GetDirtyTracker( FileTracker* tracker_out) const { - int64 dirty_tracker_id = index_->PickDirtyTracker(); + int64_t dirty_tracker_id = index_->PickDirtyTracker(); if (!dirty_tracker_id) return false; @@ -1287,7 +1286,7 @@ void MetadataDatabase::GetRegisteredAppIDs(std::vector<std::string>* app_ids) { SyncStatusCode MetadataDatabase::SweepDirtyTrackers( const std::vector<std::string>& file_ids) { - std::set<int64> tracker_ids; + std::set<int64_t> tracker_ids; for (size_t i = 0; i < file_ids.size(); ++i) { TrackerIDSet trackers_for_file_id = index_->GetFileTrackerIDsByFileID(file_ids[i]); @@ -1296,7 +1295,7 @@ SyncStatusCode MetadataDatabase::SweepDirtyTrackers( tracker_ids.insert(*itr); } - for (std::set<int64>::iterator itr = tracker_ids.begin(); + for (std::set<int64_t>::iterator itr = tracker_ids.begin(); itr != tracker_ids.end(); ++itr) { scoped_ptr<FileTracker> tracker(new FileTracker); if (!index_->GetFileTracker(*itr, tracker.get()) || @@ -1383,7 +1382,7 @@ void MetadataDatabase::CreateTrackerInternal(const FileTracker& parent_tracker, const std::string& file_id, const FileDetails* details, UpdateOption option) { - int64 tracker_id = IncrementTrackerID(); + int64_t tracker_id = IncrementTrackerID(); scoped_ptr<FileTracker> tracker(new FileTracker); tracker->set_tracker_id(tracker_id); tracker->set_parent_tracker_id(parent_tracker.tracker_id()); @@ -1406,7 +1405,7 @@ void MetadataDatabase::CreateTrackerInternal(const FileTracker& parent_tracker, void MetadataDatabase::MaybeAddTrackersForNewFile( const FileMetadata& metadata, UpdateOption option) { - std::set<int64> parents_to_exclude; + std::set<int64_t> parents_to_exclude; TrackerIDSet existing_trackers = index_->GetFileTrackerIDsByFileID(metadata.file_id()); for (TrackerIDSet::const_iterator itr = existing_trackers.begin(); @@ -1417,7 +1416,7 @@ void MetadataDatabase::MaybeAddTrackersForNewFile( continue; } - int64 parent_tracker_id = tracker.parent_tracker_id(); + int64_t parent_tracker_id = tracker.parent_tracker_id(); if (!parent_tracker_id) continue; @@ -1449,8 +1448,8 @@ void MetadataDatabase::MaybeAddTrackersForNewFile( } } -int64 MetadataDatabase::IncrementTrackerID() { - int64 tracker_id = index_->GetNextTrackerID(); +int64_t MetadataDatabase::IncrementTrackerID() { + int64_t tracker_id = index_->GetNextTrackerID(); index_->SetNextTrackerID(tracker_id + 1); DCHECK_GT(tracker_id, 0); return tracker_id; @@ -1512,7 +1511,7 @@ bool MetadataDatabase::ShouldKeepDirty(const FileTracker& tracker) const { } bool MetadataDatabase::HasDisabledAppRoot(const FileTracker& tracker) const { - int64 app_root_tracker_id = index_->GetAppRootTracker(tracker.app_id()); + int64_t app_root_tracker_id = index_->GetAppRootTracker(tracker.app_id()); if (app_root_tracker_id == kInvalidTrackerID) return false; @@ -1529,7 +1528,7 @@ bool MetadataDatabase::HasActiveTrackerForFileID( return index_->GetFileTrackerIDsByFileID(file_id).has_active(); } -bool MetadataDatabase::HasActiveTrackerForPath(int64 parent_tracker_id, +bool MetadataDatabase::HasActiveTrackerForPath(int64_t parent_tracker_id, const std::string& title) const { return index_->GetFileTrackerIDsByParentAndTitle(parent_tracker_id, title) .has_active(); @@ -1592,11 +1591,11 @@ scoped_ptr<base::ListValue> MetadataDatabase::DumpFiles( if (!FindAppRootTracker(app_id, &app_root_tracker)) return files.Pass(); - std::vector<int64> stack; + std::vector<int64_t> stack; AppendContents( index_->GetFileTrackerIDsByParent(app_root_tracker.tracker_id()), &stack); while (!stack.empty()) { - int64 tracker_id = stack.back(); + int64_t tracker_id = stack.back(); stack.pop_back(); AppendContents(index_->GetFileTrackerIDsByParent(tracker_id), &stack); @@ -1639,7 +1638,7 @@ scoped_ptr<base::ListValue> MetadataDatabase::DumpDatabase() { } bool MetadataDatabase::HasNewerFileMetadata(const std::string& file_id, - int64 change_id) { + int64_t change_id) { FileMetadata metadata; if (!index_->GetFileMetadata(file_id, &metadata)) return false; @@ -1666,10 +1665,10 @@ scoped_ptr<base::ListValue> MetadataDatabase::DumpTrackers() { trackers->Append(metadata); // Append tracker data. - std::vector<int64> tracker_ids(index_->GetAllTrackerIDs()); - for (std::vector<int64>::const_iterator itr = tracker_ids.begin(); + std::vector<int64_t> tracker_ids(index_->GetAllTrackerIDs()); + for (std::vector<int64_t>::const_iterator itr = tracker_ids.begin(); itr != tracker_ids.end(); ++itr) { - const int64 tracker_id = *itr; + const int64_t tracker_id = *itr; FileTracker tracker; if (!index_->GetFileTracker(tracker_id, &tracker)) { NOTREACHED(); diff --git a/chrome/browser/sync_file_system/drive_backend/metadata_database.h b/chrome/browser/sync_file_system/drive_backend/metadata_database.h index 35deb5f..138a5fd 100644 --- a/chrome/browser/sync_file_system/drive_backend/metadata_database.h +++ b/chrome/browser/sync_file_system/drive_backend/metadata_database.h @@ -5,6 +5,9 @@ #ifndef CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_METADATA_DATABASE_H_ #define CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_METADATA_DATABASE_H_ +#include <stddef.h> +#include <stdint.h> + #include <map> #include <set> #include <string> @@ -13,6 +16,7 @@ #include "base/containers/hash_tables.h" #include "base/containers/scoped_ptr_hash_map.h" #include "base/files/file_path.h" +#include "base/macros.h" #include "base/memory/scoped_ptr.h" #include "base/memory/scoped_vector.h" #include "base/memory/weak_ptr.h" @@ -138,8 +142,8 @@ class MetadataDatabase { static void ClearDatabase(scoped_ptr<MetadataDatabase> metadata_database); - int64 GetLargestFetchedChangeID() const; - int64 GetSyncRootTrackerID() const; + int64_t GetLargestFetchedChangeID() const; + int64_t GetSyncRootTrackerID() const; // Returns true if the client should check if the sync root is still valid. bool NeedsSyncRootRevalidation() const; @@ -166,8 +170,8 @@ class MetadataDatabase { // FileMetadata from overwritten by ChangeList. // Also if other tasks try to update a remote resource whose change is not yet // retrieved the task should fail due to etag check, so we should be fine. - int64 GetLargestKnownChangeID() const; - void UpdateLargestKnownChangeID(int64 change_id); + int64_t GetLargestKnownChangeID() const; + void UpdateLargestKnownChangeID(int64_t change_id); // Populates empty database with initial data. // Adds a file metadata and a file tracker for |sync_root_folder|, and adds @@ -177,7 +181,7 @@ class MetadataDatabase { // Trackers for |app_root_folders| are not yet registered as app-roots, but // are ready to register. SyncStatusCode PopulateInitialData( - int64 largest_change_id, + int64_t largest_change_id, const google_apis::FileResource& sync_root_folder, const ScopedVector<google_apis::FileResource>& app_root_folders); @@ -218,7 +222,7 @@ class MetadataDatabase { // is found. // Copies the tracker identified by |tracker_id| into |tracker| if exists and // |tracker| is non-NULL. - bool FindTrackerByTrackerID(int64 tracker_id, FileTracker* tracker) const; + bool FindTrackerByTrackerID(int64_t tracker_id, FileTracker* tracker) const; // Finds the trackers tracking |file_id|. Returns true if the trackers are // found. @@ -229,15 +233,14 @@ class MetadataDatabase { // and who has |title| as its title in the synced_details. // Copies the tracker set to |trackers| if it is non-NULL. // Returns true if the trackers are found. - bool FindTrackersByParentAndTitle( - int64 parent_tracker_id, - const std::string& title, - TrackerIDSet* trackers) const; + bool FindTrackersByParentAndTitle(int64_t parent_tracker_id, + const std::string& title, + TrackerIDSet* trackers) const; // Builds the file path for the given tracker. Returns true on success. // |path| can be NULL. // The file path is relative to app-root and have a leading path separator. - bool BuildPathForTracker(int64 tracker_id, base::FilePath* path) const; + bool BuildPathForTracker(int64_t tracker_id, base::FilePath* path) const; // Builds the file path for the given tracker for display purpose. // This may return a path ending with '<unknown>' if the given tracker does @@ -257,7 +260,7 @@ class MetadataDatabase { // Marks each tracker for modified file as dirty and adds new trackers if // needed. SyncStatusCode UpdateByChangeList( - int64 largest_change_id, + int64_t largest_change_id, ScopedVector<google_apis::ChangeResource> changes); // Updates database by |resource|. @@ -277,7 +280,7 @@ class MetadataDatabase { // Deactivates existing active tracker if exists that has the same title and // parent_tracker to the newly added tracker. SyncStatusCode ReplaceActiveTrackerWithNewResource( - int64 parent_tracker_id, + int64_t parent_tracker_id, const google_apis::FileResource& resource); // Adds |child_file_ids| to |folder_id| as its children. @@ -287,7 +290,7 @@ class MetadataDatabase { const FileIDList& child_file_ids); // Updates |synced_details| of the tracker with |updated_details|. - SyncStatusCode UpdateTracker(int64 tracker_id, + SyncStatusCode UpdateTracker(int64_t tracker_id, const FileDetails& updated_details); // Activates a tracker identified by |parent_tracker_id| and |file_id| if the @@ -303,14 +306,14 @@ class MetadataDatabase { // The tracker to be activated must: // - have a tracked metadata in the database, // - have |synced_details| with valid |title|. - ActivationStatus TryActivateTracker(int64 parent_tracker_id, + ActivationStatus TryActivateTracker(int64_t parent_tracker_id, const std::string& file_id, SyncStatusCode* status); // Changes the priority of the tracker to low. - void DemoteTracker(int64 tracker_id); + void DemoteTracker(int64_t tracker_id); bool PromoteDemotedTrackers(); - void PromoteDemotedTracker(int64 tracker_id); + void PromoteDemotedTracker(int64_t tracker_id); // Returns true if there is a normal priority dirty tracker. // Assigns the dirty tracker if exists and |tracker| is non-NULL. @@ -344,8 +347,7 @@ class MetadataDatabase { SyncStatusCode Initialize(); // Database manipulation methods. - void RegisterTrackerAsAppRoot(const std::string& app_id, - int64 tracker_id); + void RegisterTrackerAsAppRoot(const std::string& app_id, int64_t tracker_id); void CreateTrackerForParentAndFileID(const FileTracker& parent_tracker, const std::string& file_id); @@ -360,14 +362,14 @@ class MetadataDatabase { void MaybeAddTrackersForNewFile(const FileMetadata& file, UpdateOption option); - int64 IncrementTrackerID(); + int64_t IncrementTrackerID(); bool CanActivateTracker(const FileTracker& tracker); bool ShouldKeepDirty(const FileTracker& tracker) const; bool HasDisabledAppRoot(const FileTracker& tracker) const; bool HasActiveTrackerForFileID(const std::string& file_id) const; - bool HasActiveTrackerForPath(int64 parent_tracker, + bool HasActiveTrackerForPath(int64_t parent_tracker, const std::string& title) const; void RemoveUnneededTrackersForMissingFile(const std::string& file_id); @@ -377,7 +379,7 @@ class MetadataDatabase { SyncStatusCode WriteToDatabase(); - bool HasNewerFileMetadata(const std::string& file_id, int64 change_id); + bool HasNewerFileMetadata(const std::string& file_id, int64_t change_id); scoped_ptr<base::ListValue> DumpTrackers(); scoped_ptr<base::ListValue> DumpMetadata(); @@ -385,7 +387,7 @@ class MetadataDatabase { void AttachSyncRoot(const google_apis::FileResource& sync_root_folder); void AttachInitialAppRoot(const google_apis::FileResource& app_root_folder); - void ForceActivateTrackerByPath(int64 parent_tracker_id, + void ForceActivateTrackerByPath(int64_t parent_tracker_id, const std::string& title, const std::string& file_id); @@ -397,7 +399,7 @@ class MetadataDatabase { bool enable_on_disk_index_; - int64 largest_known_change_id_; + int64_t largest_known_change_id_; scoped_ptr<MetadataDatabaseIndexInterface> index_; diff --git a/chrome/browser/sync_file_system/drive_backend/metadata_database_index.cc b/chrome/browser/sync_file_system/drive_backend/metadata_database_index.cc index d33e191..df4dcf6 100644 --- a/chrome/browser/sync_file_system/drive_backend/metadata_database_index.cc +++ b/chrome/browser/sync_file_system/drive_backend/metadata_database_index.cc @@ -24,7 +24,7 @@ // // NOTE // - Entries are sorted by keys. -// - int64 value is serialized as a string by base::Int64ToString(). +// - int64_t value is serialized as a string by base::Int64ToString(). // - ServiceMetadata, FileMetadata, and FileTracker values are serialized // as a string by SerializeToString() of protocol buffers. // @@ -42,15 +42,14 @@ // value: <FileMetadata 'metadata'> // // # Trackers of local file updates -// key: "TRACKER: " + <int64 'tracker_id'> +// key: "TRACKER: " + <int64_t 'tracker_id'> // value: <FileTracker 'tracker'> namespace sync_file_system { namespace drive_backend { ParentIDAndTitle::ParentIDAndTitle() : parent_id(0) {} -ParentIDAndTitle::ParentIDAndTitle(int64 parent_id, - const std::string& title) +ParentIDAndTitle::ParentIDAndTitle(int64_t parent_id, const std::string& title) : parent_id(parent_id), title(title) {} bool operator==(const ParentIDAndTitle& left, const ParentIDAndTitle& right) { @@ -102,7 +101,7 @@ void ReadDatabaseContents(LevelDBWrapper* db, DatabaseContents* contents) { std::string tracker_id_str; if (RemovePrefix(key, kFileTrackerKeyPrefix, &tracker_id_str)) { - int64 tracker_id = 0; + int64_t tracker_id = 0; if (!base::StringToInt64(tracker_id_str, &tracker_id)) { util::Log(logging::LOG_WARNING, FROM_HERE, "Failed to parse TrackerID"); @@ -122,16 +121,16 @@ void ReadDatabaseContents(LevelDBWrapper* db, DatabaseContents* contents) { } void RemoveUnreachableItemsFromDB(DatabaseContents* contents, - int64 sync_root_tracker_id, + int64_t sync_root_tracker_id, LevelDBWrapper* db) { - typedef std::map<int64, std::set<int64> > ChildTrackersByParent; + typedef std::map<int64_t, std::set<int64_t>> ChildTrackersByParent; ChildTrackersByParent trackers_by_parent; // Set up links from parent tracker to child trackers. for (size_t i = 0; i < contents->file_trackers.size(); ++i) { const FileTracker& tracker = *contents->file_trackers[i]; - int64 parent_tracker_id = tracker.parent_tracker_id(); - int64 tracker_id = tracker.tracker_id(); + int64_t parent_tracker_id = tracker.parent_tracker_id(); + int64_t tracker_id = tracker.tracker_id(); trackers_by_parent[parent_tracker_id].insert(tracker_id); } @@ -144,14 +143,14 @@ void RemoveUnreachableItemsFromDB(DatabaseContents* contents, trackers_by_parent.erase(tracker.tracker_id()); } - std::vector<int64> pending; + std::vector<int64_t> pending; if (sync_root_tracker_id != kInvalidTrackerID) pending.push_back(sync_root_tracker_id); // Traverse tracker tree from sync-root. - std::set<int64> visited_trackers; + std::set<int64_t> visited_trackers; while (!pending.empty()) { - int64 tracker_id = pending.back(); + int64_t tracker_id = pending.back(); DCHECK_NE(kInvalidTrackerID, tracker_id); pending.pop_back(); @@ -161,7 +160,7 @@ void RemoveUnreachableItemsFromDB(DatabaseContents* contents, } AppendContents( - LookUpMap(trackers_by_parent, tracker_id, std::set<int64>()), + LookUpMap(trackers_by_parent, tracker_id, std::set<int64_t>()), &pending); } @@ -267,8 +266,8 @@ bool MetadataDatabaseIndex::GetFileMetadata( return true; } -bool MetadataDatabaseIndex::GetFileTracker( - int64 tracker_id, FileTracker* tracker) const { +bool MetadataDatabaseIndex::GetFileTracker(int64_t tracker_id, + FileTracker* tracker) const { FileTracker* identified = tracker_by_id_.get(tracker_id); if (!identified) return false; @@ -297,7 +296,7 @@ void MetadataDatabaseIndex::StoreFileTracker( return; } - int64 tracker_id = tracker->tracker_id(); + int64_t tracker_id = tracker->tracker_id(); FileTracker* old_tracker = tracker_by_id_.get(tracker_id); if (!old_tracker) { @@ -326,7 +325,7 @@ void MetadataDatabaseIndex::RemoveFileMetadata(const std::string& file_id) { metadata_by_id_.erase(file_id); } -void MetadataDatabaseIndex::RemoveFileTracker(int64 tracker_id) { +void MetadataDatabaseIndex::RemoveFileTracker(int64_t tracker_id) { PutFileTrackerDeletionToDB(tracker_id, db_); FileTracker* tracker = tracker_by_id_.get(tracker_id); @@ -351,13 +350,13 @@ TrackerIDSet MetadataDatabaseIndex::GetFileTrackerIDsByFileID( return FindItem(trackers_by_file_id_, file_id); } -int64 MetadataDatabaseIndex::GetAppRootTracker( +int64_t MetadataDatabaseIndex::GetAppRootTracker( const std::string& app_id) const { return FindItem(app_root_by_app_id_, app_id); } TrackerIDSet MetadataDatabaseIndex::GetFileTrackerIDsByParentAndTitle( - int64 parent_tracker_id, + int64_t parent_tracker_id, const std::string& title) const { TrackerIDsByParentAndTitle::const_iterator found = trackers_by_parent_and_title_.find(parent_tracker_id); @@ -366,9 +365,9 @@ TrackerIDSet MetadataDatabaseIndex::GetFileTrackerIDsByParentAndTitle( return FindItem(found->second, title); } -std::vector<int64> MetadataDatabaseIndex::GetFileTrackerIDsByParent( - int64 parent_tracker_id) const { - std::vector<int64> result; +std::vector<int64_t> MetadataDatabaseIndex::GetFileTrackerIDsByParent( + int64_t parent_tracker_id) const { + std::vector<int64_t> result; TrackerIDsByParentAndTitle::const_iterator found = trackers_by_parent_and_title_.find(parent_tracker_id); if (found == trackers_by_parent_and_title_.end()) @@ -394,13 +393,13 @@ ParentIDAndTitle MetadataDatabaseIndex::PickMultiBackingFilePath() const { return *multi_backing_file_paths_.begin(); } -int64 MetadataDatabaseIndex::PickDirtyTracker() const { +int64_t MetadataDatabaseIndex::PickDirtyTracker() const { if (dirty_trackers_.empty()) return kInvalidTrackerID; return *dirty_trackers_.begin(); } -void MetadataDatabaseIndex::DemoteDirtyTracker(int64 tracker_id) { +void MetadataDatabaseIndex::DemoteDirtyTracker(int64_t tracker_id) { if (dirty_trackers_.erase(tracker_id)) demoted_dirty_trackers_.insert(tracker_id); } @@ -409,12 +408,12 @@ bool MetadataDatabaseIndex::HasDemotedDirtyTracker() const { return !demoted_dirty_trackers_.empty(); } -bool MetadataDatabaseIndex::IsDemotedDirtyTracker(int64 tracker_id) const { +bool MetadataDatabaseIndex::IsDemotedDirtyTracker(int64_t tracker_id) const { return demoted_dirty_trackers_.find(tracker_id) != demoted_dirty_trackers_.end(); } -void MetadataDatabaseIndex::PromoteDemotedDirtyTracker(int64 tracker_id) { +void MetadataDatabaseIndex::PromoteDemotedDirtyTracker(int64_t tracker_id) { if (demoted_dirty_trackers_.erase(tracker_id) == 1) dirty_trackers_.insert(tracker_id); } @@ -444,20 +443,18 @@ void MetadataDatabaseIndex::SetSyncRootRevalidated() const { PutServiceMetadataToDB(*service_metadata_, db_); } -void MetadataDatabaseIndex::SetSyncRootTrackerID( - int64 sync_root_id) const { +void MetadataDatabaseIndex::SetSyncRootTrackerID(int64_t sync_root_id) const { service_metadata_->set_sync_root_tracker_id(sync_root_id); PutServiceMetadataToDB(*service_metadata_, db_); } void MetadataDatabaseIndex::SetLargestChangeID( - int64 largest_change_id) const { + int64_t largest_change_id) const { service_metadata_->set_largest_change_id(largest_change_id); PutServiceMetadataToDB(*service_metadata_, db_); } -void MetadataDatabaseIndex::SetNextTrackerID( - int64 next_tracker_id) const { +void MetadataDatabaseIndex::SetNextTrackerID(int64_t next_tracker_id) const { service_metadata_->set_next_tracker_id(next_tracker_id); PutServiceMetadataToDB(*service_metadata_, db_); } @@ -467,19 +464,19 @@ bool MetadataDatabaseIndex::IsSyncRootRevalidated() const { service_metadata_->sync_root_revalidated(); } -int64 MetadataDatabaseIndex::GetSyncRootTrackerID() const { +int64_t MetadataDatabaseIndex::GetSyncRootTrackerID() const { if (!service_metadata_->has_sync_root_tracker_id()) return kInvalidTrackerID; return service_metadata_->sync_root_tracker_id(); } -int64 MetadataDatabaseIndex::GetLargestChangeID() const { +int64_t MetadataDatabaseIndex::GetLargestChangeID() const { if (!service_metadata_->has_largest_change_id()) return kInvalidTrackerID; return service_metadata_->largest_change_id(); } -int64 MetadataDatabaseIndex::GetNextTrackerID() const { +int64_t MetadataDatabaseIndex::GetNextTrackerID() const { if (!service_metadata_->has_next_tracker_id()) { NOTREACHED(); return kInvalidTrackerID; @@ -496,8 +493,8 @@ std::vector<std::string> MetadataDatabaseIndex::GetRegisteredAppIDs() const { return result; } -std::vector<int64> MetadataDatabaseIndex::GetAllTrackerIDs() const { - std::vector<int64> result; +std::vector<int64_t> MetadataDatabaseIndex::GetAllTrackerIDs() const { + std::vector<int64_t> result; for (TrackerByID::const_iterator itr = tracker_by_id_.begin(); itr != tracker_by_id_.end(); ++itr) { result.push_back(itr->first); @@ -615,7 +612,7 @@ void MetadataDatabaseIndex::RemoveFromFileIDIndexes( void MetadataDatabaseIndex::AddToPathIndexes( const FileTracker& new_tracker) { - int64 parent = new_tracker.parent_tracker_id(); + int64_t parent = new_tracker.parent_tracker_id(); std::string title = GetTrackerTitle(new_tracker); DVLOG(3) << " Add to trackers_by_parent_and_title_: " @@ -640,8 +637,8 @@ void MetadataDatabaseIndex::UpdateInPathIndexes( DCHECK(GetTrackerTitle(old_tracker) == GetTrackerTitle(new_tracker) || !old_tracker.has_synced_details()); - int64 tracker_id = new_tracker.tracker_id(); - int64 parent = new_tracker.parent_tracker_id(); + int64_t tracker_id = new_tracker.tracker_id(); + int64_t parent = new_tracker.parent_tracker_id(); std::string old_title = GetTrackerTitle(old_tracker); std::string title = GetTrackerTitle(new_tracker); @@ -693,8 +690,8 @@ void MetadataDatabaseIndex::UpdateInPathIndexes( void MetadataDatabaseIndex::RemoveFromPathIndexes( const FileTracker& tracker) { - int64 tracker_id = tracker.tracker_id(); - int64 parent = tracker.parent_tracker_id(); + int64_t tracker_id = tracker.tracker_id(); + int64_t parent = tracker.parent_tracker_id(); std::string title = GetTrackerTitle(tracker); DCHECK(ContainsKey(trackers_by_parent_and_title_, parent)); @@ -737,7 +734,7 @@ void MetadataDatabaseIndex::UpdateInDirtyTrackerIndexes( const FileTracker& new_tracker) { DCHECK_EQ(old_tracker.tracker_id(), new_tracker.tracker_id()); - int64 tracker_id = new_tracker.tracker_id(); + int64_t tracker_id = new_tracker.tracker_id(); if (old_tracker.dirty() && !new_tracker.dirty()) { DCHECK(ContainsKey(dirty_trackers_, tracker_id) || ContainsKey(demoted_dirty_trackers_, tracker_id)); @@ -759,7 +756,7 @@ void MetadataDatabaseIndex::UpdateInDirtyTrackerIndexes( void MetadataDatabaseIndex::RemoveFromDirtyTrackerIndexes( const FileTracker& tracker) { if (tracker.dirty()) { - int64 tracker_id = tracker.tracker_id(); + int64_t tracker_id = tracker.tracker_id(); DCHECK(ContainsKey(dirty_trackers_, tracker_id) || ContainsKey(demoted_dirty_trackers_, tracker_id)); diff --git a/chrome/browser/sync_file_system/drive_backend/metadata_database_index.h b/chrome/browser/sync_file_system/drive_backend/metadata_database_index.h index c907e6d..a6f4510 100644 --- a/chrome/browser/sync_file_system/drive_backend/metadata_database_index.h +++ b/chrome/browser/sync_file_system/drive_backend/metadata_database_index.h @@ -5,6 +5,9 @@ #ifndef CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_METADATA_DATABASE_INDEX_H_ #define CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_METADATA_DATABASE_INDEX_H_ +#include <stddef.h> +#include <stdint.h> + #include <map> #include <set> #include <string> @@ -12,6 +15,7 @@ #include "base/containers/hash_tables.h" #include "base/containers/scoped_ptr_hash_map.h" +#include "base/macros.h" #include "base/memory/scoped_vector.h" #include "chrome/browser/sync_file_system/drive_backend/metadata_database_index_interface.h" #include "chrome/browser/sync_file_system/drive_backend/tracker_id_set.h" @@ -61,53 +65,53 @@ class MetadataDatabaseIndex : public MetadataDatabaseIndexInterface { void RemoveUnreachableItems() override; bool GetFileMetadata(const std::string& file_id, FileMetadata* metadata) const override; - bool GetFileTracker(int64 tracker_id, FileTracker* tracker) const override; + bool GetFileTracker(int64_t tracker_id, FileTracker* tracker) const override; void StoreFileMetadata(scoped_ptr<FileMetadata> metadata) override; void StoreFileTracker(scoped_ptr<FileTracker> tracker) override; void RemoveFileMetadata(const std::string& file_id) override; - void RemoveFileTracker(int64 tracker_id) override; + void RemoveFileTracker(int64_t tracker_id) override; TrackerIDSet GetFileTrackerIDsByFileID( const std::string& file_id) const override; - int64 GetAppRootTracker(const std::string& app_id) const override; + int64_t GetAppRootTracker(const std::string& app_id) const override; TrackerIDSet GetFileTrackerIDsByParentAndTitle( - int64 parent_tracker_id, + int64_t parent_tracker_id, const std::string& title) const override; - std::vector<int64> GetFileTrackerIDsByParent( - int64 parent_tracker_id) const override; + std::vector<int64_t> GetFileTrackerIDsByParent( + int64_t parent_tracker_id) const override; std::string PickMultiTrackerFileID() const override; ParentIDAndTitle PickMultiBackingFilePath() const override; - int64 PickDirtyTracker() const override; - void DemoteDirtyTracker(int64 tracker_id) override; + int64_t PickDirtyTracker() const override; + void DemoteDirtyTracker(int64_t tracker_id) override; bool HasDemotedDirtyTracker() const override; - bool IsDemotedDirtyTracker(int64 tracker_id) const override; - void PromoteDemotedDirtyTracker(int64 tracker_id) override; + bool IsDemotedDirtyTracker(int64_t tracker_id) const override; + void PromoteDemotedDirtyTracker(int64_t tracker_id) override; bool PromoteDemotedDirtyTrackers() override; size_t CountDirtyTracker() const override; size_t CountFileMetadata() const override; size_t CountFileTracker() const override; void SetSyncRootRevalidated() const override; - void SetSyncRootTrackerID(int64 sync_root_id) const override; - void SetLargestChangeID(int64 largest_change_id) const override; - void SetNextTrackerID(int64 next_tracker_id) const override; + void SetSyncRootTrackerID(int64_t sync_root_id) const override; + void SetLargestChangeID(int64_t largest_change_id) const override; + void SetNextTrackerID(int64_t next_tracker_id) const override; bool IsSyncRootRevalidated() const override; - int64 GetSyncRootTrackerID() const override; - int64 GetLargestChangeID() const override; - int64 GetNextTrackerID() const override; + int64_t GetSyncRootTrackerID() const override; + int64_t GetLargestChangeID() const override; + int64_t GetNextTrackerID() const override; std::vector<std::string> GetRegisteredAppIDs() const override; - std::vector<int64> GetAllTrackerIDs() const override; + std::vector<int64_t> GetAllTrackerIDs() const override; std::vector<std::string> GetAllMetadataIDs() const override; private: typedef base::ScopedPtrHashMap<std::string, scoped_ptr<FileMetadata>> MetadataByID; - typedef base::ScopedPtrHashMap<int64, scoped_ptr<FileTracker>> TrackerByID; + typedef base::ScopedPtrHashMap<int64_t, scoped_ptr<FileTracker>> TrackerByID; typedef base::hash_map<std::string, TrackerIDSet> TrackerIDsByFileID; typedef base::hash_map<std::string, TrackerIDSet> TrackerIDsByTitle; - typedef std::map<int64, TrackerIDsByTitle> TrackerIDsByParentAndTitle; - typedef base::hash_map<std::string, int64> TrackerIDByAppID; + typedef std::map<int64_t, TrackerIDsByTitle> TrackerIDsByParentAndTitle; + typedef base::hash_map<std::string, int64_t> TrackerIDByAppID; typedef base::hash_set<std::string> FileIDSet; typedef base::hash_set<ParentIDAndTitle> PathSet; - typedef std::set<int64> DirtyTrackers; + typedef std::set<int64_t> DirtyTrackers; friend class MetadataDatabaseTest; diff --git a/chrome/browser/sync_file_system/drive_backend/metadata_database_index_interface.h b/chrome/browser/sync_file_system/drive_backend/metadata_database_index_interface.h index 0c06301..622c35c 100644 --- a/chrome/browser/sync_file_system/drive_backend/metadata_database_index_interface.h +++ b/chrome/browser/sync_file_system/drive_backend/metadata_database_index_interface.h @@ -5,10 +5,13 @@ #ifndef CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_METADATA_DATABASE_INDEX_INTERFACE_H_ #define CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_METADATA_DATABASE_INDEX_INTERFACE_H_ +#include <stddef.h> +#include <stdint.h> + #include <string> #include <vector> -#include "base/basictypes.h" +#include "base/macros.h" #include "base/memory/scoped_ptr.h" namespace sync_file_system { @@ -19,11 +22,11 @@ class FileTracker; class TrackerIDSet; struct ParentIDAndTitle { - int64 parent_id; + int64_t parent_id; std::string title; ParentIDAndTitle(); - ParentIDAndTitle(int64 parent_id, const std::string& title); + ParentIDAndTitle(int64_t parent_id, const std::string& title); }; bool operator==(const ParentIDAndTitle& left, const ParentIDAndTitle& right); @@ -45,8 +48,8 @@ class MetadataDatabaseIndexInterface { // Returns true if FileTracker identified by |tracker_id| exists. // If |tracker| is not NULL, the FileTracker is copied to it. - virtual bool GetFileTracker( - int64 tracker_id, FileTracker* tracker) const = 0; + virtual bool GetFileTracker(int64_t tracker_id, + FileTracker* tracker) const = 0; // Stores |metadata| and updates indexes. // This overwrites existing FileMetadata for the same |file_id|. @@ -60,7 +63,7 @@ class MetadataDatabaseIndexInterface { virtual void RemoveFileMetadata(const std::string& file_id) = 0; // Removes FileTracker identified by |tracker_id| from indexes. - virtual void RemoveFileTracker(int64 tracker_id) = 0; + virtual void RemoveFileTracker(int64_t tracker_id) = 0; // Returns a set of FileTracker that have |file_id| as its own. virtual TrackerIDSet GetFileTrackerIDsByFileID( @@ -68,15 +71,15 @@ class MetadataDatabaseIndexInterface { // Returns an app-root tracker identified by |app_id|. Returns 0 if not // found. - virtual int64 GetAppRootTracker(const std::string& app_id) const = 0; + virtual int64_t GetAppRootTracker(const std::string& app_id) const = 0; // Returns a set of FileTracker that have |parent_tracker_id| and |title|. virtual TrackerIDSet GetFileTrackerIDsByParentAndTitle( - int64 parent_tracker_id, + int64_t parent_tracker_id, const std::string& title) const = 0; - virtual std::vector<int64> GetFileTrackerIDsByParent( - int64 parent_tracker_id) const = 0; + virtual std::vector<int64_t> GetFileTrackerIDsByParent( + int64_t parent_tracker_id) const = 0; // Returns the |file_id| of a file that has multiple trackers. virtual std::string PickMultiTrackerFileID() const = 0; @@ -87,16 +90,16 @@ class MetadataDatabaseIndexInterface { // Returns a FileTracker whose |dirty| is set and which isn't demoted. // Returns 0 if not found. - virtual int64 PickDirtyTracker() const = 0; + virtual int64_t PickDirtyTracker() const = 0; // Demotes a dirty tracker. - virtual void DemoteDirtyTracker(int64 tracker_id) = 0; + virtual void DemoteDirtyTracker(int64_t tracker_id) = 0; virtual bool HasDemotedDirtyTracker() const = 0; - virtual bool IsDemotedDirtyTracker(int64 tracker_id) const = 0; + virtual bool IsDemotedDirtyTracker(int64_t tracker_id) const = 0; // Promotes single demoted dirty tracker to a normal dirty tracker. - virtual void PromoteDemotedDirtyTracker(int64 tracker_id) = 0; + virtual void PromoteDemotedDirtyTracker(int64_t tracker_id) = 0; // Promotes all demoted dirty trackers to normal dirty trackers. // Returns true if any tracker was promoted. @@ -107,15 +110,15 @@ class MetadataDatabaseIndexInterface { virtual size_t CountFileTracker() const = 0; virtual void SetSyncRootRevalidated() const = 0; - virtual void SetSyncRootTrackerID(int64 sync_root_id) const = 0; - virtual void SetLargestChangeID(int64 largest_change_id) const = 0; - virtual void SetNextTrackerID(int64 next_tracker_id) const = 0; + virtual void SetSyncRootTrackerID(int64_t sync_root_id) const = 0; + virtual void SetLargestChangeID(int64_t largest_change_id) const = 0; + virtual void SetNextTrackerID(int64_t next_tracker_id) const = 0; virtual bool IsSyncRootRevalidated() const = 0; - virtual int64 GetSyncRootTrackerID() const = 0; - virtual int64 GetLargestChangeID() const = 0; - virtual int64 GetNextTrackerID() const = 0; + virtual int64_t GetSyncRootTrackerID() const = 0; + virtual int64_t GetLargestChangeID() const = 0; + virtual int64_t GetNextTrackerID() const = 0; virtual std::vector<std::string> GetRegisteredAppIDs() const = 0; - virtual std::vector<int64> GetAllTrackerIDs() const = 0; + virtual std::vector<int64_t> GetAllTrackerIDs() const = 0; virtual std::vector<std::string> GetAllMetadataIDs() const = 0; private: diff --git a/chrome/browser/sync_file_system/drive_backend/metadata_database_index_on_disk.cc b/chrome/browser/sync_file_system/drive_backend/metadata_database_index_on_disk.cc index 4956f48..2587acb 100644 --- a/chrome/browser/sync_file_system/drive_backend/metadata_database_index_on_disk.cc +++ b/chrome/browser/sync_file_system/drive_backend/metadata_database_index_on_disk.cc @@ -6,6 +6,7 @@ #include "base/format_macros.h" #include "base/logging.h" +#include "base/macros.h" #include "base/stl_util.h" #include "base/strings/string_number_conversions.h" #include "base/strings/string_util.h" @@ -21,7 +22,7 @@ // // NOTE // - Entries are sorted by keys. -// - int64 value is serialized as a string by base::Int64ToString(). +// - int64_t value is serialized as a string by base::Int64ToString(). // - ServiceMetadata, FileMetadata, and FileTracker values are serialized // as a string by SerializeToString() of protocol buffers. // @@ -39,45 +40,46 @@ // value: <FileMetadata 'metadata'> // // # Trackers of remote file updates (compatible with version 3) -// key: "TRACKER: " + <int64 'tracker_id'> +// key: "TRACKER: " + <int64_t 'tracker_id'> // value: <FileTracker 'tracker'> // // # Index from App ID to the tracker ID // key: "APP_ROOT: " + <string 'app_id'> -// value: <int64 'app_root_tracker_id'> +// value: <int64_t 'app_root_tracker_id'> // // # Index from file ID to the active tracker ID // key: "ACTIVE_FILE: " + <string 'file_id'> -// value: <int64 'active_tracker_id'> +// value: <int64_t 'active_tracker_id'> // // # Index from file ID to a tracker ID -// key: "TRACKER_FILE: " + <string 'file_id'> + '\x00' + <int64 'tracker_id'> +// key: "TRACKER_FILE: " + <string 'file_id'> + '\x00' + +// <int64_t'tracker_id'> // value: <empty> // // # Tracker IDs; a file metadata linked to multiple tracker IDs. -// key: "MULTI_FILE: " + <int64 'tracker_id'> +// key: "MULTI_FILE: " + <int64_t 'tracker_id'> // value: <empty> // // # Index from the parent tracker ID and the title to the active tracker ID -// key: "ACTIVE_PATH: " + <int64 'parent_tracker_id'> + +// key: "ACTIVE_PATH: " + <int64_t 'parent_tracker_id'> + // '\x00' + <string 'title'> -// value: <int64 'active_tracker_id'> +// value: <int64_t 'active_tracker_id'> // // # Index from the parent tracker ID and the title to a tracker ID -// key: "TRACKER_PATH: " + <int64 'parent_tracker_id'> + -// '\x00' + <string 'title'> + '\x00' + <int64 'tracker_id'> +// key: "TRACKER_PATH: " + <int64_t 'parent_tracker_id'> + +// '\x00' + <string 'title'> + '\x00' + <int64_t 'tracker_id'> // value: <empty> // // # Tracker IDs; a parent tracker ID and a title figure multiple tracker IDs -// key: "MULTI_PATH: " + <int64 'tracker_id'> +// key: "MULTI_PATH: " + <int64_t 'tracker_id'> // value: <empty> // // # Dirty tracker IDs -// key: "DIRTY: " + <int64 'dirty_tracker_id'> +// key: "DIRTY: " + <int64_t 'dirty_tracker_id'> // value: <empty> // // # Demoted dirty tracker IDs -// key: "DEMOTED_DIRTY: " + <int64 'demoted_dirty_tracker_id'> +// key: "DEMOTED_DIRTY: " + <int64_t 'demoted_dirty_tracker_id'> // value: <empty> // // # Timestamp when the last validation ran @@ -108,7 +110,8 @@ std::string GenerateMultiTrackerKey(const std::string& file_id) { } std::string GenerateActiveTrackerIDByParentAndTitleKey( - int64 parent_id, const std::string& title) { + int64_t parent_id, + const std::string& title) { std::ostringstream oss; oss << kActiveTrackerIDByParentAndTitleKeyPrefix << parent_id << '\0' << title; @@ -116,44 +119,45 @@ std::string GenerateActiveTrackerIDByParentAndTitleKey( } std::string GenerateTrackerIDByParentAndTitleKeyPrefix( - int64 parent_id, const std::string& title) { + int64_t parent_id, + const std::string& title) { std::ostringstream oss; oss << kTrackerIDByParentAndTitleKeyPrefix << parent_id << '\0' << title << '\0'; return oss.str(); } -std::string GenerateTrackerIDsByParentIDKeyPrefix(int64 parent_id) { +std::string GenerateTrackerIDsByParentIDKeyPrefix(int64_t parent_id) { std::ostringstream oss; oss << kTrackerIDByParentAndTitleKeyPrefix << parent_id << '\0'; return oss.str(); } -std::string GenerateMultiBackingParentAndTitleKey( - int64 parent_id, const std::string& title) { +std::string GenerateMultiBackingParentAndTitleKey(int64_t parent_id, + const std::string& title) { std::ostringstream oss; oss << kMultiBackingParentAndTitleKeyPrefix << parent_id << '\0' << title; return oss.str(); } -std::string GenerateDirtyIDKey(int64 tracker_id) { +std::string GenerateDirtyIDKey(int64_t tracker_id) { return kDirtyIDKeyPrefix + base::Int64ToString(tracker_id); } -std::string GenerateDemotedDirtyIDKey(int64 tracker_id) { +std::string GenerateDemotedDirtyIDKey(int64_t tracker_id) { return kDemotedDirtyIDKeyPrefix + base::Int64ToString(tracker_id); } void RemoveUnreachableItemsFromDB(LevelDBWrapper* db, - int64 sync_root_tracker_id) { + int64_t sync_root_tracker_id) { DCHECK(db); - typedef std::map<int64, std::set<int64> > ChildTrackersByParent; + typedef std::map<int64_t, std::set<int64_t>> ChildTrackersByParent; ChildTrackersByParent trackers_by_parent; { // Set up links from parent tracker to child trackers. - std::set<int64> inactive_trackers; + std::set<int64_t> inactive_trackers; scoped_ptr<LevelDBWrapper::Iterator> itr = db->NewIterator(); for (itr->Seek(kFileTrackerKeyPrefix); itr->Valid(); itr->Next()) { if (!RemovePrefix(itr->key().ToString(), kFileTrackerKeyPrefix, nullptr)) @@ -166,29 +170,29 @@ void RemoveUnreachableItemsFromDB(LevelDBWrapper* db, continue; } - int64 parent_tracker_id = tracker->parent_tracker_id(); - int64 tracker_id = tracker->tracker_id(); + int64_t parent_tracker_id = tracker->parent_tracker_id(); + int64_t tracker_id = tracker->tracker_id(); trackers_by_parent[parent_tracker_id].insert(tracker_id); if (!tracker->active()) inactive_trackers.insert(tracker_id); } // Drop links from inactive trackers. - for (std::set<int64>::iterator iter = inactive_trackers.begin(); + for (std::set<int64_t>::iterator iter = inactive_trackers.begin(); iter != inactive_trackers.end(); ++iter) { trackers_by_parent.erase(*iter); } } // Traverse tracker tree from sync-root. - std::set<int64> visited_trackers; + std::set<int64_t> visited_trackers; { - std::vector<int64> pending; + std::vector<int64_t> pending; if (sync_root_tracker_id != kInvalidTrackerID) pending.push_back(sync_root_tracker_id); while (!pending.empty()) { - int64 tracker_id = pending.back(); + int64_t tracker_id = pending.back(); DCHECK_NE(kInvalidTrackerID, tracker_id); pending.pop_back(); @@ -198,7 +202,7 @@ void RemoveUnreachableItemsFromDB(LevelDBWrapper* db, } AppendContents( - LookUpMap(trackers_by_parent, tracker_id, std::set<int64>()), + LookUpMap(trackers_by_parent, tracker_id, std::set<int64_t>()), &pending); } } @@ -305,8 +309,8 @@ bool MetadataDatabaseIndexOnDisk::GetFileMetadata( return true; } -bool MetadataDatabaseIndexOnDisk::GetFileTracker( - int64 tracker_id, FileTracker* tracker) const { +bool MetadataDatabaseIndexOnDisk::GetFileTracker(int64_t tracker_id, + FileTracker* tracker) const { const std::string key = kFileTrackerKeyPrefix + base::Int64ToString(tracker_id); std::string value; @@ -346,7 +350,7 @@ void MetadataDatabaseIndexOnDisk::StoreFileTracker( scoped_ptr<FileTracker> tracker) { DCHECK(tracker); - int64 tracker_id = tracker->tracker_id(); + int64_t tracker_id = tracker->tracker_id(); FileTracker old_tracker; if (!GetFileTracker(tracker_id, &old_tracker)) { DVLOG(3) << "Adding new tracker: " << tracker->tracker_id() @@ -372,7 +376,7 @@ void MetadataDatabaseIndexOnDisk::RemoveFileMetadata( PutFileMetadataDeletionToDB(file_id, db_); } -void MetadataDatabaseIndexOnDisk::RemoveFileTracker(int64 tracker_id) { +void MetadataDatabaseIndexOnDisk::RemoveFileTracker(int64_t tracker_id) { FileTracker tracker; if (!GetFileTracker(tracker_id, &tracker)) { NOTREACHED(); @@ -396,7 +400,7 @@ TrackerIDSet MetadataDatabaseIndexOnDisk::GetFileTrackerIDsByFileID( GenerateTrackerIDByFileIDKeyPrefix(file_id)); } -int64 MetadataDatabaseIndexOnDisk::GetAppRootTracker( +int64_t MetadataDatabaseIndexOnDisk::GetAppRootTracker( const std::string& app_id) const { const std::string key = GenerateAppRootIDByAppIDKey(app_id); std::string value; @@ -413,7 +417,7 @@ int64 MetadataDatabaseIndexOnDisk::GetAppRootTracker( return kInvalidTrackerID; } - int64 root_id; + int64_t root_id; if (!base::StringToInt64(value, &root_id)) { util::Log(logging::LOG_WARNING, FROM_HERE, "Failed to parse a root ID (%s) for an App ID: %s", @@ -426,15 +430,16 @@ int64 MetadataDatabaseIndexOnDisk::GetAppRootTracker( } TrackerIDSet MetadataDatabaseIndexOnDisk::GetFileTrackerIDsByParentAndTitle( - int64 parent_tracker_id, const std::string& title) const { + int64_t parent_tracker_id, + const std::string& title) const { return GetTrackerIDSetByPrefix( GenerateActiveTrackerIDByParentAndTitleKey(parent_tracker_id, title), GenerateTrackerIDByParentAndTitleKeyPrefix(parent_tracker_id, title)); } -std::vector<int64> MetadataDatabaseIndexOnDisk::GetFileTrackerIDsByParent( - int64 parent_id) const { - std::vector<int64> result; +std::vector<int64_t> MetadataDatabaseIndexOnDisk::GetFileTrackerIDsByParent( + int64_t parent_id) const { + std::vector<int64_t> result; const std::string prefix = GenerateTrackerIDsByParentIDKeyPrefix(parent_id); scoped_ptr<LevelDBWrapper::Iterator> itr(db_->NewIterator()); @@ -447,7 +452,7 @@ std::vector<int64> MetadataDatabaseIndexOnDisk::GetFileTrackerIDsByParent( size_t pos = title_and_id.rfind('\0'); DCHECK(pos != std::string::npos); - int64 tracker_id; + int64_t tracker_id; if (!base::StringToInt64(title_and_id.substr(pos + 1), &tracker_id)) continue; result.push_back(tracker_id); @@ -484,12 +489,12 @@ ParentIDAndTitle MetadataDatabaseIndexOnDisk::PickMultiBackingFilePath() const { if (pos == std::string::npos) return ParentIDAndTitle(); - int64 parent_id; + int64_t parent_id; return base::StringToInt64(value.substr(0, pos), &parent_id) ? ParentIDAndTitle(parent_id, value.substr(pos + 1)) : ParentIDAndTitle(); } -int64 MetadataDatabaseIndexOnDisk::PickDirtyTracker() const { +int64_t MetadataDatabaseIndexOnDisk::PickDirtyTracker() const { scoped_ptr<LevelDBWrapper::Iterator> itr(db_->NewIterator()); itr->Seek(kDirtyIDKeyPrefix); if (!itr->Valid()) @@ -499,14 +504,14 @@ int64 MetadataDatabaseIndexOnDisk::PickDirtyTracker() const { if (!RemovePrefix(itr->key().ToString(), kDirtyIDKeyPrefix, &id_str)) return kInvalidTrackerID; - int64 tracker_id; + int64_t tracker_id; if (!base::StringToInt64(id_str, &tracker_id)) return kInvalidTrackerID; return tracker_id; } -void MetadataDatabaseIndexOnDisk::DemoteDirtyTracker(int64 tracker_id) { +void MetadataDatabaseIndexOnDisk::DemoteDirtyTracker(int64_t tracker_id) { const std::string key = GenerateDirtyIDKey(tracker_id); std::string value; @@ -536,11 +541,12 @@ bool MetadataDatabaseIndexOnDisk::HasDemotedDirtyTracker() const { } bool MetadataDatabaseIndexOnDisk::IsDemotedDirtyTracker( - int64 tracker_id) const { + int64_t tracker_id) const { return DBHasKey(GenerateDemotedDirtyIDKey(tracker_id)); } -void MetadataDatabaseIndexOnDisk::PromoteDemotedDirtyTracker(int64 tracker_id) { +void MetadataDatabaseIndexOnDisk::PromoteDemotedDirtyTracker( + int64_t tracker_id) { std::string demoted_key = GenerateDemotedDirtyIDKey(tracker_id); std::string empty; @@ -559,7 +565,7 @@ bool MetadataDatabaseIndexOnDisk::PromoteDemotedDirtyTrackers() { if (!RemovePrefix(itr->key().ToString(), kDemotedDirtyIDKeyPrefix, &id_str)) break; - int64 tracker_id; + int64_t tracker_id; if (!base::StringToInt64(id_str, &tracker_id)) continue; @@ -607,19 +613,19 @@ void MetadataDatabaseIndexOnDisk::SetSyncRootRevalidated() const { } void MetadataDatabaseIndexOnDisk::SetSyncRootTrackerID( - int64 sync_root_id) const { + int64_t sync_root_id) const { service_metadata_->set_sync_root_tracker_id(sync_root_id); PutServiceMetadataToDB(*service_metadata_, db_); } void MetadataDatabaseIndexOnDisk::SetLargestChangeID( - int64 largest_change_id) const { + int64_t largest_change_id) const { service_metadata_->set_largest_change_id(largest_change_id); PutServiceMetadataToDB(*service_metadata_, db_); } void MetadataDatabaseIndexOnDisk::SetNextTrackerID( - int64 next_tracker_id) const { + int64_t next_tracker_id) const { service_metadata_->set_next_tracker_id(next_tracker_id); PutServiceMetadataToDB(*service_metadata_, db_); } @@ -629,19 +635,19 @@ bool MetadataDatabaseIndexOnDisk::IsSyncRootRevalidated() const { service_metadata_->sync_root_revalidated(); } -int64 MetadataDatabaseIndexOnDisk::GetSyncRootTrackerID() const { +int64_t MetadataDatabaseIndexOnDisk::GetSyncRootTrackerID() const { if (!service_metadata_->has_sync_root_tracker_id()) return kInvalidTrackerID; return service_metadata_->sync_root_tracker_id(); } -int64 MetadataDatabaseIndexOnDisk::GetLargestChangeID() const { +int64_t MetadataDatabaseIndexOnDisk::GetLargestChangeID() const { if (!service_metadata_->has_largest_change_id()) return kInvalidTrackerID; return service_metadata_->largest_change_id(); } -int64 MetadataDatabaseIndexOnDisk::GetNextTrackerID() const { +int64_t MetadataDatabaseIndexOnDisk::GetNextTrackerID() const { if (!service_metadata_->has_next_tracker_id()) return kInvalidTrackerID; return service_metadata_->next_tracker_id(); @@ -660,15 +666,15 @@ MetadataDatabaseIndexOnDisk::GetRegisteredAppIDs() const { return result; } -std::vector<int64> MetadataDatabaseIndexOnDisk::GetAllTrackerIDs() const { - std::vector<int64> tracker_ids; +std::vector<int64_t> MetadataDatabaseIndexOnDisk::GetAllTrackerIDs() const { + std::vector<int64_t> tracker_ids; scoped_ptr<LevelDBWrapper::Iterator> itr(db_->NewIterator()); for (itr->Seek(kFileTrackerKeyPrefix); itr->Valid(); itr->Next()) { std::string id_str; if (!RemovePrefix(itr->key().ToString(), kFileTrackerKeyPrefix, &id_str)) break; - int64 tracker_id; + int64_t tracker_id; if (!base::StringToInt64(id_str, &tracker_id)) continue; tracker_ids.push_back(tracker_id); @@ -689,8 +695,8 @@ MetadataDatabaseIndexOnDisk::GetAllMetadataIDs() const { return file_ids; } -int64 MetadataDatabaseIndexOnDisk::BuildTrackerIndexes() { - int64 num_puts_before = db_->num_puts(); +int64_t MetadataDatabaseIndexOnDisk::BuildTrackerIndexes() { + int64_t num_puts_before = db_->num_puts(); scoped_ptr<LevelDBWrapper::Iterator> itr(db_->NewIterator()); for (itr->Seek(kFileTrackerKeyPrefix); itr->Valid(); itr->Next()) { @@ -713,7 +719,7 @@ int64 MetadataDatabaseIndexOnDisk::BuildTrackerIndexes() { return db_->num_puts() - num_puts_before; } -int64 MetadataDatabaseIndexOnDisk::DeleteTrackerIndexes() { +int64_t MetadataDatabaseIndexOnDisk::DeleteTrackerIndexes() { const char* kIndexPrefixes[] = { kAppRootIDByAppIDKeyPrefix, kActiveTrackerIDByFileIDKeyPrefix, kTrackerIDByFileIDKeyPrefix, kMultiTrackerByFileIDKeyPrefix, @@ -722,7 +728,7 @@ int64 MetadataDatabaseIndexOnDisk::DeleteTrackerIndexes() { kDirtyIDKeyPrefix, kDemotedDirtyIDKeyPrefix }; - int64 num_deletes_before = db_->num_deletes(); + int64_t num_deletes_before = db_->num_deletes(); for (size_t i = 0; i < arraysize(kIndexPrefixes); ++i) DeleteKeyStartsWith(kIndexPrefixes[i]); num_dirty_trackers_ = 0; @@ -741,15 +747,15 @@ MetadataDatabaseIndexOnDisk::MetadataDatabaseIndexOnDisk(LevelDBWrapper* db) service_metadata_ = InitializeServiceMetadata(db_); // Check if index is valid, if no validations run in 7 days. - const int64 kThresholdToValidateInDays = 7; + const int64_t kThresholdToValidateInDays = 7; - int64 last_check_time = 0; + int64_t last_check_time = 0; std::string value; if (db_->Get(kLastValidationTimeKey, &value).ok()) base::StringToInt64(value, &last_check_time); base::TimeDelta since_last_check = base::Time::Now() - base::Time::FromInternalValue(last_check_time); - int64 since_last_check_in_days = since_last_check.InDays(); + int64_t since_last_check_in_days = since_last_check.InDays(); if (since_last_check_in_days >= kThresholdToValidateInDays || since_last_check_in_days < 0) { // TODO(peria): Add UMA to check if the number of deleted entries and the @@ -877,7 +883,7 @@ void MetadataDatabaseIndexOnDisk::RemoveFromFileIDIndexes( void MetadataDatabaseIndexOnDisk::AddToPathIndexes( const FileTracker& new_tracker) { - int64 parent_id = new_tracker.parent_tracker_id(); + int64_t parent_id = new_tracker.parent_tracker_id(); std::string title = GetTrackerTitle(new_tracker); DVLOG(1) << " Add to trackers by parent and title: " @@ -892,7 +898,7 @@ void MetadataDatabaseIndexOnDisk::AddToPathIndexes( if (!RemovePrefix(itr->key().ToString(), prefix, &id_str)) break; - int64 tracker_id; + int64_t tracker_id; if (!base::StringToInt64(id_str, &tracker_id)) continue; if (tracker_id == new_tracker.tracker_id()) { @@ -922,8 +928,8 @@ void MetadataDatabaseIndexOnDisk::UpdateInPathIndexes( DCHECK(GetTrackerTitle(old_tracker) == GetTrackerTitle(new_tracker) || !old_tracker.has_synced_details()); - int64 tracker_id = new_tracker.tracker_id(); - int64 parent_id = new_tracker.parent_tracker_id(); + int64_t tracker_id = new_tracker.tracker_id(); + int64_t parent_id = new_tracker.parent_tracker_id(); const std::string old_title = GetTrackerTitle(old_tracker); const std::string title = GetTrackerTitle(new_tracker); @@ -980,8 +986,8 @@ void MetadataDatabaseIndexOnDisk::UpdateInPathIndexes( void MetadataDatabaseIndexOnDisk::RemoveFromPathIndexes( const FileTracker& tracker) { - int64 tracker_id = tracker.tracker_id(); - int64 parent_id = tracker.parent_tracker_id(); + int64_t tracker_id = tracker.tracker_id(); + int64_t parent_id = tracker.parent_tracker_id(); std::string title = GetTrackerTitle(tracker); DVLOG(1) << " Remove from trackers by parent and title: " @@ -1023,7 +1029,7 @@ void MetadataDatabaseIndexOnDisk::UpdateInDirtyTrackerIndexes( const FileTracker& new_tracker) { DCHECK_EQ(old_tracker.tracker_id(), new_tracker.tracker_id()); - int64 tracker_id = new_tracker.tracker_id(); + int64_t tracker_id = new_tracker.tracker_id(); const std::string dirty_key = GenerateDirtyIDKey(tracker_id); const std::string demoted_key = GenerateDemotedDirtyIDKey(tracker_id); if (old_tracker.dirty() && !new_tracker.dirty()) { @@ -1049,7 +1055,7 @@ void MetadataDatabaseIndexOnDisk::UpdateInDirtyTrackerIndexes( void MetadataDatabaseIndexOnDisk::RemoveFromDirtyTrackerIndexes( const FileTracker& tracker) { if (tracker.dirty()) { - int64 tracker_id = tracker.tracker_id(); + int64_t tracker_id = tracker.tracker_id(); const std::string dirty_key = GenerateDirtyIDKey(tracker_id); const std::string demoted_key = GenerateDemotedDirtyIDKey(tracker_id); DCHECK(DBHasKey(dirty_key) || DBHasKey(demoted_key)); @@ -1075,7 +1081,7 @@ TrackerIDSet MetadataDatabaseIndexOnDisk::GetTrackerIDSetByPrefix( if (!RemovePrefix(key, ids_prefix, &id_str)) break; - int64 tracker_id; + int64_t tracker_id; if (!base::StringToInt64(id_str, &tracker_id)) continue; trackers.InsertInactiveTracker(tracker_id); @@ -1084,7 +1090,7 @@ TrackerIDSet MetadataDatabaseIndexOnDisk::GetTrackerIDSetByPrefix( // Set an active tracker ID, if available. std::string value; leveldb::Status status = db_->Get(active_tracker_key, &value); - int64 active_tracker; + int64_t active_tracker; if (status.ok() && base::StringToInt64(value, &active_tracker)) { DCHECK_NE(kInvalidTrackerID, active_tracker); trackers.Activate(active_tracker); @@ -1105,8 +1111,9 @@ void MetadataDatabaseIndexOnDisk::AddToTrackerIDSetWithPrefix( } bool MetadataDatabaseIndexOnDisk::EraseInTrackerIDSetWithPrefix( - const std::string& active_tracker_key, const std::string& key_prefix, - int64 tracker_id) { + const std::string& active_tracker_key, + const std::string& key_prefix, + int64_t tracker_id) { std::string value; const std::string del_key = key_prefix + base::Int64ToString(tracker_id); leveldb::Status status = db_->Get(del_key, &value); @@ -1116,7 +1123,7 @@ bool MetadataDatabaseIndexOnDisk::EraseInTrackerIDSetWithPrefix( db_->Delete(del_key); status = db_->Get(active_tracker_key, &value); - int64 active_tracker_id; + int64_t active_tracker_id; if (status.ok() && base::StringToInt64(value, &active_tracker_id) && active_tracker_id == tracker_id) { db_->Delete(active_tracker_key); @@ -1126,13 +1133,14 @@ bool MetadataDatabaseIndexOnDisk::EraseInTrackerIDSetWithPrefix( } void MetadataDatabaseIndexOnDisk::ActivateInTrackerIDSetWithPrefix( - const std::string& active_tracker_key, const std::string& key_prefix, - int64 tracker_id) { + const std::string& active_tracker_key, + const std::string& key_prefix, + int64_t tracker_id) { DCHECK(DBHasKey(key_prefix + base::Int64ToString(tracker_id))); std::string value; leveldb::Status status = db_->Get(active_tracker_key, &value); - int64 active_tracker_id = kInvalidTrackerID; + int64_t active_tracker_id = kInvalidTrackerID; if (status.IsNotFound() || (status.ok() && base::StringToInt64(value, &active_tracker_id))) { DCHECK(active_tracker_id != tracker_id); @@ -1141,13 +1149,14 @@ void MetadataDatabaseIndexOnDisk::ActivateInTrackerIDSetWithPrefix( } void MetadataDatabaseIndexOnDisk::DeactivateInTrackerIDSetWithPrefix( - const std::string& active_tracker_key, const std::string& key_prefix, - int64 tracker_id) { + const std::string& active_tracker_key, + const std::string& key_prefix, + int64_t tracker_id) { DCHECK(DBHasKey(key_prefix + base::Int64ToString(tracker_id))); std::string value; leveldb::Status status = db_->Get(active_tracker_key, &value); - int64 active_tracker_id; + int64_t active_tracker_id; if (status.ok() && base::StringToInt64(value, &active_tracker_id)) { DCHECK(active_tracker_id == tracker_id); db_->Delete(active_tracker_key); @@ -1175,8 +1184,8 @@ size_t MetadataDatabaseIndexOnDisk::CountDirtyTrackerInternal() const { } MetadataDatabaseIndexOnDisk::NumEntries -MetadataDatabaseIndexOnDisk::CountWithPrefix( - const std::string& prefix, int64 ignored_id) { +MetadataDatabaseIndexOnDisk::CountWithPrefix(const std::string& prefix, + int64_t ignored_id) { const std::string ignored = base::Int64ToString(ignored_id); size_t count = 0; diff --git a/chrome/browser/sync_file_system/drive_backend/metadata_database_index_on_disk.h b/chrome/browser/sync_file_system/drive_backend/metadata_database_index_on_disk.h index 5e50572..c06adb9 100644 --- a/chrome/browser/sync_file_system/drive_backend/metadata_database_index_on_disk.h +++ b/chrome/browser/sync_file_system/drive_backend/metadata_database_index_on_disk.h @@ -5,11 +5,15 @@ #ifndef CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_METADATA_DATABASE_INDEX_ON_DISK_H_ #define CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_METADATA_DATABASE_INDEX_ON_DISK_H_ +#include <stddef.h> +#include <stdint.h> + #include <map> #include <set> #include <string> #include <vector> +#include "base/macros.h" #include "chrome/browser/sync_file_system/drive_backend/metadata_database_index_interface.h" #include "chrome/browser/sync_file_system/drive_backend/tracker_id_set.h" @@ -36,49 +40,49 @@ class MetadataDatabaseIndexOnDisk : public MetadataDatabaseIndexInterface { void RemoveUnreachableItems() override; bool GetFileMetadata(const std::string& file_id, FileMetadata* metadata) const override; - bool GetFileTracker(int64 tracker_id, FileTracker* tracker) const override; + bool GetFileTracker(int64_t tracker_id, FileTracker* tracker) const override; void StoreFileMetadata(scoped_ptr<FileMetadata> metadata) override; void StoreFileTracker(scoped_ptr<FileTracker> tracker) override; void RemoveFileMetadata(const std::string& file_id) override; - void RemoveFileTracker(int64 tracker_id) override; + void RemoveFileTracker(int64_t tracker_id) override; TrackerIDSet GetFileTrackerIDsByFileID( const std::string& file_id) const override; - int64 GetAppRootTracker(const std::string& app_id) const override; + int64_t GetAppRootTracker(const std::string& app_id) const override; TrackerIDSet GetFileTrackerIDsByParentAndTitle( - int64 parent_tracker_id, + int64_t parent_tracker_id, const std::string& title) const override; - std::vector<int64> GetFileTrackerIDsByParent( - int64 parent_tracker_id) const override; + std::vector<int64_t> GetFileTrackerIDsByParent( + int64_t parent_tracker_id) const override; std::string PickMultiTrackerFileID() const override; ParentIDAndTitle PickMultiBackingFilePath() const override; - int64 PickDirtyTracker() const override; - void DemoteDirtyTracker(int64 tracker_id) override; + int64_t PickDirtyTracker() const override; + void DemoteDirtyTracker(int64_t tracker_id) override; bool HasDemotedDirtyTracker() const override; - bool IsDemotedDirtyTracker(int64 tracker_id) const override; - void PromoteDemotedDirtyTracker(int64 tracker_id) override; + bool IsDemotedDirtyTracker(int64_t tracker_id) const override; + void PromoteDemotedDirtyTracker(int64_t tracker_id) override; bool PromoteDemotedDirtyTrackers() override; size_t CountDirtyTracker() const override; size_t CountFileMetadata() const override; size_t CountFileTracker() const override; void SetSyncRootRevalidated() const override; - void SetSyncRootTrackerID(int64 sync_root_id) const override; - void SetLargestChangeID(int64 largest_change_id) const override; - void SetNextTrackerID(int64 next_tracker_id) const override; + void SetSyncRootTrackerID(int64_t sync_root_id) const override; + void SetLargestChangeID(int64_t largest_change_id) const override; + void SetNextTrackerID(int64_t next_tracker_id) const override; bool IsSyncRootRevalidated() const override; - int64 GetSyncRootTrackerID() const override; - int64 GetLargestChangeID() const override; - int64 GetNextTrackerID() const override; + int64_t GetSyncRootTrackerID() const override; + int64_t GetLargestChangeID() const override; + int64_t GetNextTrackerID() const override; std::vector<std::string> GetRegisteredAppIDs() const override; - std::vector<int64> GetAllTrackerIDs() const override; + std::vector<int64_t> GetAllTrackerIDs() const override; std::vector<std::string> GetAllMetadataIDs() const override; // Builds on-disk indexes from FileTracker entries on disk. // Returns the number of newly added entries for indexing. - int64 BuildTrackerIndexes(); + int64_t BuildTrackerIndexes(); // Deletes entries used for indexes on on-disk database. // Returns the number of the deleted entries. - int64 DeleteTrackerIndexes(); + int64_t DeleteTrackerIndexes(); LevelDBWrapper* GetDBForTesting(); @@ -133,24 +137,21 @@ class MetadataDatabaseIndexOnDisk : public MetadataDatabaseIndexInterface { // Returns true if |tracker_id| is removed successfully. If no other entries // are stored with |key_prefix|, the entry for |active_key| is also removed. - bool EraseInTrackerIDSetWithPrefix( - const std::string& active_tracker_key, - const std::string& key_prefix, - int64 tracker_id); + bool EraseInTrackerIDSetWithPrefix(const std::string& active_tracker_key, + const std::string& key_prefix, + int64_t tracker_id); // Adds an entry for |active_key| on DB, if |tracker_id| has an entry with // |key_prefix|. - void ActivateInTrackerIDSetWithPrefix( - const std::string& active_tracker_key, - const std::string& key_prefix, - int64 tracker_id); + void ActivateInTrackerIDSetWithPrefix(const std::string& active_tracker_key, + const std::string& key_prefix, + int64_t tracker_id); // Removes an entry for |active_key| on DB, if the value of |active_key| key // is |tracker_id|. - void DeactivateInTrackerIDSetWithPrefix( - const std::string& active_tracker_key, - const std::string& key_prefix, - int64 tracker_id); + void DeactivateInTrackerIDSetWithPrefix(const std::string& active_tracker_key, + const std::string& key_prefix, + int64_t tracker_id); // Checks if |db_| has an entry whose key is |key|. bool DBHasKey(const std::string& key) const; @@ -160,7 +161,7 @@ class MetadataDatabaseIndexOnDisk : public MetadataDatabaseIndexInterface { // Returns the number of entries starting with |prefix| in NumEntries format. // Entries for |ignored_id| are not counted in. - NumEntries CountWithPrefix(const std::string& prefix, int64 ignored_id); + NumEntries CountWithPrefix(const std::string& prefix, int64_t ignored_id); // Deletes entries whose keys start from |prefix|. void DeleteKeyStartsWith(const std::string& prefix); diff --git a/chrome/browser/sync_file_system/drive_backend/metadata_database_index_on_disk_unittest.cc b/chrome/browser/sync_file_system/drive_backend/metadata_database_index_on_disk_unittest.cc index 1ec85c5..55442a0 100644 --- a/chrome/browser/sync_file_system/drive_backend/metadata_database_index_on_disk_unittest.cc +++ b/chrome/browser/sync_file_system/drive_backend/metadata_database_index_on_disk_unittest.cc @@ -4,6 +4,8 @@ #include "chrome/browser/sync_file_system/drive_backend/metadata_database_index_on_disk.h" +#include <stdint.h> + #include <algorithm> #include "base/files/scoped_temp_dir.h" @@ -24,10 +26,10 @@ namespace drive_backend { namespace { -const int64 kSyncRootTrackerID = 1; -const int64 kAppRootTrackerID = 2; -const int64 kFileTrackerID = 3; -const int64 kPlaceholderTrackerID = 4; +const int64_t kSyncRootTrackerID = 1; +const int64_t kAppRootTrackerID = 2; +const int64_t kFileTrackerID = 3; +const int64_t kPlaceholderTrackerID = 4; } // namespace @@ -154,7 +156,7 @@ TEST_F(MetadataDatabaseIndexOnDiskTest, GetEntryTest) { TEST_F(MetadataDatabaseIndexOnDiskTest, SetEntryTest) { CreateTestDatabase(false, nullptr); - const int64 tracker_id = 10; + const int64_t tracker_id = 10; scoped_ptr<FileMetadata> metadata = test_util::CreateFileMetadata("test_file_id", "test_title", "test_md5"); FileTracker root_tracker; @@ -230,7 +232,7 @@ TEST_F(MetadataDatabaseIndexOnDiskTest, SyncRootInvalidation) { CreateTestDatabase(true, nullptr); EXPECT_NE(kInvalidTrackerID, index()->GetAppRootTracker("app_id")); - const int64 kNewSyncRootTrackerID = 10; + const int64_t kNewSyncRootTrackerID = 10; scoped_ptr<FileMetadata> new_sync_root_metadata = test_util::CreateFolderMetadata("new_sync_root_folder_id", kSyncRootFolderTitle); @@ -280,7 +282,7 @@ TEST_F(MetadataDatabaseIndexOnDiskTest, BuildIndexTest) { TEST_F(MetadataDatabaseIndexOnDiskTest, BuildAndDeleteIndexTest) { CreateTestDatabase(false, nullptr); - int64 answer = index()->BuildTrackerIndexes(); + int64_t answer = index()->BuildTrackerIndexes(); WriteToDB(); ASSERT_EQ(16, answer); EXPECT_EQ(answer, index()->DeleteTrackerIndexes()); @@ -301,7 +303,7 @@ TEST_F(MetadataDatabaseIndexOnDiskTest, AllEntriesTest) { EXPECT_EQ("sync_root_folder_id", file_ids[2]); EXPECT_EQ(4U, index()->CountFileTracker()); - std::vector<int64> tracker_ids = index()->GetAllTrackerIDs(); + std::vector<int64_t> tracker_ids = index()->GetAllTrackerIDs(); ASSERT_EQ(4U, tracker_ids.size()); std::sort(tracker_ids.begin(), tracker_ids.end()); EXPECT_EQ(kSyncRootTrackerID, tracker_ids[0]); @@ -320,7 +322,7 @@ TEST_F(MetadataDatabaseIndexOnDiskTest, IndexAppRootIDByAppIDTest) { EXPECT_EQ(kInvalidTrackerID, index()->GetAppRootTracker("")); EXPECT_EQ(kAppRootTrackerID, index()->GetAppRootTracker("app_id")); - const int64 kAppRootTrackerID2 = 12; + const int64_t kAppRootTrackerID2 = 12; FileTracker sync_root_tracker; index()->GetFileTracker(kSyncRootTrackerID, &sync_root_tracker); scoped_ptr<FileMetadata> app_root_metadata = @@ -383,7 +385,7 @@ TEST_F(MetadataDatabaseIndexOnDiskTest, TrackerIDSetByFileIDTest) { EXPECT_EQ(1U, tracker_ids.size()); EXPECT_EQ(kFileTrackerID, tracker_ids.active_tracker()); - const int64 tracker_id = 21; + const int64_t tracker_id = 21; // Testing AddToFileIDIndexes scoped_ptr<FileTracker> file_tracker = test_util::CreateTracker(metadata, tracker_id, &app_root_tracker); @@ -452,7 +454,7 @@ TEST_F(MetadataDatabaseIndexOnDiskTest, TrackerIDSetByParentIDAndTitleTest) { kAppRootTrackerID, "file2"); EXPECT_TRUE(tracker_ids.empty()); - const int64 tracker_id = 72; + const int64_t tracker_id = 72; // Testing AddToFileIDIndexes scoped_ptr<FileTracker> file_tracker = test_util::CreateTracker(metadata, tracker_id, &app_root_tracker); @@ -515,8 +517,8 @@ TEST_F(MetadataDatabaseIndexOnDiskTest, TrackerIDSetByParentIDAndTitleTest_EmptyTitle) { CreateTestDatabase(true, nullptr); - const int64 kFolderTrackerID = 23; - const int64 kNewFileTrackerID = 42; + const int64_t kFolderTrackerID = 23; + const int64_t kNewFileTrackerID = 42; { FileTracker app_root_tracker; EXPECT_TRUE(index()->GetFileTracker(kAppRootTrackerID, &app_root_tracker)); @@ -575,8 +577,8 @@ TEST_F(MetadataDatabaseIndexOnDiskTest, TrackerIDSetDetailsTest) { FileTracker app_root; EXPECT_TRUE(index()->GetFileTracker(kAppRootTrackerID, &app_root)); - const int64 kFileTrackerID2 = 123; - const int64 kFileTrackerID3 = 124; + const int64_t kFileTrackerID2 = 123; + const int64_t kFileTrackerID3 = 124; scoped_ptr<FileMetadata> file_metadata = test_util::CreateFileMetadata("file_id2", "file_2", "file_md5_2"); scoped_ptr<FileTracker> file_tracker = @@ -619,7 +621,7 @@ TEST_F(MetadataDatabaseIndexOnDiskTest, DirtyTrackersTest) { EXPECT_TRUE(index()->HasDemotedDirtyTracker()); EXPECT_EQ(0U, index()->CountDirtyTracker()); - const int64 tracker_id = 13; + const int64_t tracker_id = 13; scoped_ptr<FileTracker> app_root_tracker(new FileTracker); index()->GetFileTracker(kAppRootTrackerID, app_root_tracker.get()); diff --git a/chrome/browser/sync_file_system/drive_backend/metadata_database_index_unittest.cc b/chrome/browser/sync_file_system/drive_backend/metadata_database_index_unittest.cc index 482c0dd..dc0e596 100644 --- a/chrome/browser/sync_file_system/drive_backend/metadata_database_index_unittest.cc +++ b/chrome/browser/sync_file_system/drive_backend/metadata_database_index_unittest.cc @@ -4,6 +4,8 @@ #include "chrome/browser/sync_file_system/drive_backend/metadata_database_index.h" +#include <stdint.h> + #include "chrome/browser/sync_file_system/drive_backend/drive_backend_constants.h" #include "chrome/browser/sync_file_system/drive_backend/drive_backend_test_util.h" #include "chrome/browser/sync_file_system/drive_backend/leveldb_wrapper.h" @@ -19,10 +21,10 @@ namespace drive_backend { namespace { -const int64 kSyncRootTrackerID = 1; -const int64 kAppRootTrackerID = 2; -const int64 kFileTrackerID = 3; -const int64 kPlaceholderTrackerID = 4; +const int64_t kSyncRootTrackerID = 1; +const int64_t kAppRootTrackerID = 2; +const int64_t kFileTrackerID = 3; +const int64_t kPlaceholderTrackerID = 4; scoped_ptr<DatabaseContents> CreateTestDatabaseContents() { scoped_ptr<DatabaseContents> contents(new DatabaseContents); @@ -117,7 +119,7 @@ TEST_F(MetadataDatabaseIndexTest, IndexLookUpTest) { EXPECT_TRUE(trackers.has_active()); EXPECT_EQ(kFileTrackerID, trackers.active_tracker()); - int64 app_root_tracker_id = index()->GetAppRootTracker("app_id"); + int64_t app_root_tracker_id = index()->GetAppRootTracker("app_id"); EXPECT_EQ(kAppRootTrackerID, app_root_tracker_id); trackers = index()->GetFileTrackerIDsByParentAndTitle( @@ -145,7 +147,7 @@ TEST_F(MetadataDatabaseIndexTest, UpdateTest) { FileTracker app_root_tracker; ASSERT_TRUE(index()->GetFileTracker(kAppRootTrackerID, &app_root_tracker)); - int64 new_tracker_id = 100; + int64_t new_tracker_id = 100; scoped_ptr<FileTracker> new_tracker = test_util::CreateTracker(metadata, new_tracker_id, &app_root_tracker); new_tracker->set_active(false); diff --git a/chrome/browser/sync_file_system/drive_backend/metadata_database_unittest.cc b/chrome/browser/sync_file_system/drive_backend/metadata_database_unittest.cc index 90f43f5..cd7af78 100644 --- a/chrome/browser/sync_file_system/drive_backend/metadata_database_unittest.cc +++ b/chrome/browser/sync_file_system/drive_backend/metadata_database_unittest.cc @@ -4,8 +4,11 @@ #include "chrome/browser/sync_file_system/drive_backend/metadata_database.h" +#include <stdint.h> + #include "base/bind.h" #include "base/files/scoped_temp_dir.h" +#include "base/macros.h" #include "base/message_loop/message_loop.h" #include "base/strings/string_number_conversions.h" #include "base/thread_task_runner_handle.h" @@ -34,8 +37,8 @@ namespace { typedef MetadataDatabase::FileIDList FileIDList; -const int64 kInitialChangeID = 1234; -const int64 kSyncRootTrackerID = 100; +const int64_t kInitialChangeID = 1234; +const int64_t kSyncRootTrackerID = 100; const char kSyncRootFolderID[] = "sync_root_folder_id"; // This struct is used to setup initial state of the database in the test and @@ -82,7 +85,7 @@ void ExpectEquivalent(const FileTracker* left, const FileTracker* right) { test_util::ExpectEquivalentTrackers(*left, *right); } -void ExpectEquivalent(int64 left, int64 right) { +void ExpectEquivalent(int64_t left, int64_t right) { EXPECT_EQ(left, right); } @@ -192,7 +195,7 @@ class MetadataDatabaseTest : public testing::TestWithParam<bool> { return "file_id_" + base::Int64ToString(next_file_id_number_++); } - int64 GetTrackerIDByFileID(const std::string& file_id) { + int64_t GetTrackerIDByFileID(const std::string& file_id) { TrackerIDSet trackers; if (metadata_database_->FindTrackersByFileID(file_id, &trackers)) { EXPECT_FALSE(trackers.empty()); @@ -587,7 +590,7 @@ class MetadataDatabaseTest : public testing::TestWithParam<bool> { } SyncStatusCode PopulateInitialData( - int64 largest_change_id, + int64_t largest_change_id, const google_apis::FileResource& sync_root_folder, const ScopedVector<google_apis::FileResource>& app_root_folders) { return metadata_database_->PopulateInitialData( @@ -598,9 +601,7 @@ class MetadataDatabaseTest : public testing::TestWithParam<bool> { tracker->set_tracker_id(GetTrackerIDByFileID(tracker->file_id())); } - int64 current_change_id() const { - return current_change_id_; - } + int64_t current_change_id() const { return current_change_id_; } private: base::ScopedTempDir database_dir_; @@ -609,10 +610,10 @@ class MetadataDatabaseTest : public testing::TestWithParam<bool> { scoped_ptr<leveldb::Env> in_memory_env_; scoped_ptr<MetadataDatabase> metadata_database_; - int64 current_change_id_; - int64 next_tracker_id_; - int64 next_file_id_number_; - int64 next_md5_sequence_number_; + int64_t current_change_id_; + int64_t next_tracker_id_; + int64_t next_file_id_number_; + int64_t next_md5_sequence_number_; DISALLOW_COPY_AND_ASSIGN(MetadataDatabaseTest); }; diff --git a/chrome/browser/sync_file_system/drive_backend/register_app_task.cc b/chrome/browser/sync_file_system/drive_backend/register_app_task.cc index cc2249b..594df14 100644 --- a/chrome/browser/sync_file_system/drive_backend/register_app_task.cc +++ b/chrome/browser/sync_file_system/drive_backend/register_app_task.cc @@ -4,6 +4,8 @@ #include "chrome/browser/sync_file_system/drive_backend/register_app_task.h" +#include <stdint.h> + #include "base/bind.h" #include "base/location.h" #include "chrome/browser/sync_file_system/drive_backend/drive_backend_constants.h" @@ -57,7 +59,7 @@ void RegisterAppTask::RunExclusive(const SyncStatusCallback& callback) { return; } - int64 sync_root = metadata_database()->GetSyncRootTrackerID(); + int64_t sync_root = metadata_database()->GetSyncRootTrackerID(); TrackerIDSet trackers; if (!metadata_database()->FindTrackersByParentAndTitle( sync_root, app_id_, &trackers)) { @@ -82,7 +84,7 @@ void RegisterAppTask::RunExclusive(const SyncStatusCallback& callback) { } void RegisterAppTask::CreateAppRootFolder(const SyncStatusCallback& callback) { - int64 sync_root_tracker_id = metadata_database()->GetSyncRootTrackerID(); + int64_t sync_root_tracker_id = metadata_database()->GetSyncRootTrackerID(); FileTracker sync_root_tracker; bool should_success = metadata_database()->FindTrackerByTrackerID( sync_root_tracker_id, diff --git a/chrome/browser/sync_file_system/drive_backend/register_app_task.h b/chrome/browser/sync_file_system/drive_backend/register_app_task.h index dda99c6..d6b7e94 100644 --- a/chrome/browser/sync_file_system/drive_backend/register_app_task.h +++ b/chrome/browser/sync_file_system/drive_backend/register_app_task.h @@ -7,6 +7,7 @@ #include <string> +#include "base/macros.h" #include "base/memory/scoped_ptr.h" #include "base/memory/weak_ptr.h" #include "chrome/browser/sync_file_system/drive_backend/sync_task.h" diff --git a/chrome/browser/sync_file_system/drive_backend/register_app_task_unittest.cc b/chrome/browser/sync_file_system/drive_backend/register_app_task_unittest.cc index 6145984..c6efe8d 100644 --- a/chrome/browser/sync_file_system/drive_backend/register_app_task_unittest.cc +++ b/chrome/browser/sync_file_system/drive_backend/register_app_task_unittest.cc @@ -4,10 +4,14 @@ #include "chrome/browser/sync_file_system/drive_backend/register_app_task.h" +#include <stddef.h> +#include <stdint.h> + #include <vector> #include "base/files/scoped_temp_dir.h" #include "base/format_macros.h" +#include "base/macros.h" #include "base/run_loop.h" #include "base/strings/string_number_conversions.h" #include "base/strings/stringprintf.h" @@ -33,7 +37,7 @@ namespace sync_file_system { namespace drive_backend { namespace { -const int64 kSyncRootTrackerID = 100; +const int64_t kSyncRootTrackerID = 100; } // namespace class RegisterAppTaskTest : public testing::Test { @@ -261,8 +265,8 @@ class RegisterAppTaskTest : public testing::Test { std::string sync_root_folder_id_; - int64 next_file_id_; - int64 next_tracker_id_; + int64_t next_file_id_; + int64_t next_tracker_id_; content::TestBrowserThreadBundle browser_threads_; base::ScopedTempDir database_dir_; diff --git a/chrome/browser/sync_file_system/drive_backend/remote_change_processor_on_worker.h b/chrome/browser/sync_file_system/drive_backend/remote_change_processor_on_worker.h index 2e68c09..78e5d4f 100644 --- a/chrome/browser/sync_file_system/drive_backend/remote_change_processor_on_worker.h +++ b/chrome/browser/sync_file_system/drive_backend/remote_change_processor_on_worker.h @@ -5,6 +5,7 @@ #ifndef CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_REMOTE_CHANGE_PROCESSOR_ON_WORKER_H_ #define CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_REMOTE_CHANGE_PROCESSOR_ON_WORKER_H_ +#include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/memory/weak_ptr.h" #include "base/sequence_checker.h" diff --git a/chrome/browser/sync_file_system/drive_backend/remote_change_processor_wrapper.h b/chrome/browser/sync_file_system/drive_backend/remote_change_processor_wrapper.h index 714dfba..bf277cc 100644 --- a/chrome/browser/sync_file_system/drive_backend/remote_change_processor_wrapper.h +++ b/chrome/browser/sync_file_system/drive_backend/remote_change_processor_wrapper.h @@ -5,6 +5,7 @@ #ifndef CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_REMOTE_CHANGE_PROCESSOR_WRAPPER_H_ #define CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_REMOTE_CHANGE_PROCESSOR_WRAPPER_H_ +#include "base/macros.h" #include "base/memory/weak_ptr.h" #include "base/sequence_checker.h" #include "chrome/browser/sync_file_system/remote_change_processor.h" diff --git a/chrome/browser/sync_file_system/drive_backend/remote_to_local_syncer.h b/chrome/browser/sync_file_system/drive_backend/remote_to_local_syncer.h index 5609c17..0e5332d 100644 --- a/chrome/browser/sync_file_system/drive_backend/remote_to_local_syncer.h +++ b/chrome/browser/sync_file_system/drive_backend/remote_to_local_syncer.h @@ -8,6 +8,7 @@ #include <string> #include <vector> +#include "base/macros.h" #include "base/memory/weak_ptr.h" #include "chrome/browser/sync_file_system/drive_backend/metadata_database.pb.h" #include "chrome/browser/sync_file_system/drive_backend/sync_task.h" diff --git a/chrome/browser/sync_file_system/drive_backend/remote_to_local_syncer_unittest.cc b/chrome/browser/sync_file_system/drive_backend/remote_to_local_syncer_unittest.cc index 3cd033e0..4d1d0da 100644 --- a/chrome/browser/sync_file_system/drive_backend/remote_to_local_syncer_unittest.cc +++ b/chrome/browser/sync_file_system/drive_backend/remote_to_local_syncer_unittest.cc @@ -10,6 +10,7 @@ #include "base/callback.h" #include "base/files/scoped_temp_dir.h" #include "base/logging.h" +#include "base/macros.h" #include "base/run_loop.h" #include "base/thread_task_runner_handle.h" #include "chrome/browser/sync_file_system/drive_backend/drive_backend_constants.h" diff --git a/chrome/browser/sync_file_system/drive_backend/sync_engine.cc b/chrome/browser/sync_file_system/drive_backend/sync_engine.cc index 6fbd594..0e496cd 100644 --- a/chrome/browser/sync_file_system/drive_backend/sync_engine.cc +++ b/chrome/browser/sync_file_system/drive_backend/sync_engine.cc @@ -7,6 +7,7 @@ #include <vector> #include "base/bind.h" +#include "base/macros.h" #include "base/metrics/histogram.h" #include "base/thread_task_runner_handle.h" #include "base/threading/sequenced_worker_pool.h" diff --git a/chrome/browser/sync_file_system/drive_backend/sync_engine.h b/chrome/browser/sync_file_system/drive_backend/sync_engine.h index 720993e..0d9a874 100644 --- a/chrome/browser/sync_file_system/drive_backend/sync_engine.h +++ b/chrome/browser/sync_file_system/drive_backend/sync_engine.h @@ -8,6 +8,7 @@ #include <set> #include <string> +#include "base/macros.h" #include "base/memory/scoped_ptr.h" #include "base/memory/weak_ptr.h" #include "base/observer_list.h" diff --git a/chrome/browser/sync_file_system/drive_backend/sync_engine_context.cc b/chrome/browser/sync_file_system/drive_backend/sync_engine_context.cc index 16f2c01..e26a0eb 100644 --- a/chrome/browser/sync_file_system/drive_backend/sync_engine_context.cc +++ b/chrome/browser/sync_file_system/drive_backend/sync_engine_context.cc @@ -4,7 +4,6 @@ #include "chrome/browser/sync_file_system/drive_backend/sync_engine_context.h" -#include "base/basictypes.h" #include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" #include "base/sequenced_task_runner.h" diff --git a/chrome/browser/sync_file_system/drive_backend/sync_engine_context.h b/chrome/browser/sync_file_system/drive_backend/sync_engine_context.h index 8aaaf15..982ea36 100644 --- a/chrome/browser/sync_file_system/drive_backend/sync_engine_context.h +++ b/chrome/browser/sync_file_system/drive_backend/sync_engine_context.h @@ -5,7 +5,7 @@ #ifndef CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_SYNC_ENGINE_CONTEXT_H_ #define CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_SYNC_ENGINE_CONTEXT_H_ -#include "base/basictypes.h" +#include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" #include "base/memory/weak_ptr.h" diff --git a/chrome/browser/sync_file_system/drive_backend/sync_engine_initializer.cc b/chrome/browser/sync_file_system/drive_backend/sync_engine_initializer.cc index 5680e35..26dfd07 100644 --- a/chrome/browser/sync_file_system/drive_backend/sync_engine_initializer.cc +++ b/chrome/browser/sync_file_system/drive_backend/sync_engine_initializer.cc @@ -4,6 +4,8 @@ #include "chrome/browser/sync_file_system/drive_backend/sync_engine_initializer.h" +#include <stddef.h> + #include "base/bind.h" #include "base/callback.h" #include "base/logging.h" diff --git a/chrome/browser/sync_file_system/drive_backend/sync_engine_initializer.h b/chrome/browser/sync_file_system/drive_backend/sync_engine_initializer.h index ee7df71..d540690 100644 --- a/chrome/browser/sync_file_system/drive_backend/sync_engine_initializer.h +++ b/chrome/browser/sync_file_system/drive_backend/sync_engine_initializer.h @@ -5,8 +5,11 @@ #ifndef CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_SYNC_ENGINE_INITIALIZER_H_ #define CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_SYNC_ENGINE_INITIALIZER_H_ +#include <stdint.h> + #include <string> +#include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" #include "base/memory/scoped_vector.h" @@ -110,7 +113,7 @@ class SyncEngineInitializer : public SyncTask { scoped_ptr<MetadataDatabase> metadata_database_; ScopedVector<google_apis::FileResource> app_root_folders_; - int64 largest_change_id_; + int64_t largest_change_id_; std::string root_folder_id_; scoped_ptr<google_apis::FileResource> sync_root_folder_; diff --git a/chrome/browser/sync_file_system/drive_backend/sync_engine_initializer_unittest.cc b/chrome/browser/sync_file_system/drive_backend/sync_engine_initializer_unittest.cc index 079dc88..aac13d8 100644 --- a/chrome/browser/sync_file_system/drive_backend/sync_engine_initializer_unittest.cc +++ b/chrome/browser/sync_file_system/drive_backend/sync_engine_initializer_unittest.cc @@ -4,8 +4,12 @@ #include "chrome/browser/sync_file_system/drive_backend/sync_engine_initializer.h" +#include <stddef.h> +#include <stdint.h> + #include "base/bind.h" #include "base/files/scoped_temp_dir.h" +#include "base/macros.h" #include "base/run_loop.h" #include "base/thread_task_runner_handle.h" #include "chrome/browser/sync_file_system/drive_backend/drive_backend_constants.h" @@ -29,7 +33,7 @@ namespace drive_backend { namespace { -const int64 kInitialLargestChangeID = 1234; +const int64_t kInitialLargestChangeID = 1234; } // namespace @@ -163,7 +167,7 @@ class SyncEngineInitializerTest : public testing::Test { } std::string GetSyncRootFolderID() { - int64 sync_root_tracker_id = metadata_database_->GetSyncRootTrackerID(); + int64_t sync_root_tracker_id = metadata_database_->GetSyncRootTrackerID(); FileTracker sync_root_tracker; EXPECT_TRUE(metadata_database_->FindTrackerByTrackerID( sync_root_tracker_id, &sync_root_tracker)); diff --git a/chrome/browser/sync_file_system/drive_backend/sync_engine_unittest.cc b/chrome/browser/sync_file_system/drive_backend/sync_engine_unittest.cc index c2cd8ca..84b47b7 100644 --- a/chrome/browser/sync_file_system/drive_backend/sync_engine_unittest.cc +++ b/chrome/browser/sync_file_system/drive_backend/sync_engine_unittest.cc @@ -4,6 +4,8 @@ #include "chrome/browser/sync_file_system/drive_backend/sync_engine.h" +#include <stddef.h> + #include "base/files/scoped_temp_dir.h" #include "base/macros.h" #include "base/run_loop.h" diff --git a/chrome/browser/sync_file_system/drive_backend/sync_task.h b/chrome/browser/sync_file_system/drive_backend/sync_task.h index d701684..670c214 100644 --- a/chrome/browser/sync_file_system/drive_backend/sync_task.h +++ b/chrome/browser/sync_file_system/drive_backend/sync_task.h @@ -5,6 +5,7 @@ #ifndef CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_SYNC_TASK_H_ #define CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_SYNC_TASK_H_ +#include "base/macros.h" #include "base/memory/scoped_ptr.h" #include "base/memory/weak_ptr.h" #include "chrome/browser/sync_file_system/sync_callbacks.h" diff --git a/chrome/browser/sync_file_system/drive_backend/sync_task_manager.cc b/chrome/browser/sync_file_system/drive_backend/sync_task_manager.cc index 16e1f9b..a576262 100644 --- a/chrome/browser/sync_file_system/drive_backend/sync_task_manager.cc +++ b/chrome/browser/sync_file_system/drive_backend/sync_task_manager.cc @@ -6,6 +6,7 @@ #include "base/bind.h" #include "base/location.h" +#include "base/macros.h" #include "base/memory/scoped_ptr.h" #include "base/sequenced_task_runner.h" #include "chrome/browser/sync_file_system/drive_backend/sync_task.h" @@ -189,7 +190,7 @@ void SyncTaskManager::UpdateTaskBlocker( continuation); } -bool SyncTaskManager::IsRunningTask(int64 token_id) const { +bool SyncTaskManager::IsRunningTask(int64_t token_id) const { DCHECK(sequence_checker_.CalledOnValidSequencedThread()); // If the client is gone, all task should be aborted. diff --git a/chrome/browser/sync_file_system/drive_backend/sync_task_manager.h b/chrome/browser/sync_file_system/drive_backend/sync_task_manager.h index 6be0e7b..688c3d9 100644 --- a/chrome/browser/sync_file_system/drive_backend/sync_task_manager.h +++ b/chrome/browser/sync_file_system/drive_backend/sync_task_manager.h @@ -5,11 +5,15 @@ #ifndef CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_SYNC_TASK_MANAGER_H_ #define CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_SYNC_TASK_MANAGER_H_ +#include <stddef.h> +#include <stdint.h> + #include <queue> #include <vector> #include "base/callback.h" #include "base/containers/scoped_ptr_hash_map.h" +#include "base/macros.h" #include "base/memory/scoped_ptr.h" #include "base/memory/weak_ptr.h" #include "base/sequence_checker.h" @@ -119,7 +123,7 @@ class SyncTaskManager { scoped_ptr<TaskBlocker> task_blocker, const Continuation& continuation); - bool IsRunningTask(int64 task_token_id) const; + bool IsRunningTask(int64_t task_token_id) const; void DetachFromSequence(); bool ShouldTrackTaskToken() const; @@ -128,7 +132,7 @@ class SyncTaskManager { struct PendingTask { base::Closure task; Priority priority; - int64 seq; + int64_t seq; PendingTask(); PendingTask(const base::Closure& task, Priority pri, int seq); @@ -176,7 +180,8 @@ class SyncTaskManager { // Owns running backgrounded SyncTask to cancel the task on SyncTaskManager // deletion. - base::ScopedPtrHashMap<int64, scoped_ptr<SyncTask>> running_background_tasks_; + base::ScopedPtrHashMap<int64_t, scoped_ptr<SyncTask>> + running_background_tasks_; size_t maximum_background_task_; @@ -185,8 +190,8 @@ class SyncTaskManager { std::priority_queue<PendingTask, std::vector<PendingTask>, PendingTaskComparator> pending_tasks_; - int64 pending_task_seq_; - int64 task_token_seq_; + int64_t pending_task_seq_; + int64_t task_token_seq_; // Absence of |token_| implies a task is running. Incoming tasks should // wait for the task to finish in |pending_tasks_| if |token_| is null. diff --git a/chrome/browser/sync_file_system/drive_backend/sync_task_manager_unittest.cc b/chrome/browser/sync_file_system/drive_backend/sync_task_manager_unittest.cc index 9bb3ee0..c7ee44e 100644 --- a/chrome/browser/sync_file_system/drive_backend/sync_task_manager_unittest.cc +++ b/chrome/browser/sync_file_system/drive_backend/sync_task_manager_unittest.cc @@ -2,12 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include <stdint.h> + #include <deque> #include <string> -#include "base/basictypes.h" #include "base/bind.h" #include "base/location.h" +#include "base/macros.h" #include "base/memory/weak_ptr.h" #include "base/message_loop/message_loop.h" #include "base/run_loop.h" @@ -57,7 +59,7 @@ class TaskManagerClient : public SyncTaskManager::Client, public base::SupportsWeakPtr<TaskManagerClient> { public: - explicit TaskManagerClient(int64 maximum_background_task) + explicit TaskManagerClient(int64_t maximum_background_task) : maybe_schedule_next_task_count_(0), task_scheduled_count_(0), idle_task_scheduled_count_(0), @@ -169,9 +171,9 @@ class MultihopSyncTask : public ExclusiveTask { class BackgroundTask : public SyncTask { public: struct Stats { - int64 running_background_task; - int64 finished_task; - int64 max_parallel_task; + int64_t running_background_task; + int64_t finished_task; + int64_t max_parallel_task; Stats() : running_background_task(0), diff --git a/chrome/browser/sync_file_system/drive_backend/sync_task_token.cc b/chrome/browser/sync_file_system/drive_backend/sync_task_token.cc index b4d58bf..32cb4e4 100644 --- a/chrome/browser/sync_file_system/drive_backend/sync_task_token.cc +++ b/chrome/browser/sync_file_system/drive_backend/sync_task_token.cc @@ -13,9 +13,9 @@ namespace sync_file_system { namespace drive_backend { -const int64 SyncTaskToken::kTestingTaskTokenID = -1; -const int64 SyncTaskToken::kForegroundTaskTokenID = 0; -const int64 SyncTaskToken::kMinimumBackgroundTaskTokenID = 1; +const int64_t SyncTaskToken::kTestingTaskTokenID = -1; +const int64_t SyncTaskToken::kForegroundTaskTokenID = 0; +const int64_t SyncTaskToken::kMinimumBackgroundTaskTokenID = 1; // static scoped_ptr<SyncTaskToken> SyncTaskToken::CreateForTesting( @@ -44,7 +44,7 @@ scoped_ptr<SyncTaskToken> SyncTaskToken::CreateForForegroundTask( scoped_ptr<SyncTaskToken> SyncTaskToken::CreateForBackgroundTask( const base::WeakPtr<SyncTaskManager>& manager, base::SequencedTaskRunner* task_runner, - int64 token_id, + int64_t token_id, scoped_ptr<TaskBlocker> task_blocker) { return make_scoped_ptr(new SyncTaskToken( manager, @@ -144,15 +144,14 @@ scoped_ptr<TaskLogger::TaskLog> SyncTaskToken::PassTaskLog() { SyncTaskToken::SyncTaskToken( const base::WeakPtr<SyncTaskManager>& manager, const scoped_refptr<base::SequencedTaskRunner>& task_runner, - int64 token_id, + int64_t token_id, scoped_ptr<TaskBlocker> task_blocker, const SyncStatusCallback& callback) : manager_(manager), task_runner_(task_runner), token_id_(token_id), callback_(callback), - task_blocker_(task_blocker.Pass()) { -} + task_blocker_(task_blocker.Pass()) {} } // namespace drive_backend } // namespace sync_file_system diff --git a/chrome/browser/sync_file_system/drive_backend/sync_task_token.h b/chrome/browser/sync_file_system/drive_backend/sync_task_token.h index a32fd47..1304ed6 100644 --- a/chrome/browser/sync_file_system/drive_backend/sync_task_token.h +++ b/chrome/browser/sync_file_system/drive_backend/sync_task_token.h @@ -5,8 +5,11 @@ #ifndef CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_SYNC_TASK_TOKEN_H_ #define CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_SYNC_TASK_TOKEN_H_ +#include <stdint.h> + #include "base/callback.h" #include "base/location.h" +#include "base/macros.h" #include "base/memory/scoped_ptr.h" #include "base/memory/weak_ptr.h" #include "chrome/browser/sync_file_system/sync_callbacks.h" @@ -22,9 +25,9 @@ struct TaskBlocker; // should run exclusively, and held by SyncTaskManager when no task is running. class SyncTaskToken { public: - static const int64 kTestingTaskTokenID; - static const int64 kForegroundTaskTokenID; - static const int64 kMinimumBackgroundTaskTokenID; + static const int64_t kTestingTaskTokenID; + static const int64_t kForegroundTaskTokenID; + static const int64_t kMinimumBackgroundTaskTokenID; static scoped_ptr<SyncTaskToken> CreateForTesting( const SyncStatusCallback& callback); @@ -34,7 +37,7 @@ class SyncTaskToken { static scoped_ptr<SyncTaskToken> CreateForBackgroundTask( const base::WeakPtr<SyncTaskManager>& manager, base::SequencedTaskRunner* task_runner, - int64 token_id, + int64_t token_id, scoped_ptr<TaskBlocker> task_blocker); void UpdateTask(const tracked_objects::Location& location, @@ -54,7 +57,7 @@ class SyncTaskToken { const TaskBlocker* task_blocker() const; void clear_task_blocker(); - int64 token_id() const { return token_id_; } + int64_t token_id() const { return token_id_; } void InitializeTaskLog(const std::string& task_description); void FinalizeTaskLog(const std::string& result_description); @@ -67,14 +70,14 @@ class SyncTaskToken { private: SyncTaskToken(const base::WeakPtr<SyncTaskManager>& manager, const scoped_refptr<base::SequencedTaskRunner>& task_runner, - int64 token_id, + int64_t token_id, scoped_ptr<TaskBlocker> task_blocker, const SyncStatusCallback& callback); base::WeakPtr<SyncTaskManager> manager_; scoped_refptr<base::SequencedTaskRunner> task_runner_; tracked_objects::Location location_; - int64 token_id_; + int64_t token_id_; SyncStatusCallback callback_; scoped_ptr<TaskLogger::TaskLog> task_log_; diff --git a/chrome/browser/sync_file_system/drive_backend/sync_worker.h b/chrome/browser/sync_file_system/drive_backend/sync_worker.h index 7ae7606..45167b6 100644 --- a/chrome/browser/sync_file_system/drive_backend/sync_worker.h +++ b/chrome/browser/sync_file_system/drive_backend/sync_worker.h @@ -8,6 +8,7 @@ #include <string> #include "base/files/file_path.h" +#include "base/macros.h" #include "base/memory/scoped_ptr.h" #include "base/memory/weak_ptr.h" #include "base/observer_list.h" diff --git a/chrome/browser/sync_file_system/drive_backend/sync_worker_interface.h b/chrome/browser/sync_file_system/drive_backend/sync_worker_interface.h index b053974..4590a4b 100644 --- a/chrome/browser/sync_file_system/drive_backend/sync_worker_interface.h +++ b/chrome/browser/sync_file_system/drive_backend/sync_worker_interface.h @@ -7,6 +7,7 @@ #include <string> +#include "base/macros.h" #include "base/memory/scoped_ptr.h" #include "chrome/browser/sync_file_system/remote_file_sync_service.h" #include "chrome/browser/sync_file_system/sync_action.h" diff --git a/chrome/browser/sync_file_system/drive_backend/sync_worker_unittest.cc b/chrome/browser/sync_file_system/drive_backend/sync_worker_unittest.cc index 6bed5bf..a8754d2 100644 --- a/chrome/browser/sync_file_system/drive_backend/sync_worker_unittest.cc +++ b/chrome/browser/sync_file_system/drive_backend/sync_worker_unittest.cc @@ -6,6 +6,7 @@ #include "base/files/scoped_temp_dir.h" #include "base/location.h" +#include "base/macros.h" #include "base/run_loop.h" #include "base/single_thread_task_runner.h" #include "base/strings/stringprintf.h" diff --git a/chrome/browser/sync_file_system/drive_backend/task_dependency_manager.h b/chrome/browser/sync_file_system/drive_backend/task_dependency_manager.h index f856748..8641106 100644 --- a/chrome/browser/sync_file_system/drive_backend/task_dependency_manager.h +++ b/chrome/browser/sync_file_system/drive_backend/task_dependency_manager.h @@ -5,12 +5,15 @@ #ifndef CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_TASK_DEPENDENCY_MANAGER_H_ #define CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_TASK_DEPENDENCY_MANAGER_H_ +#include <stdint.h> + #include <map> #include <set> #include <string> #include <vector> #include "base/files/file_path.h" +#include "base/macros.h" #include "base/memory/scoped_ptr.h" #include "chrome/browser/sync_file_system/subtree_set.h" @@ -22,7 +25,7 @@ struct TaskBlocker { std::string app_id; std::vector<base::FilePath> paths; std::vector<std::string> file_ids; - std::vector<int64> tracker_ids; + std::vector<int64_t> tracker_ids; TaskBlocker(); ~TaskBlocker(); @@ -53,7 +56,7 @@ class TaskDependencyManager { bool running_exclusive_task_; std::map<std::string, SubtreeSet> paths_by_app_id_; std::set<std::string> file_ids_; - std::set<int64> tracker_ids_; + std::set<int64_t> tracker_ids_; DISALLOW_COPY_AND_ASSIGN(TaskDependencyManager); }; diff --git a/chrome/browser/sync_file_system/drive_backend/tracker_id_set.cc b/chrome/browser/sync_file_system/drive_backend/tracker_id_set.cc index 9fc4bba..0bb272d 100644 --- a/chrome/browser/sync_file_system/drive_backend/tracker_id_set.cc +++ b/chrome/browser/sync_file_system/drive_backend/tracker_id_set.cc @@ -22,7 +22,7 @@ void TrackerIDSet::Insert(const FileTracker& tracker) { InsertInactiveTracker(tracker.tracker_id()); } -void TrackerIDSet::InsertActiveTracker(int64 tracker_id) { +void TrackerIDSet::InsertActiveTracker(int64_t tracker_id) { DCHECK(tracker_id); DCHECK(!active_tracker_); @@ -30,14 +30,14 @@ void TrackerIDSet::InsertActiveTracker(int64 tracker_id) { tracker_ids_.insert(tracker_id); } -void TrackerIDSet::InsertInactiveTracker(int64 tracker_id) { +void TrackerIDSet::InsertInactiveTracker(int64_t tracker_id) { DCHECK(tracker_id); DCHECK_NE(active_tracker_, tracker_id); tracker_ids_.insert(tracker_id); } -void TrackerIDSet::Erase(int64 tracker_id) { +void TrackerIDSet::Erase(int64_t tracker_id) { DCHECK(ContainsKey(tracker_ids_, tracker_id)); if (active_tracker_ == tracker_id) @@ -45,13 +45,13 @@ void TrackerIDSet::Erase(int64 tracker_id) { tracker_ids_.erase(tracker_id); } -void TrackerIDSet::Activate(int64 tracker_id) { +void TrackerIDSet::Activate(int64_t tracker_id) { DCHECK(!active_tracker_); DCHECK(ContainsKey(tracker_ids_, tracker_id)); active_tracker_ = tracker_id; } -void TrackerIDSet::Deactivate(int64 tracker_id) { +void TrackerIDSet::Deactivate(int64_t tracker_id) { DCHECK_EQ(active_tracker_, tracker_id); DCHECK(ContainsKey(tracker_ids_, tracker_id)); active_tracker_ = 0; diff --git a/chrome/browser/sync_file_system/drive_backend/tracker_id_set.h b/chrome/browser/sync_file_system/drive_backend/tracker_id_set.h index 15f4470..15217d2 100644 --- a/chrome/browser/sync_file_system/drive_backend/tracker_id_set.h +++ b/chrome/browser/sync_file_system/drive_backend/tracker_id_set.h @@ -5,9 +5,11 @@ #ifndef CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_TRACKER_ID_SET_H_ #define CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_TRACKER_ID_SET_H_ +#include <stddef.h> +#include <stdint.h> + #include <set> -#include "base/basictypes.h" namespace sync_file_system { namespace drive_backend { @@ -16,7 +18,7 @@ class FileTracker; class TrackerIDSet { public: - typedef std::set<int64> RawTrackerIDSet; + typedef std::set<int64_t> RawTrackerIDSet; typedef RawTrackerIDSet::iterator iterator; typedef RawTrackerIDSet::const_iterator const_iterator; @@ -25,13 +27,13 @@ class TrackerIDSet { bool has_active() const { return !!active_tracker_; } void Insert(const FileTracker& tracker); - void InsertActiveTracker(int64 tracker_id); - void InsertInactiveTracker(int64 tracker_id); - void Erase(int64 tracker_id); - void Activate(int64 tracker_id); - void Deactivate(int64 tracker_id); + void InsertActiveTracker(int64_t tracker_id); + void InsertInactiveTracker(int64_t tracker_id); + void Erase(int64_t tracker_id); + void Activate(int64_t tracker_id); + void Deactivate(int64_t tracker_id); - int64 active_tracker() const { return active_tracker_; } + int64_t active_tracker() const { return active_tracker_; } const RawTrackerIDSet& tracker_set() const { return tracker_ids_; } iterator begin() { return tracker_ids_.begin(); } @@ -42,7 +44,7 @@ class TrackerIDSet { size_t size() const { return tracker_ids_.size(); } private: - int64 active_tracker_; + int64_t active_tracker_; RawTrackerIDSet tracker_ids_; }; diff --git a/chrome/browser/sync_file_system/drive_backend/uninstall_app_task.cc b/chrome/browser/sync_file_system/drive_backend/uninstall_app_task.cc index 1a5bf6f..a6351aa 100644 --- a/chrome/browser/sync_file_system/drive_backend/uninstall_app_task.cc +++ b/chrome/browser/sync_file_system/drive_backend/uninstall_app_task.cc @@ -46,7 +46,7 @@ void UninstallAppTask::RunExclusive(const SyncStatusCallback& callback) { } DCHECK_EQ(RemoteFileSyncService::UNINSTALL_AND_PURGE_REMOTE, uninstall_flag_); - int64 sync_root_tracker_id = metadata_database()->GetSyncRootTrackerID(); + int64_t sync_root_tracker_id = metadata_database()->GetSyncRootTrackerID(); TrackerIDSet trackers; if (!metadata_database()->FindTrackersByParentAndTitle( sync_root_tracker_id, app_id_, &trackers) || @@ -75,7 +75,7 @@ void UninstallAppTask::RunExclusive(const SyncStatusCallback& callback) { } void UninstallAppTask::DidDeleteAppRoot(const SyncStatusCallback& callback, - int64 change_id, + int64_t change_id, google_apis::DriveApiErrorCode error) { SyncStatusCode status = DriveApiErrorCodeToSyncStatusCode(error); if (status != SYNC_STATUS_OK && diff --git a/chrome/browser/sync_file_system/drive_backend/uninstall_app_task.h b/chrome/browser/sync_file_system/drive_backend/uninstall_app_task.h index 2b9e0d7..0f2813d 100644 --- a/chrome/browser/sync_file_system/drive_backend/uninstall_app_task.h +++ b/chrome/browser/sync_file_system/drive_backend/uninstall_app_task.h @@ -5,8 +5,11 @@ #ifndef CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_UNINSTALL_APP_TASK_H_ #define CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_UNINSTALL_APP_TASK_H_ +#include <stdint.h> + #include <string> +#include "base/macros.h" #include "base/memory/scoped_ptr.h" #include "base/memory/weak_ptr.h" #include "chrome/browser/sync_file_system/drive_backend/sync_task.h" @@ -38,7 +41,7 @@ class UninstallAppTask : public ExclusiveTask { private: void DidDeleteAppRoot(const SyncStatusCallback& callback, - int64 change_id, + int64_t change_id, google_apis::DriveApiErrorCode error); bool IsContextReady(); @@ -49,7 +52,7 @@ class UninstallAppTask : public ExclusiveTask { std::string app_id_; UninstallFlag uninstall_flag_; - int64 app_root_tracker_id_; + int64_t app_root_tracker_id_; base::WeakPtrFactory<UninstallAppTask> weak_ptr_factory_; diff --git a/chrome/browser/sync_file_system/fake_remote_change_processor.cc b/chrome/browser/sync_file_system/fake_remote_change_processor.cc index 59f71cf..6401f0e 100644 --- a/chrome/browser/sync_file_system/fake_remote_change_processor.cc +++ b/chrome/browser/sync_file_system/fake_remote_change_processor.cc @@ -4,6 +4,8 @@ #include "chrome/browser/sync_file_system/fake_remote_change_processor.h" +#include <stddef.h> + #include "base/bind.h" #include "base/files/file_path.h" #include "base/location.h" diff --git a/chrome/browser/sync_file_system/fake_remote_change_processor.h b/chrome/browser/sync_file_system/fake_remote_change_processor.h index 48bfa8d..08c42ae 100644 --- a/chrome/browser/sync_file_system/fake_remote_change_processor.h +++ b/chrome/browser/sync_file_system/fake_remote_change_processor.h @@ -10,6 +10,7 @@ #include <vector> #include "base/callback.h" +#include "base/macros.h" #include "chrome/browser/sync_file_system/remote_change_processor.h" #include "chrome/browser/sync_file_system/sync_callbacks.h" diff --git a/chrome/browser/sync_file_system/file_change.h b/chrome/browser/sync_file_system/file_change.h index e06db90..826cf2e 100644 --- a/chrome/browser/sync_file_system/file_change.h +++ b/chrome/browser/sync_file_system/file_change.h @@ -5,10 +5,11 @@ #ifndef CHROME_BROWSER_SYNC_FILE_SYSTEM_FILE_CHANGE_H_ #define CHROME_BROWSER_SYNC_FILE_SYSTEM_FILE_CHANGE_H_ +#include <stddef.h> + #include <deque> #include <string> -#include "base/basictypes.h" #include "base/files/file_path.h" #include "chrome/browser/sync_file_system/sync_file_type.h" #include "storage/browser/fileapi/file_system_url.h" diff --git a/chrome/browser/sync_file_system/file_change_unittest.cc b/chrome/browser/sync_file_system/file_change_unittest.cc index 6a3df50..2195caa 100644 --- a/chrome/browser/sync_file_system/file_change_unittest.cc +++ b/chrome/browser/sync_file_system/file_change_unittest.cc @@ -4,7 +4,8 @@ #include "chrome/browser/sync_file_system/file_change.h" -#include "base/basictypes.h" +#include <stddef.h> + #include "base/logging.h" #include "testing/gtest/include/gtest/gtest.h" diff --git a/chrome/browser/sync_file_system/file_status_observer.h b/chrome/browser/sync_file_system/file_status_observer.h index 352a5ce..bbc5239 100644 --- a/chrome/browser/sync_file_system/file_status_observer.h +++ b/chrome/browser/sync_file_system/file_status_observer.h @@ -5,7 +5,7 @@ #ifndef CHROME_BROWSER_SYNC_FILE_SYSTEM_FILE_STATUS_OBSERVER_H_ #define CHROME_BROWSER_SYNC_FILE_SYSTEM_FILE_STATUS_OBSERVER_H_ -#include "base/basictypes.h" +#include "base/macros.h" #include "chrome/browser/sync_file_system/sync_action.h" #include "chrome/browser/sync_file_system/sync_direction.h" #include "chrome/browser/sync_file_system/sync_file_status.h" diff --git a/chrome/browser/sync_file_system/local/canned_syncable_file_system.cc b/chrome/browser/sync_file_system/local/canned_syncable_file_system.cc index ab18150f..efe1107 100644 --- a/chrome/browser/sync_file_system/local/canned_syncable_file_system.cc +++ b/chrome/browser/sync_file_system/local/canned_syncable_file_system.cc @@ -4,6 +4,8 @@ #include "chrome/browser/sync_file_system/local/canned_syncable_file_system.h" +#include <stddef.h> + #include <algorithm> #include <iterator> @@ -12,6 +14,7 @@ #include "base/files/file.h" #include "base/files/file_util.h" #include "base/guid.h" +#include "base/macros.h" #include "base/run_loop.h" #include "base/single_thread_task_runner.h" #include "base/task_runner_util.h" @@ -168,19 +171,22 @@ class WriteHelper { ScopedTextBlob* scoped_text_blob() const { return blob_data_.get(); } - void DidWrite(const base::Callback<void(int64 result)>& completion_callback, - File::Error error, int64 bytes, bool complete) { + void DidWrite(const base::Callback<void(int64_t result)>& completion_callback, + File::Error error, + int64_t bytes, + bool complete) { if (error == base::File::FILE_OK) { bytes_written_ += bytes; if (!complete) return; } - completion_callback.Run(error == base::File::FILE_OK ? - bytes_written_ : static_cast<int64>(error)); + completion_callback.Run(error == base::File::FILE_OK + ? bytes_written_ + : static_cast<int64_t>(error)); } private: - int64 bytes_written_; + int64_t bytes_written_; scoped_ptr<MockBlobURLRequestContext> request_context_; scoped_ptr<ScopedTextBlob> blob_data_; @@ -188,11 +194,11 @@ class WriteHelper { }; void DidGetUsageAndQuota(const storage::StatusCallback& callback, - int64* usage_out, - int64* quota_out, + int64_t* usage_out, + int64_t* quota_out, storage::QuotaStatusCode status, - int64 usage, - int64 quota) { + int64_t usage, + int64_t quota) { *usage_out = usage; *quota_out = quota; callback.Run(status); @@ -373,8 +379,8 @@ File::Error CannedSyncableFileSystem::Move( dest_url)); } -File::Error CannedSyncableFileSystem::TruncateFile( - const FileSystemURL& url, int64 size) { +File::Error CannedSyncableFileSystem::TruncateFile(const FileSystemURL& url, + int64_t size) { return RunOnThread<File::Error>( io_task_runner_.get(), FROM_HERE, @@ -467,27 +473,22 @@ File::Error CannedSyncableFileSystem::ReadDirectory( entries)); } -int64 CannedSyncableFileSystem::Write( +int64_t CannedSyncableFileSystem::Write( net::URLRequestContext* url_request_context, const FileSystemURL& url, scoped_ptr<storage::BlobDataHandle> blob_data_handle) { - return RunOnThread<int64>(io_task_runner_.get(), - FROM_HERE, - base::Bind(&CannedSyncableFileSystem::DoWrite, - base::Unretained(this), - url_request_context, - url, - base::Passed(&blob_data_handle))); + return RunOnThread<int64_t>( + io_task_runner_.get(), FROM_HERE, + base::Bind(&CannedSyncableFileSystem::DoWrite, base::Unretained(this), + url_request_context, url, base::Passed(&blob_data_handle))); } -int64 CannedSyncableFileSystem::WriteString( - const FileSystemURL& url, const std::string& data) { - return RunOnThread<int64>(io_task_runner_.get(), - FROM_HERE, - base::Bind(&CannedSyncableFileSystem::DoWriteString, - base::Unretained(this), - url, - data)); +int64_t CannedSyncableFileSystem::WriteString(const FileSystemURL& url, + const std::string& data) { + return RunOnThread<int64_t>( + io_task_runner_.get(), FROM_HERE, + base::Bind(&CannedSyncableFileSystem::DoWriteString, + base::Unretained(this), url, data)); } File::Error CannedSyncableFileSystem::DeleteFileSystem() { @@ -502,8 +503,8 @@ File::Error CannedSyncableFileSystem::DeleteFileSystem() { } storage::QuotaStatusCode CannedSyncableFileSystem::GetUsageAndQuota( - int64* usage, - int64* quota) { + int64_t* usage, + int64_t* quota) { return RunOnThread<storage::QuotaStatusCode>( io_task_runner_.get(), FROM_HERE, @@ -610,9 +611,9 @@ void CannedSyncableFileSystem::DoMove( src_url, dest_url, storage::FileSystemOperation::OPTION_NONE, callback); } -void CannedSyncableFileSystem::DoTruncateFile( - const FileSystemURL& url, int64 size, - const StatusCallback& callback) { +void CannedSyncableFileSystem::DoTruncateFile(const FileSystemURL& url, + int64_t size, + const StatusCallback& callback) { EXPECT_TRUE(io_task_runner_->RunsTasksOnCurrentThread()); EXPECT_TRUE(is_filesystem_opened_); operation_runner()->Truncate(url, size, callback); @@ -713,8 +714,8 @@ void CannedSyncableFileSystem::DoWriteString( } void CannedSyncableFileSystem::DoGetUsageAndQuota( - int64* usage, - int64* quota, + int64_t* usage, + int64_t* quota, const storage::StatusCallback& callback) { // crbug.com/349708 TRACE_EVENT0("io", "CannedSyncableFileSystem::DoGetUsageAndQuota"); diff --git a/chrome/browser/sync_file_system/local/canned_syncable_file_system.h b/chrome/browser/sync_file_system/local/canned_syncable_file_system.h index cb95f7a..57bfa47 100644 --- a/chrome/browser/sync_file_system/local/canned_syncable_file_system.h +++ b/chrome/browser/sync_file_system/local/canned_syncable_file_system.h @@ -5,12 +5,15 @@ #ifndef CHROME_BROWSER_SYNC_FILE_SYSTEM_LOCAL_CANNED_SYNCABLE_FILE_SYSTEM_H_ #define CHROME_BROWSER_SYNC_FILE_SYSTEM_LOCAL_CANNED_SYNCABLE_FILE_SYSTEM_H_ +#include <stdint.h> + #include <string> #include <vector> #include "base/callback_forward.h" #include "base/files/file.h" #include "base/files/scoped_temp_dir.h" +#include "base/macros.h" #include "base/observer_list_threadsafe.h" #include "chrome/browser/sync_file_system/local/local_file_sync_status.h" #include "chrome/browser/sync_file_system/sync_status_code.h" @@ -62,7 +65,7 @@ class CannedSyncableFileSystem base::File::Error result)> OpenFileSystemCallback; typedef base::Callback<void(base::File::Error)> StatusCallback; - typedef base::Callback<void(int64)> WriteCallback; + typedef base::Callback<void(int64_t)> WriteCallback; typedef storage::FileSystemOperation::FileEntryList FileEntryList; enum QuotaMode { @@ -121,7 +124,8 @@ class CannedSyncableFileSystem const storage::FileSystemURL& dest_url); base::File::Error Move(const storage::FileSystemURL& src_url, const storage::FileSystemURL& dest_url); - base::File::Error TruncateFile(const storage::FileSystemURL& url, int64 size); + base::File::Error TruncateFile(const storage::FileSystemURL& url, + int64_t size); base::File::Error TouchFile(const storage::FileSystemURL& url, const base::Time& last_access_time, const base::Time& last_modified_time); @@ -138,16 +142,17 @@ class CannedSyncableFileSystem FileEntryList* entries); // Returns the # of bytes written (>=0) or an error code (<0). - int64 Write(net::URLRequestContext* url_request_context, - const storage::FileSystemURL& url, - scoped_ptr<storage::BlobDataHandle> blob_data_handle); - int64 WriteString(const storage::FileSystemURL& url, const std::string& data); + int64_t Write(net::URLRequestContext* url_request_context, + const storage::FileSystemURL& url, + scoped_ptr<storage::BlobDataHandle> blob_data_handle); + int64_t WriteString(const storage::FileSystemURL& url, + const std::string& data); // Purges the file system local storage. base::File::Error DeleteFileSystem(); // Retrieves the quota and usage. - storage::QuotaStatusCode GetUsageAndQuota(int64* usage, int64* quota); + storage::QuotaStatusCode GetUsageAndQuota(int64_t* usage, int64_t* quota); // ChangeTracker related methods. They run on file task runner. void GetChangedURLsInTracker(storage::FileSystemURLSet* urls); @@ -176,7 +181,7 @@ class CannedSyncableFileSystem const storage::FileSystemURL& dest_url, const StatusCallback& callback); void DoTruncateFile(const storage::FileSystemURL& url, - int64 size, + int64_t size, const StatusCallback& callback); void DoTouchFile(const storage::FileSystemURL& url, const base::Time& last_access_time, @@ -206,8 +211,8 @@ class CannedSyncableFileSystem void DoWriteString(const storage::FileSystemURL& url, const std::string& data, const WriteCallback& callback); - void DoGetUsageAndQuota(int64* usage, - int64* quota, + void DoGetUsageAndQuota(int64_t* usage, + int64_t* quota, const storage::StatusCallback& callback); private: diff --git a/chrome/browser/sync_file_system/local/local_file_change_tracker.cc b/chrome/browser/sync_file_system/local/local_file_change_tracker.cc index 6558bce..e67d97b 100644 --- a/chrome/browser/sync_file_system/local/local_file_change_tracker.cc +++ b/chrome/browser/sync_file_system/local/local_file_change_tracker.cc @@ -4,10 +4,13 @@ #include "chrome/browser/sync_file_system/local/local_file_change_tracker.h" +#include <stddef.h> + #include <queue> #include "base/location.h" #include "base/logging.h" +#include "base/macros.h" #include "base/sequenced_task_runner.h" #include "base/stl_util.h" #include "chrome/browser/sync_file_system/local/local_file_sync_status.h" @@ -305,7 +308,7 @@ void LocalFileChangeTracker::ResetForFileSystem(const GURL& origin, void LocalFileChangeTracker::UpdateNumChanges() { base::AutoLock lock(num_changes_lock_); - num_changes_ = static_cast<int64>(change_seqs_.size()); + num_changes_ = static_cast<int64_t>(change_seqs_.size()); } void LocalFileChangeTracker::GetAllChangedURLs(FileSystemURLSet* urls) { diff --git a/chrome/browser/sync_file_system/local/local_file_change_tracker.h b/chrome/browser/sync_file_system/local/local_file_change_tracker.h index d38c8fc..d907eb2 100644 --- a/chrome/browser/sync_file_system/local/local_file_change_tracker.h +++ b/chrome/browser/sync_file_system/local/local_file_change_tracker.h @@ -5,13 +5,15 @@ #ifndef CHROME_BROWSER_SYNC_FILE_SYSTEM_LOCAL_LOCAL_FILE_CHANGE_TRACKER_H_ #define CHROME_BROWSER_SYNC_FILE_SYSTEM_LOCAL_LOCAL_FILE_CHANGE_TRACKER_H_ +#include <stdint.h> + #include <deque> #include <map> #include <string> -#include "base/basictypes.h" #include "base/compiler_specific.h" #include "base/files/file_path.h" +#include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" #include "base/synchronization/lock.h" @@ -52,7 +54,7 @@ class LocalFileChangeTracker : public storage::FileUpdateObserver, // FileUpdateObserver overrides. void OnStartUpdate(const storage::FileSystemURL& url) override; - void OnUpdate(const storage::FileSystemURL& url, int64 delta) override {} + void OnUpdate(const storage::FileSystemURL& url, int64_t delta) override {} void OnEndUpdate(const storage::FileSystemURL& url) override; // FileChangeObserver overrides. @@ -113,7 +115,7 @@ class LocalFileChangeTracker : public storage::FileUpdateObserver, void ResetForFileSystem(const GURL& origin, storage::FileSystemType type); // This method is (exceptionally) thread-safe. - int64 num_changes() const { + int64_t num_changes() const { base::AutoLock lock(num_changes_lock_); return num_changes_; } @@ -130,13 +132,13 @@ class LocalFileChangeTracker : public storage::FileUpdateObserver, ChangeInfo(); ~ChangeInfo(); FileChangeList change_list; - int64 change_seq; + int64_t change_seq; }; typedef std::map<storage::FileSystemURL, ChangeInfo, storage::FileSystemURL::Comparator> FileChangeMap; - typedef std::map<int64, storage::FileSystemURL> ChangeSeqMap; + typedef std::map<int64_t, storage::FileSystemURL> ChangeSeqMap; void UpdateNumChanges(); @@ -182,10 +184,10 @@ class LocalFileChangeTracker : public storage::FileUpdateObserver, // Change sequence number. Briefly gives a hint about the order of changes, // but they are updated when a new change comes on the same file (as // well as Drive's changestamps). - int64 current_change_seq_number_; + int64_t current_change_seq_number_; // This can be accessed on any threads (with num_changes_lock_). - int64 num_changes_; + int64_t num_changes_; mutable base::Lock num_changes_lock_; DISALLOW_COPY_AND_ASSIGN(LocalFileChangeTracker); diff --git a/chrome/browser/sync_file_system/local/local_file_change_tracker_unittest.cc b/chrome/browser/sync_file_system/local/local_file_change_tracker_unittest.cc index 8c91a3a..4a0e4e3 100644 --- a/chrome/browser/sync_file_system/local/local_file_change_tracker_unittest.cc +++ b/chrome/browser/sync_file_system/local/local_file_change_tracker_unittest.cc @@ -4,11 +4,13 @@ #include "chrome/browser/sync_file_system/local/local_file_change_tracker.h" +#include <stdint.h> + #include <deque> #include <set> -#include "base/basictypes.h" #include "base/files/scoped_temp_dir.h" +#include "base/macros.h" #include "base/memory/scoped_ptr.h" #include "base/message_loop/message_loop.h" #include "base/stl_util.h" @@ -294,9 +296,9 @@ TEST_F(LocalFileChangeTrackerTest, RestoreCreateAndModifyChanges) { file_system_.TruncateFile(URL(kPath3), 1)); // Modifies the file. EXPECT_EQ(base::File::FILE_OK, file_system_.CreateFile(URL(kPath4))); // Creates another file. - EXPECT_EQ(static_cast<int64>(kData.size()), // Modifies the file. - file_system_.Write(&url_request_context, - URL(kPath4), blob.GetBlobDataHandle())); + EXPECT_EQ(static_cast<int64_t>(kData.size()), // Modifies the file. + file_system_.Write(&url_request_context, URL(kPath4), + blob.GetBlobDataHandle())); // Verify the changes. file_system_.GetChangedURLsInTracker(&urls); @@ -445,8 +447,8 @@ TEST_F(LocalFileChangeTrackerTest, RestoreCopyChanges) { file_system_.TruncateFile(URL(kPath3), 1)); // Modifies the file. EXPECT_EQ(base::File::FILE_OK, file_system_.CreateFile(URL(kPath4))); // Creates another file. - EXPECT_EQ(static_cast<int64>(kData.size()), - file_system_.Write(&url_request_context, // Modifies the file. + EXPECT_EQ(static_cast<int64_t>(kData.size()), + file_system_.Write(&url_request_context, // Modifies the file. URL(kPath4), blob.GetBlobDataHandle())); // Verify we have 5 changes for preparation. diff --git a/chrome/browser/sync_file_system/local/local_file_sync_context.h b/chrome/browser/sync_file_system/local/local_file_sync_context.h index 1cfc04d..f0dc383 100644 --- a/chrome/browser/sync_file_system/local/local_file_sync_context.h +++ b/chrome/browser/sync_file_system/local/local_file_sync_context.h @@ -11,11 +11,11 @@ #include <string> #include <vector> -#include "base/basictypes.h" #include "base/callback.h" #include "base/files/file.h" #include "base/files/file_path.h" #include "base/logging.h" +#include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" #include "base/memory/weak_ptr.h" diff --git a/chrome/browser/sync_file_system/local/local_file_sync_context_unittest.cc b/chrome/browser/sync_file_system/local/local_file_sync_context_unittest.cc index 82b4989..bcca037 100644 --- a/chrome/browser/sync_file_system/local/local_file_sync_context_unittest.cc +++ b/chrome/browser/sync_file_system/local/local_file_sync_context_unittest.cc @@ -4,6 +4,8 @@ #include "chrome/browser/sync_file_system/local/local_file_sync_context.h" +#include <stdint.h> + #include <vector> #include "base/bind.h" @@ -11,6 +13,7 @@ #include "base/files/file_path.h" #include "base/files/file_util.h" #include "base/location.h" +#include "base/macros.h" #include "base/message_loop/message_loop.h" #include "base/single_thread_task_runner.h" #include "base/stl_util.h" @@ -610,8 +613,8 @@ TEST_F(LocalFileSyncContextTest, ApplyRemoteChangeForDeletion) { ASSERT_EQ(base::File::FILE_OK, file_system.OpenFileSystem()); // Record the initial usage (likely 0). - int64 initial_usage = -1; - int64 quota = -1; + int64_t initial_usage = -1; + int64_t quota = -1; EXPECT_EQ(storage::kQuotaStatusOk, file_system.GetUsageAndQuota(&initial_usage, "a)); @@ -637,7 +640,7 @@ TEST_F(LocalFileSyncContextTest, ApplyRemoteChangeForDeletion) { } // At this point the usage must be greater than the initial usage. - int64 new_usage = -1; + int64_t new_usage = -1; EXPECT_EQ(storage::kQuotaStatusOk, file_system.GetUsageAndQuota(&new_usage, "a)); EXPECT_GT(new_usage, initial_usage); @@ -698,8 +701,8 @@ TEST_F(LocalFileSyncContextTest, ApplyRemoteChangeForDeletion_ForRoot) { ASSERT_EQ(base::File::FILE_OK, file_system.OpenFileSystem()); // Record the initial usage (likely 0). - int64 initial_usage = -1; - int64 quota = -1; + int64_t initial_usage = -1; + int64_t quota = -1; EXPECT_EQ(storage::kQuotaStatusOk, file_system.GetUsageAndQuota(&initial_usage, "a)); @@ -713,7 +716,7 @@ TEST_F(LocalFileSyncContextTest, ApplyRemoteChangeForDeletion_ForRoot) { EXPECT_EQ(base::File::FILE_OK, file_system.CreateFile(kChild)); // At this point the usage must be greater than the initial usage. - int64 new_usage = -1; + int64_t new_usage = -1; EXPECT_EQ(storage::kQuotaStatusOk, file_system.GetUsageAndQuota(&new_usage, "a)); EXPECT_GT(new_usage, initial_usage); @@ -777,7 +780,7 @@ TEST_F(LocalFileSyncContextTest, ApplyRemoteChangeForAddOrUpdate) { // Create kFile1 and populate it with kTestFileData0. EXPECT_EQ(base::File::FILE_OK, file_system.CreateFile(kFile1)); - EXPECT_EQ(static_cast<int64>(arraysize(kTestFileData0) - 1), + EXPECT_EQ(static_cast<int64_t>(arraysize(kTestFileData0) - 1), file_system.WriteString(kFile1, kTestFileData0)); // kFile2 and kDir are not there yet. @@ -805,8 +808,8 @@ TEST_F(LocalFileSyncContextTest, ApplyRemoteChangeForAddOrUpdate) { arraysize(kTestFileData2) - 1)); // Record the usage. - int64 usage = -1, new_usage = -1; - int64 quota = -1; + int64_t usage = -1, new_usage = -1; + int64_t quota = -1; EXPECT_EQ(storage::kQuotaStatusOk, file_system.GetUsageAndQuota(&usage, "a)); @@ -884,7 +887,7 @@ TEST_F(LocalFileSyncContextTest, ApplyRemoteChangeForAddOrUpdate) { EXPECT_EQ(storage::kQuotaStatusOk, file_system.GetUsageAndQuota(&new_usage, "a)); EXPECT_GT(new_usage, - static_cast<int64>(usage + arraysize(kTestFileData2) - 1)); + static_cast<int64_t>(usage + arraysize(kTestFileData2) - 1)); // The changes applied by ApplyRemoteChange should not be recorded in // the change tracker. diff --git a/chrome/browser/sync_file_system/local/local_file_sync_service.cc b/chrome/browser/sync_file_system/local/local_file_sync_service.cc index b9c76f7..d28c141 100644 --- a/chrome/browser/sync_file_system/local/local_file_sync_service.cc +++ b/chrome/browser/sync_file_system/local/local_file_sync_service.cc @@ -70,8 +70,8 @@ bool LocalFileSyncService::OriginChangeMap::NextOriginToProcess(GURL* origin) { return false; } -int64 LocalFileSyncService::OriginChangeMap::GetTotalChangeCount() const { - int64 num_changes = 0; +int64_t LocalFileSyncService::OriginChangeMap::GetTotalChangeCount() const { + int64_t num_changes = 0; for (Map::const_iterator iter = change_count_map_.begin(); iter != change_count_map_.end(); ++iter) { if (ContainsKey(disabled_origins_, iter->first)) @@ -82,7 +82,8 @@ int64 LocalFileSyncService::OriginChangeMap::GetTotalChangeCount() const { } void LocalFileSyncService::OriginChangeMap::SetOriginChangeCount( - const GURL& origin, int64 changes) { + const GURL& origin, + int64_t changes) { if (changes != 0) { change_count_map_[origin] = changes; return; @@ -329,7 +330,7 @@ void LocalFileSyncService::OnChangesAvailableInOrigins( } if (!need_notification) return; - int64 num_changes = origin_change_map_.GetTotalChangeCount(); + int64_t num_changes = origin_change_map_.GetTotalChangeCount(); FOR_EACH_OBSERVER(Observer, change_observers_, OnLocalChangeAvailable(num_changes)); } @@ -376,7 +377,7 @@ void LocalFileSyncService::DidInitializeFileSystemContext( DCHECK(backend->change_tracker()); origin_change_map_.SetOriginChangeCount( app_origin, backend->change_tracker()->num_changes()); - int64 num_changes = origin_change_map_.GetTotalChangeCount(); + int64_t num_changes = origin_change_map_.GetTotalChangeCount(); FOR_EACH_OBSERVER(Observer, change_observers_, OnLocalChangeAvailable(num_changes)); } diff --git a/chrome/browser/sync_file_system/local/local_file_sync_service.h b/chrome/browser/sync_file_system/local/local_file_sync_service.h index 26c5949..3c6a531 100644 --- a/chrome/browser/sync_file_system/local/local_file_sync_service.h +++ b/chrome/browser/sync_file_system/local/local_file_sync_service.h @@ -5,12 +5,14 @@ #ifndef CHROME_BROWSER_SYNC_FILE_SYSTEM_LOCAL_LOCAL_FILE_SYNC_SERVICE_H_ #define CHROME_BROWSER_SYNC_FILE_SYSTEM_LOCAL_LOCAL_FILE_SYNC_SERVICE_H_ +#include <stdint.h> + #include <map> #include <set> #include <string> -#include "base/basictypes.h" #include "base/callback.h" +#include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/memory/weak_ptr.h" #include "base/observer_list.h" @@ -60,7 +62,7 @@ class LocalFileSyncService // |pending_changes_hint| indicates the pending queue length to help sync // scheduling but the value may not be accurately reflect the real-time // value. - virtual void OnLocalChangeAvailable(int64 pending_changes_hint) = 0; + virtual void OnLocalChangeAvailable(int64_t pending_changes_hint) = 0; private: DISALLOW_COPY_AND_ASSIGN(Observer); @@ -157,7 +159,7 @@ class LocalFileSyncService class OriginChangeMap { public: - typedef std::map<GURL, int64> Map; + typedef std::map<GURL, int64_t> Map; OriginChangeMap(); ~OriginChangeMap(); @@ -167,10 +169,10 @@ class LocalFileSyncService // Returns false if no origins to process. bool NextOriginToProcess(GURL* origin); - int64 GetTotalChangeCount() const; + int64_t GetTotalChangeCount() const; // Update change_count_map_ for |origin|. - void SetOriginChangeCount(const GURL& origin, int64 changes); + void SetOriginChangeCount(const GURL& origin, int64_t changes); void SetOriginEnabled(const GURL& origin, bool enabled); diff --git a/chrome/browser/sync_file_system/local/local_file_sync_service_unittest.cc b/chrome/browser/sync_file_system/local/local_file_sync_service_unittest.cc index 67c7088..d18d4d1 100644 --- a/chrome/browser/sync_file_system/local/local_file_sync_service_unittest.cc +++ b/chrome/browser/sync_file_system/local/local_file_sync_service_unittest.cc @@ -2,16 +2,19 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include <stdint.h> + #include <vector> -#include "base/basictypes.h" #include "base/bind.h" #include "base/files/file_util.h" #include "base/location.h" +#include "base/macros.h" #include "base/run_loop.h" #include "base/stl_util.h" #include "base/thread_task_runner_handle.h" #include "base/threading/thread.h" +#include "build/build_config.h" #include "chrome/browser/sync_file_system/file_change.h" #include "chrome/browser/sync_file_system/local/canned_syncable_file_system.h" #include "chrome/browser/sync_file_system/local/local_file_change_tracker.h" @@ -148,7 +151,7 @@ class LocalFileSyncServiceTest } // LocalChangeObserver overrides. - void OnLocalChangeAvailable(int64 num_changes) override { + void OnLocalChangeAvailable(int64_t num_changes) override { num_changes_ = num_changes; } @@ -190,7 +193,7 @@ class LocalFileSyncServiceTest return sync_status; } - int64 GetNumChangesInTracker() const { + int64_t GetNumChangesInTracker() const { return file_system_->backend()->change_tracker()->num_changes(); } @@ -203,7 +206,7 @@ class LocalFileSyncServiceTest scoped_ptr<CannedSyncableFileSystem> file_system_; scoped_ptr<LocalFileSyncService> local_service_; - int64 num_changes_; + int64_t num_changes_; }; // More complete tests for PrepareForProcessRemoteChange and ApplyRemoteChange @@ -597,11 +600,9 @@ class OriginChangeMapTest : public testing::Test { return map_.NextOriginToProcess(origin); } - int64 GetTotalChangeCount() const { - return map_.GetTotalChangeCount(); - } + int64_t GetTotalChangeCount() const { return map_.GetTotalChangeCount(); } - void SetOriginChangeCount(const GURL& origin, int64 changes) { + void SetOriginChangeCount(const GURL& origin, int64_t changes) { map_.SetOriginChangeCount(origin, changes); } diff --git a/chrome/browser/sync_file_system/local/local_file_sync_status.h b/chrome/browser/sync_file_system/local/local_file_sync_status.h index 1556d97..acd27e1 100644 --- a/chrome/browser/sync_file_system/local/local_file_sync_status.h +++ b/chrome/browser/sync_file_system/local/local_file_sync_status.h @@ -5,12 +5,14 @@ #ifndef CHROME_BROWSER_SYNC_FILE_SYSTEM_LOCAL_LOCAL_FILE_SYNC_STATUS_H_ #define CHROME_BROWSER_SYNC_FILE_SYSTEM_LOCAL_LOCAL_FILE_SYNC_STATUS_H_ +#include <stdint.h> + #include <map> #include <set> -#include "base/basictypes.h" #include "base/compiler_specific.h" #include "base/gtest_prod_util.h" +#include "base/macros.h" #include "base/observer_list.h" #include "base/threading/non_thread_safe.h" #include "storage/browser/fileapi/file_system_url.h" @@ -83,7 +85,7 @@ class LocalFileSyncStatus typedef std::set<base::FilePath> PathSet; typedef std::map<OriginAndType, PathSet> URLSet; - typedef std::map<base::FilePath, int64> PathBucket; + typedef std::map<base::FilePath, int64_t> PathBucket; typedef std::map<OriginAndType, PathBucket> URLBucket; bool IsChildOrParentWriting(const storage::FileSystemURL& url) const; diff --git a/chrome/browser/sync_file_system/local/local_file_sync_status_unittest.cc b/chrome/browser/sync_file_system/local/local_file_sync_status_unittest.cc index 5e29098..8b1d453 100644 --- a/chrome/browser/sync_file_system/local/local_file_sync_status_unittest.cc +++ b/chrome/browser/sync_file_system/local/local_file_sync_status_unittest.cc @@ -4,7 +4,6 @@ #include "chrome/browser/sync_file_system/local/local_file_sync_status.h" -#include "base/basictypes.h" #include "testing/gtest/include/gtest/gtest.h" #include "url/gurl.h" diff --git a/chrome/browser/sync_file_system/local/local_origin_change_observer.h b/chrome/browser/sync_file_system/local/local_origin_change_observer.h index 8d42347..3213114 100644 --- a/chrome/browser/sync_file_system/local/local_origin_change_observer.h +++ b/chrome/browser/sync_file_system/local/local_origin_change_observer.h @@ -7,7 +7,7 @@ #include <set> -#include "base/basictypes.h" +#include "base/macros.h" #include "url/gurl.h" namespace sync_file_system { diff --git a/chrome/browser/sync_file_system/local/mock_sync_status_observer.h b/chrome/browser/sync_file_system/local/mock_sync_status_observer.h index 353c312..193462f 100644 --- a/chrome/browser/sync_file_system/local/mock_sync_status_observer.h +++ b/chrome/browser/sync_file_system/local/mock_sync_status_observer.h @@ -5,6 +5,7 @@ #ifndef CHROME_BROWSER_SYNC_FILE_SYSTEM_LOCAL_MOCK_SYNC_STATUS_OBSERVER_H_ #define CHROME_BROWSER_SYNC_FILE_SYSTEM_LOCAL_MOCK_SYNC_STATUS_OBSERVER_H_ +#include "base/macros.h" #include "chrome/browser/sync_file_system/local/local_file_sync_status.h" #include "testing/gmock/include/gmock/gmock.h" diff --git a/chrome/browser/sync_file_system/local/root_delete_helper.h b/chrome/browser/sync_file_system/local/root_delete_helper.h index a3bfa9d..1c8a383 100644 --- a/chrome/browser/sync_file_system/local/root_delete_helper.h +++ b/chrome/browser/sync_file_system/local/root_delete_helper.h @@ -5,9 +5,9 @@ #ifndef CHROME_BROWSER_SYNC_FILE_SYSTEM_LOCAL_ROOT_DELETE_HELPER_H_ #define CHROME_BROWSER_SYNC_FILE_SYSTEM_LOCAL_ROOT_DELETE_HELPER_H_ -#include "base/basictypes.h" #include "base/callback.h" #include "base/files/file.h" +#include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/memory/weak_ptr.h" #include "storage/browser/fileapi/file_system_url.h" diff --git a/chrome/browser/sync_file_system/local/sync_file_system_backend.cc b/chrome/browser/sync_file_system/local/sync_file_system_backend.cc index b57995d..fbb9444 100644 --- a/chrome/browser/sync_file_system/local/sync_file_system_backend.cc +++ b/chrome/browser/sync_file_system/local/sync_file_system_backend.cc @@ -189,8 +189,8 @@ bool SyncFileSystemBackend::HasInplaceCopyImplementation( scoped_ptr<storage::FileStreamReader> SyncFileSystemBackend::CreateFileStreamReader( const storage::FileSystemURL& url, - int64 offset, - int64 max_bytes_to_read, + int64_t offset, + int64_t max_bytes_to_read, const base::Time& expected_modification_time, storage::FileSystemContext* context) const { DCHECK(CanHandleType(url.type())); @@ -201,7 +201,7 @@ SyncFileSystemBackend::CreateFileStreamReader( scoped_ptr<storage::FileStreamWriter> SyncFileSystemBackend::CreateFileStreamWriter( const storage::FileSystemURL& url, - int64 offset, + int64_t offset, storage::FileSystemContext* context) const { DCHECK(CanHandleType(url.type())); return GetDelegate()->CreateFileStreamWriter( diff --git a/chrome/browser/sync_file_system/local/sync_file_system_backend.h b/chrome/browser/sync_file_system/local/sync_file_system_backend.h index 4b47e28..043f995 100644 --- a/chrome/browser/sync_file_system/local/sync_file_system_backend.h +++ b/chrome/browser/sync_file_system/local/sync_file_system_backend.h @@ -5,6 +5,9 @@ #ifndef CHROME_BROWSER_SYNC_FILE_SYSTEM_LOCAL_SYNC_FILE_SYSTEM_BACKEND_H_ #define CHROME_BROWSER_SYNC_FILE_SYSTEM_LOCAL_SYNC_FILE_SYSTEM_BACKEND_H_ +#include <stdint.h> + +#include "base/macros.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/sync_file_system/sync_callbacks.h" #include "chrome/browser/sync_file_system/sync_status_code.h" @@ -49,13 +52,13 @@ class SyncFileSystemBackend : public storage::FileSystemBackend { storage::FileSystemType type) const override; scoped_ptr<storage::FileStreamReader> CreateFileStreamReader( const storage::FileSystemURL& url, - int64 offset, - int64 max_bytes_to_read, + int64_t offset, + int64_t max_bytes_to_read, const base::Time& expected_modification_time, storage::FileSystemContext* context) const override; scoped_ptr<storage::FileStreamWriter> CreateFileStreamWriter( const storage::FileSystemURL& url, - int64 offset, + int64_t offset, storage::FileSystemContext* context) const override; storage::FileSystemQuotaUtil* GetQuotaUtil() override; const storage::UpdateObserverList* GetUpdateObservers( diff --git a/chrome/browser/sync_file_system/local/syncable_file_operation_runner.cc b/chrome/browser/sync_file_system/local/syncable_file_operation_runner.cc index 11053a2..de4e316 100644 --- a/chrome/browser/sync_file_system/local/syncable_file_operation_runner.cc +++ b/chrome/browser/sync_file_system/local/syncable_file_operation_runner.cc @@ -4,6 +4,8 @@ #include "chrome/browser/sync_file_system/local/syncable_file_operation_runner.h" +#include <stddef.h> + #include <algorithm> #include <functional> @@ -43,7 +45,7 @@ void SyncableFileOperationRunner::Task::Start(LocalFileSyncStatus* status) { // SyncableFileOperationRunner ------------------------------------------------- SyncableFileOperationRunner::SyncableFileOperationRunner( - int64 max_inflight_tasks, + int64_t max_inflight_tasks, LocalFileSyncStatus* sync_status) : sync_status_(sync_status), max_inflight_tasks_(max_inflight_tasks), diff --git a/chrome/browser/sync_file_system/local/syncable_file_operation_runner.h b/chrome/browser/sync_file_system/local/syncable_file_operation_runner.h index 0005ab2..e54e702 100644 --- a/chrome/browser/sync_file_system/local/syncable_file_operation_runner.h +++ b/chrome/browser/sync_file_system/local/syncable_file_operation_runner.h @@ -5,11 +5,13 @@ #ifndef CHROME_BROWSER_SYNC_FILE_SYSTEM_LOCAL_SYNCABLE_FILE_OPERATION_RUNNER_H_ #define CHROME_BROWSER_SYNC_FILE_SYSTEM_LOCAL_SYNCABLE_FILE_OPERATION_RUNNER_H_ +#include <stdint.h> + #include <list> #include <vector> -#include "base/basictypes.h" #include "base/callback.h" +#include "base/macros.h" #include "base/memory/scoped_ptr.h" #include "base/memory/weak_ptr.h" #include "base/threading/non_thread_safe.h" @@ -52,7 +54,7 @@ class SyncableFileOperationRunner DISALLOW_COPY_AND_ASSIGN(Task); }; - SyncableFileOperationRunner(int64 max_inflight_tasks, + SyncableFileOperationRunner(int64_t max_inflight_tasks, LocalFileSyncStatus* sync_status); ~SyncableFileOperationRunner() override; @@ -78,11 +80,11 @@ class SyncableFileOperationRunner LocalFileSyncStatus* sync_status() const { return sync_status_; } - int64 num_pending_tasks() const { - return static_cast<int64>(pending_tasks_.size()); + int64_t num_pending_tasks() const { + return static_cast<int64_t>(pending_tasks_.size()); } - int64 num_inflight_tasks() const { return num_inflight_tasks_; } + int64_t num_inflight_tasks() const { return num_inflight_tasks_; } private: // Returns true if we should start more tasks. @@ -93,8 +95,8 @@ class SyncableFileOperationRunner std::list<Task*> pending_tasks_; - const int64 max_inflight_tasks_; - int64 num_inflight_tasks_; + const int64_t max_inflight_tasks_; + int64_t num_inflight_tasks_; DISALLOW_COPY_AND_ASSIGN(SyncableFileOperationRunner); }; diff --git a/chrome/browser/sync_file_system/local/syncable_file_operation_runner_unittest.cc b/chrome/browser/sync_file_system/local/syncable_file_operation_runner_unittest.cc index 2391dcc..8ccf44d 100644 --- a/chrome/browser/sync_file_system/local/syncable_file_operation_runner_unittest.cc +++ b/chrome/browser/sync_file_system/local/syncable_file_operation_runner_unittest.cc @@ -2,12 +2,15 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include <stddef.h> +#include <stdint.h> + #include <string> -#include "base/basictypes.h" #include "base/files/file.h" #include "base/files/file_util.h" #include "base/location.h" +#include "base/macros.h" #include "base/memory/scoped_ptr.h" #include "base/message_loop/message_loop.h" #include "base/run_loop.h" @@ -119,7 +122,9 @@ class SyncableFileOperationRunnerTest : public testing::Test { } void DidWrite(const tracked_objects::Location& location, - File::Error status, int64 bytes, bool complete) { + File::Error status, + int64_t bytes, + bool complete) { SCOPED_TRACE(testing::Message() << location.ToString()); write_status_ = status; write_bytes_ += bytes; diff --git a/chrome/browser/sync_file_system/local/syncable_file_system_operation.cc b/chrome/browser/sync_file_system/local/syncable_file_system_operation.cc index 1c19b9c..56243ee 100644 --- a/chrome/browser/sync_file_system/local/syncable_file_system_operation.cc +++ b/chrome/browser/sync_file_system/local/syncable_file_system_operation.cc @@ -5,6 +5,7 @@ #include "chrome/browser/sync_file_system/local/syncable_file_system_operation.h" #include "base/logging.h" +#include "base/macros.h" #include "chrome/browser/sync_file_system/local/local_file_sync_context.h" #include "chrome/browser/sync_file_system/local/sync_file_system_backend.h" #include "chrome/browser/sync_file_system/local/syncable_file_operation_runner.h" @@ -237,9 +238,9 @@ void SyncableFileSystemOperation::Write( operation_runner_->PostOperationTask(task.Pass()); } -void SyncableFileSystemOperation::Truncate( - const FileSystemURL& url, int64 length, - const StatusCallback& callback) { +void SyncableFileSystemOperation::Truncate(const FileSystemURL& url, + int64_t length, + const StatusCallback& callback) { DCHECK(CalledOnValidThread()); if (!operation_runner_.get()) { callback.Run(base::File::FILE_ERROR_NOT_FOUND); @@ -374,11 +375,10 @@ void SyncableFileSystemOperation::DidFinish(base::File::Error status) { completion_callback_.Run(status); } -void SyncableFileSystemOperation::DidWrite( - const WriteCallback& callback, - base::File::Error result, - int64 bytes, - bool complete) { +void SyncableFileSystemOperation::DidWrite(const WriteCallback& callback, + base::File::Error result, + int64_t bytes, + bool complete) { DCHECK(CalledOnValidThread()); if (!complete) { callback.Run(result, bytes, complete); diff --git a/chrome/browser/sync_file_system/local/syncable_file_system_operation.h b/chrome/browser/sync_file_system/local/syncable_file_system_operation.h index b93ded8..71491dc 100644 --- a/chrome/browser/sync_file_system/local/syncable_file_system_operation.h +++ b/chrome/browser/sync_file_system/local/syncable_file_system_operation.h @@ -5,9 +5,12 @@ #ifndef CHROME_BROWSER_SYNC_FILE_SYSTEM_LOCAL_SYNCABLE_FILE_SYSTEM_OPERATION_H_ #define CHROME_BROWSER_SYNC_FILE_SYSTEM_LOCAL_SYNCABLE_FILE_SYSTEM_OPERATION_H_ +#include <stdint.h> + #include <vector> #include "base/callback.h" +#include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" #include "base/memory/weak_ptr.h" @@ -66,7 +69,7 @@ class SyncableFileSystemOperation scoped_ptr<net::URLRequest> blob_request, const WriteCallback& callback) override; void Truncate(const storage::FileSystemURL& url, - int64 length, + int64_t length, const StatusCallback& callback) override; void TouchFile(const storage::FileSystemURL& url, const base::Time& last_access_time, @@ -112,7 +115,7 @@ class SyncableFileSystemOperation void DidFinish(base::File::Error status); void DidWrite(const WriteCallback& callback, base::File::Error result, - int64 bytes, + int64_t bytes, bool complete); void OnCancelled(); diff --git a/chrome/browser/sync_file_system/local/syncable_file_system_unittest.cc b/chrome/browser/sync_file_system/local/syncable_file_system_unittest.cc index 4e1d784..9234744 100644 --- a/chrome/browser/sync_file_system/local/syncable_file_system_unittest.cc +++ b/chrome/browser/sync_file_system/local/syncable_file_system_unittest.cc @@ -2,6 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include <stdint.h> + +#include "base/macros.h" #include "base/stl_util.h" #include "base/thread_task_runner_handle.h" #include "chrome/browser/sync_file_system/local/canned_syncable_file_system.h" @@ -123,11 +126,11 @@ TEST_F(SyncableFileSystemTest, SyncableLocalSandboxCombined) { EXPECT_EQ(base::File::FILE_OK, file_system_.CreateFile(URL("dir/foo"))); - const int64 kOriginalQuota = QuotaManager::kSyncableStorageDefaultHostQuota; + const int64_t kOriginalQuota = QuotaManager::kSyncableStorageDefaultHostQuota; - const int64 kQuota = 12345 * 1024; + const int64_t kQuota = 12345 * 1024; QuotaManager::kSyncableStorageDefaultHostQuota = kQuota; - int64 usage, quota; + int64_t usage, quota; EXPECT_EQ(storage::kQuotaStatusOk, file_system_.GetUsageAndQuota(&usage, "a)); @@ -137,14 +140,14 @@ TEST_F(SyncableFileSystemTest, SyncableLocalSandboxCombined) { EXPECT_GT(usage, 0); // Truncate to extend an existing file and see if the usage reflects it. - const int64 kFileSizeToExtend = 333; + const int64_t kFileSizeToExtend = 333; EXPECT_EQ(base::File::FILE_OK, file_system_.CreateFile(URL("dir/foo"))); EXPECT_EQ(base::File::FILE_OK, file_system_.TruncateFile(URL("dir/foo"), kFileSizeToExtend)); - int64 new_usage; + int64_t new_usage; EXPECT_EQ(storage::kQuotaStatusOk, file_system_.GetUsageAndQuota(&new_usage, "a)); EXPECT_EQ(kFileSizeToExtend, new_usage - usage); diff --git a/chrome/browser/sync_file_system/local_change_processor.h b/chrome/browser/sync_file_system/local_change_processor.h index 75f8ba0..7405956 100644 --- a/chrome/browser/sync_file_system/local_change_processor.h +++ b/chrome/browser/sync_file_system/local_change_processor.h @@ -6,6 +6,7 @@ #define CHROME_BROWSER_SYNC_FILE_SYSTEM_LOCAL_CHANGE_PROCESSOR_H_ #include "base/callback_forward.h" +#include "base/macros.h" #include "chrome/browser/sync_file_system/sync_callbacks.h" namespace storage { diff --git a/chrome/browser/sync_file_system/logger_unittest.cc b/chrome/browser/sync_file_system/logger_unittest.cc index 78df071..4167582 100644 --- a/chrome/browser/sync_file_system/logger_unittest.cc +++ b/chrome/browser/sync_file_system/logger_unittest.cc @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "base/macros.h" #include "chrome/browser/sync_file_system/logger.h" #include "testing/gtest/include/gtest/gtest.h" diff --git a/chrome/browser/sync_file_system/mock_local_change_processor.h b/chrome/browser/sync_file_system/mock_local_change_processor.h index 79976ed..a67bb38 100644 --- a/chrome/browser/sync_file_system/mock_local_change_processor.h +++ b/chrome/browser/sync_file_system/mock_local_change_processor.h @@ -5,7 +5,7 @@ #ifndef CHROME_BROWSER_SYNC_FILE_SYSTEM_MOCK_LOCAL_CHANGE_PROCESSOR_H_ #define CHROME_BROWSER_SYNC_FILE_SYSTEM_MOCK_LOCAL_CHANGE_PROCESSOR_H_ -#include "base/basictypes.h" +#include "base/macros.h" #include "chrome/browser/sync_file_system/local_change_processor.h" #include "testing/gmock/include/gmock/gmock.h" diff --git a/chrome/browser/sync_file_system/mock_remote_change_processor.h b/chrome/browser/sync_file_system/mock_remote_change_processor.h index 1740d77..99faaa2 100644 --- a/chrome/browser/sync_file_system/mock_remote_change_processor.h +++ b/chrome/browser/sync_file_system/mock_remote_change_processor.h @@ -6,6 +6,7 @@ #define CHROME_BROWSER_SYNC_FILE_SYSTEM_MOCK_REMOTE_CHANGE_PROCESSOR_H_ #include "base/callback.h" +#include "base/macros.h" #include "chrome/browser/sync_file_system/file_change.h" #include "chrome/browser/sync_file_system/remote_change_processor.h" #include "chrome/browser/sync_file_system/sync_callbacks.h" diff --git a/chrome/browser/sync_file_system/mock_remote_file_sync_service.cc b/chrome/browser/sync_file_system/mock_remote_file_sync_service.cc index 25d9d2d..432c38f 100644 --- a/chrome/browser/sync_file_system/mock_remote_file_sync_service.cc +++ b/chrome/browser/sync_file_system/mock_remote_file_sync_service.cc @@ -56,7 +56,7 @@ void MockRemoteFileSyncService::SetServiceState(RemoteServiceState state) { } void MockRemoteFileSyncService::NotifyRemoteChangeQueueUpdated( - int64 pending_changes) { + int64_t pending_changes) { FOR_EACH_OBSERVER(Observer, service_observers_, OnRemoteChangeQueueUpdated(pending_changes)); } diff --git a/chrome/browser/sync_file_system/mock_remote_file_sync_service.h b/chrome/browser/sync_file_system/mock_remote_file_sync_service.h index 456c6f7..5fc04b6 100644 --- a/chrome/browser/sync_file_system/mock_remote_file_sync_service.h +++ b/chrome/browser/sync_file_system/mock_remote_file_sync_service.h @@ -5,8 +5,11 @@ #ifndef CHROME_BROWSER_SYNC_FILE_SYSTEM_MOCK_REMOTE_FILE_SYNC_SERVICE_H_ #define CHROME_BROWSER_SYNC_FILE_SYSTEM_MOCK_REMOTE_FILE_SYNC_SERVICE_H_ +#include <stdint.h> + #include <string> +#include "base/macros.h" #include "base/memory/scoped_ptr.h" #include "base/observer_list.h" #include "base/values.h" @@ -61,7 +64,7 @@ class MockRemoteFileSyncService : public RemoteFileSyncService { // Send notifications to the observers. // Can be used in the mock implementation. - void NotifyRemoteChangeQueueUpdated(int64 pending_changes); + void NotifyRemoteChangeQueueUpdated(int64_t pending_changes); void NotifyRemoteServiceStateUpdated( RemoteServiceState state, const std::string& description); diff --git a/chrome/browser/sync_file_system/remote_change_processor.h b/chrome/browser/sync_file_system/remote_change_processor.h index 4f98786..a4464a5 100644 --- a/chrome/browser/sync_file_system/remote_change_processor.h +++ b/chrome/browser/sync_file_system/remote_change_processor.h @@ -5,8 +5,8 @@ #ifndef CHROME_BROWSER_SYNC_FILE_SYSTEM_REMOTE_CHANGE_PROCESSOR_H_ #define CHROME_BROWSER_SYNC_FILE_SYSTEM_REMOTE_CHANGE_PROCESSOR_H_ -#include "base/basictypes.h" #include "base/callback_forward.h" +#include "base/macros.h" #include "chrome/browser/sync_file_system/sync_callbacks.h" #include "chrome/browser/sync_file_system/sync_status_code.h" diff --git a/chrome/browser/sync_file_system/remote_file_sync_service.h b/chrome/browser/sync_file_system/remote_file_sync_service.h index edb729a..042d524 100644 --- a/chrome/browser/sync_file_system/remote_file_sync_service.h +++ b/chrome/browser/sync_file_system/remote_file_sync_service.h @@ -5,12 +5,14 @@ #ifndef CHROME_BROWSER_SYNC_FILE_SYSTEM_REMOTE_FILE_SYNC_SERVICE_H_ #define CHROME_BROWSER_SYNC_FILE_SYSTEM_REMOTE_FILE_SYNC_SERVICE_H_ +#include <stdint.h> + #include <map> #include <set> #include <string> #include <vector> -#include "base/basictypes.h" +#include "base/macros.h" #include "base/memory/scoped_ptr.h" #include "chrome/browser/sync_file_system/conflict_resolution_policy.h" #include "chrome/browser/sync_file_system/sync_callbacks.h" @@ -92,7 +94,7 @@ class RemoteFileSyncService { // |pending_changes_hint| indicates the pending queue length to help sync // scheduling but the value may not be accurately reflect the real-time // value. - virtual void OnRemoteChangeQueueUpdated(int64 pending_changes_hint) = 0; + virtual void OnRemoteChangeQueueUpdated(int64_t pending_changes_hint) = 0; // This is called when RemoteFileSyncService updates its state. virtual void OnRemoteServiceStateUpdated( diff --git a/chrome/browser/sync_file_system/subtree_set.h b/chrome/browser/sync_file_system/subtree_set.h index bf28602..9bd2961 100644 --- a/chrome/browser/sync_file_system/subtree_set.h +++ b/chrome/browser/sync_file_system/subtree_set.h @@ -5,6 +5,8 @@ #ifndef CHROME_BROWSER_SYNC_FILE_SYSTEM_SUBTREE_SET_H_ #define CHROME_BROWSER_SYNC_FILE_SYSTEM_SUBTREE_SET_H_ +#include <stddef.h> + #include "base/containers/hash_tables.h" #include "base/files/file_path.h" diff --git a/chrome/browser/sync_file_system/sync_event_observer.h b/chrome/browser/sync_file_system/sync_event_observer.h index b6e8010..965d26b 100644 --- a/chrome/browser/sync_file_system/sync_event_observer.h +++ b/chrome/browser/sync_file_system/sync_event_observer.h @@ -7,6 +7,7 @@ #include <string> +#include "base/macros.h" #include "chrome/browser/sync_file_system/file_status_observer.h" #include "chrome/browser/sync_file_system/sync_service_state.h" diff --git a/chrome/browser/sync_file_system/sync_file_metadata.cc b/chrome/browser/sync_file_system/sync_file_metadata.cc index 42b5735..c5b267d 100644 --- a/chrome/browser/sync_file_system/sync_file_metadata.cc +++ b/chrome/browser/sync_file_system/sync_file_metadata.cc @@ -13,14 +13,10 @@ SyncFileMetadata::SyncFileMetadata() size(-1) { } -SyncFileMetadata::SyncFileMetadata( - SyncFileType file_type, - int64 size, - const base::Time& last_modified) - : file_type(file_type), - size(size), - last_modified(last_modified) { -} +SyncFileMetadata::SyncFileMetadata(SyncFileType file_type, + int64_t size, + const base::Time& last_modified) + : file_type(file_type), size(size), last_modified(last_modified) {} SyncFileMetadata::~SyncFileMetadata() {} diff --git a/chrome/browser/sync_file_system/sync_file_metadata.h b/chrome/browser/sync_file_system/sync_file_metadata.h index 7e3e631..d382183c 100644 --- a/chrome/browser/sync_file_system/sync_file_metadata.h +++ b/chrome/browser/sync_file_system/sync_file_metadata.h @@ -5,7 +5,8 @@ #ifndef CHROME_BROWSER_SYNC_FILE_SYSTEM_SYNC_FILE_METADATA_H_ #define CHROME_BROWSER_SYNC_FILE_SYSTEM_SYNC_FILE_METADATA_H_ -#include "base/basictypes.h" +#include <stdint.h> + #include "base/time/time.h" #include "chrome/browser/sync_file_system/file_change.h" #include "storage/browser/fileapi/file_system_url.h" @@ -16,12 +17,12 @@ class SyncFileMetadata { public: SyncFileMetadata(); SyncFileMetadata(SyncFileType file_type, - int64 size, + int64_t size, const base::Time& last_modified); ~SyncFileMetadata(); SyncFileType file_type; - int64 size; + int64_t size; base::Time last_modified; bool operator==(const SyncFileMetadata& that) const; diff --git a/chrome/browser/sync_file_system/sync_file_system_service.cc b/chrome/browser/sync_file_system/sync_file_system_service.cc index 804eccf..8a74b0a 100644 --- a/chrome/browser/sync_file_system/sync_file_system_service.cc +++ b/chrome/browser/sync_file_system/sync_file_system_service.cc @@ -4,11 +4,15 @@ #include "chrome/browser/sync_file_system/sync_file_system_service.h" +#include <stddef.h> +#include <stdint.h> + #include <string> #include "base/bind.h" #include "base/format_macros.h" #include "base/logging.h" +#include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/metrics/histogram.h" #include "base/single_thread_task_runner.h" @@ -157,7 +161,7 @@ class LocalSyncRunner : public SyncProcessRunner, } // LocalFileSyncService::Observer overrides. - void OnLocalChangeAvailable(int64 pending_changes) override { + void OnLocalChangeAvailable(int64_t pending_changes) override { DCHECK_CURRENTLY_ON(BrowserThread::UI); OnChangesUpdated(pending_changes); @@ -207,7 +211,7 @@ class RemoteSyncRunner : public SyncProcessRunner, } // RemoteFileSyncService::Observer overrides. - void OnRemoteChangeQueueUpdated(int64 pending_changes) override { + void OnRemoteChangeQueueUpdated(int64_t pending_changes) override { DCHECK_CURRENTLY_ON(BrowserThread::UI); OnChangesUpdated(pending_changes); @@ -365,7 +369,7 @@ void SyncFileSystemService::OnSyncIdle() { base::Bind(&SyncFileSystemService::OnPromotionCompleted, AsWeakPtr(), base::Owned(job_count)); - int64 remote_changes = 0; + int64_t remote_changes = 0; for (size_t i = 0; i < remote_sync_runners_.size(); ++i) remote_changes += remote_sync_runners_[i]->pending_changes(); if (remote_changes == 0) { @@ -373,7 +377,7 @@ void SyncFileSystemService::OnSyncIdle() { local_service_->PromoteDemotedChanges(promote_completion_callback); } - int64 local_changes = 0; + int64_t local_changes = 0; for (size_t i = 0; i < local_sync_runners_.size(); ++i) local_changes += local_sync_runners_[i]->pending_changes(); if (local_changes == 0) { diff --git a/chrome/browser/sync_file_system/sync_file_system_service.h b/chrome/browser/sync_file_system/sync_file_system_service.h index 7bbea9d..c81a253 100644 --- a/chrome/browser/sync_file_system/sync_file_system_service.h +++ b/chrome/browser/sync_file_system/sync_file_system_service.h @@ -9,8 +9,8 @@ #include <memory> #include <string> -#include "base/basictypes.h" #include "base/callback_forward.h" +#include "base/macros.h" #include "base/memory/scoped_ptr.h" #include "base/memory/scoped_vector.h" #include "base/memory/weak_ptr.h" diff --git a/chrome/browser/sync_file_system/sync_file_system_service_factory.h b/chrome/browser/sync_file_system/sync_file_system_service_factory.h index 88de867..fa7341c 100644 --- a/chrome/browser/sync_file_system/sync_file_system_service_factory.h +++ b/chrome/browser/sync_file_system/sync_file_system_service_factory.h @@ -5,7 +5,6 @@ #ifndef CHROME_BROWSER_SYNC_FILE_SYSTEM_SYNC_FILE_SYSTEM_SERVICE_FACTORY_H_ #define CHROME_BROWSER_SYNC_FILE_SYSTEM_SYNC_FILE_SYSTEM_SERVICE_FACTORY_H_ -#include "base/basictypes.h" #include "base/memory/scoped_ptr.h" #include "base/memory/singleton.h" #include "components/keyed_service/content/browser_context_keyed_service_factory.h" diff --git a/chrome/browser/sync_file_system/sync_file_system_service_unittest.cc b/chrome/browser/sync_file_system/sync_file_system_service_unittest.cc index ddf32d0..5c61fe1 100644 --- a/chrome/browser/sync_file_system/sync_file_system_service_unittest.cc +++ b/chrome/browser/sync_file_system/sync_file_system_service_unittest.cc @@ -2,9 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include <stddef.h> + #include <vector> -#include "base/basictypes.h" #include "base/bind.h" #include "base/run_loop.h" #include "base/single_thread_task_runner.h" diff --git a/chrome/browser/sync_file_system/sync_process_runner.cc b/chrome/browser/sync_file_system/sync_process_runner.cc index 619a6bd..42078fd 100644 --- a/chrome/browser/sync_file_system/sync_process_runner.cc +++ b/chrome/browser/sync_file_system/sync_process_runner.cc @@ -5,19 +5,20 @@ #include "chrome/browser/sync_file_system/sync_process_runner.h" #include "base/format_macros.h" +#include "base/macros.h" #include "chrome/browser/sync_file_system/logger.h" namespace sync_file_system { -const int64 SyncProcessRunner::kSyncDelayInMilliseconds = - 1 * base::Time::kMillisecondsPerSecond; // 1 sec -const int64 SyncProcessRunner::kSyncDelayWithSyncError = - 3 * base::Time::kMillisecondsPerSecond; // 3 sec -const int64 SyncProcessRunner::kSyncDelayFastInMilliseconds = 100; // 100 ms +const int64_t SyncProcessRunner::kSyncDelayInMilliseconds = + 1 * base::Time::kMillisecondsPerSecond; // 1 sec +const int64_t SyncProcessRunner::kSyncDelayWithSyncError = + 3 * base::Time::kMillisecondsPerSecond; // 3 sec +const int64_t SyncProcessRunner::kSyncDelayFastInMilliseconds = 100; // 100 ms const int SyncProcessRunner::kPendingChangeThresholdForFastSync = 10; -const int64 SyncProcessRunner::kSyncDelaySlowInMilliseconds = +const int64_t SyncProcessRunner::kSyncDelaySlowInMilliseconds = 30 * base::Time::kMillisecondsPerSecond; // 30 sec -const int64 SyncProcessRunner::kSyncDelayMaxInMilliseconds = +const int64_t SyncProcessRunner::kSyncDelayMaxInMilliseconds = 30 * 60 * base::Time::kMillisecondsPerSecond; // 30 min namespace { @@ -111,7 +112,7 @@ void SyncProcessRunner::Schedule() { ScheduleInternal(kSyncDelayMaxInMilliseconds); } -void SyncProcessRunner::ThrottleSync(int64 base_delay) { +void SyncProcessRunner::ThrottleSync(int64_t base_delay) { base::TimeTicks now = timer_helper_->Now(); base::TimeDelta elapsed = std::min(now, throttle_until_) - throttle_from_; DCHECK(base::TimeDelta() <= elapsed); @@ -145,10 +146,9 @@ SyncServiceState SyncProcessRunner::GetServiceState() { return client_->GetSyncServiceState(); } -void SyncProcessRunner::OnChangesUpdated( - int64 pending_changes) { +void SyncProcessRunner::OnChangesUpdated(int64_t pending_changes) { DCHECK_GE(pending_changes, 0); - int64 old_pending_changes = pending_changes_; + int64_t old_pending_changes = pending_changes_; pending_changes_ = pending_changes; if (old_pending_changes != pending_changes) { CheckIfIdle(); @@ -203,7 +203,7 @@ void SyncProcessRunner::Run() { Schedule(); } -void SyncProcessRunner::ScheduleInternal(int64 delay) { +void SyncProcessRunner::ScheduleInternal(int64_t delay) { base::TimeTicks now = timer_helper_->Now(); base::TimeTicks next_scheduled; diff --git a/chrome/browser/sync_file_system/sync_process_runner.h b/chrome/browser/sync_file_system/sync_process_runner.h index 118ca70..80be8d5 100644 --- a/chrome/browser/sync_file_system/sync_process_runner.h +++ b/chrome/browser/sync_file_system/sync_process_runner.h @@ -5,9 +5,12 @@ #ifndef CHROME_BROWSER_SYNC_FILE_SYSTEM_SYNC_PROCESS_RUNNER_H_ #define CHROME_BROWSER_SYNC_FILE_SYSTEM_SYNC_PROCESS_RUNNER_H_ +#include <stddef.h> +#include <stdint.h> + #include <string> -#include "base/basictypes.h" +#include "base/macros.h" #include "base/memory/weak_ptr.h" #include "base/timer/timer.h" #include "chrome/browser/sync_file_system/sync_callbacks.h" @@ -26,22 +29,22 @@ class SyncFileSystemService; class SyncProcessRunner { public: // Default delay when more changes are available. - static const int64 kSyncDelayInMilliseconds; + static const int64_t kSyncDelayInMilliseconds; // Default delay when the previous change has had an error (but remote service // is running). - static const int64 kSyncDelayWithSyncError; + static const int64_t kSyncDelayWithSyncError; // Default delay when there're more than 10 pending changes. - static const int64 kSyncDelayFastInMilliseconds; + static const int64_t kSyncDelayFastInMilliseconds; static const int kPendingChangeThresholdForFastSync; // Default delay when remote service is temporarily unavailable. // The delay backs off exponentially from initial value on repeated failure. - static const int64 kSyncDelaySlowInMilliseconds; + static const int64_t kSyncDelaySlowInMilliseconds; // Default delay when there're no changes. - static const int64 kSyncDelayMaxInMilliseconds; + static const int64_t kSyncDelayMaxInMilliseconds; class Client { public: @@ -76,24 +79,24 @@ class SyncProcessRunner { // Schedules a new sync. void Schedule(); - int64 pending_changes() const { return pending_changes_; } + int64_t pending_changes() const { return pending_changes_; } // Returns the current service state. Default implementation returns // sync_service()->GetSyncServiceState(). virtual SyncServiceState GetServiceState(); protected: - void OnChangesUpdated(int64 pending_changes); + void OnChangesUpdated(int64_t pending_changes); SyncFileSystemService* GetSyncService(); private: void Finished(const base::TimeTicks& start_time, SyncStatusCode status); void Run(); - void ScheduleInternal(int64 delay); + void ScheduleInternal(int64_t delay); // Throttles new sync for |base_delay| milliseconds for an error case. // If new sync is already throttled, back off the duration. - void ThrottleSync(int64 base_delay); + void ThrottleSync(int64_t base_delay); // Clears old throttling setting that is already over. void ResetOldThrottling(); @@ -113,7 +116,7 @@ class SyncProcessRunner { base::TimeTicks throttle_from_; base::TimeTicks throttle_until_; - int64 pending_changes_; + int64_t pending_changes_; base::WeakPtrFactory<SyncProcessRunner> factory_; DISALLOW_COPY_AND_ASSIGN(SyncProcessRunner); diff --git a/chrome/browser/sync_file_system/sync_process_runner_unittest.cc b/chrome/browser/sync_file_system/sync_process_runner_unittest.cc index a1bd4b7..d123142 100644 --- a/chrome/browser/sync_file_system/sync_process_runner_unittest.cc +++ b/chrome/browser/sync_file_system/sync_process_runner_unittest.cc @@ -4,8 +4,12 @@ #include "chrome/browser/sync_file_system/sync_process_runner.h" +#include <stddef.h> +#include <stdint.h> + #include <queue> +#include "base/macros.h" #include "base/memory/scoped_ptr.h" #include "testing/gtest/include/gtest/gtest.h" @@ -62,7 +66,7 @@ class FakeTimerHelper : public SyncProcessRunner::TimerHelper { SetCurrentTime(scheduled_time_); } - int64 GetCurrentDelay() { + int64_t GetCurrentDelay() { EXPECT_FALSE(timer_task_.is_null()); return (scheduled_time_ - current_time_).InMilliseconds(); } diff --git a/chrome/browser/sync_file_system/task_logger.cc b/chrome/browser/sync_file_system/task_logger.cc index 8d8c585..437a689 100644 --- a/chrome/browser/sync_file_system/task_logger.cc +++ b/chrome/browser/sync_file_system/task_logger.cc @@ -4,6 +4,8 @@ #include "chrome/browser/sync_file_system/task_logger.h" +#include <stddef.h> + #include "base/lazy_instance.h" #include "base/stl_util.h" #include "base/synchronization/lock.h" diff --git a/chrome/browser/sync_file_system/task_logger.h b/chrome/browser/sync_file_system/task_logger.h index 089bd65..1021c3a 100644 --- a/chrome/browser/sync_file_system/task_logger.h +++ b/chrome/browser/sync_file_system/task_logger.h @@ -9,6 +9,7 @@ #include <string> #include <vector> +#include "base/macros.h" #include "base/memory/scoped_ptr.h" #include "base/memory/weak_ptr.h" #include "base/observer_list.h" |
