diff options
author | avi <avi@chromium.org> | 2015-12-22 14:35:00 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-12-22 22:36:00 +0000 |
commit | b32eea9bd3e6f79bd3ba15ca0299ccc579d68417 (patch) | |
tree | 7be0cd346a9e4f7e6b026310d5cd3d6cc66bb1af /google_apis | |
parent | 56240dfe17e12cdf54b302d6ed74bcc677bd785e (diff) | |
download | chromium_src-b32eea9bd3e6f79bd3ba15ca0299ccc579d68417.zip chromium_src-b32eea9bd3e6f79bd3ba15ca0299ccc579d68417.tar.gz chromium_src-b32eea9bd3e6f79bd3ba15ca0299ccc579d68417.tar.bz2 |
Switch to standard integer types in google_apis/.
BUG=138542
TBR=rogerta@chromium.org
NOPRESUBMIT=true
Review URL: https://codereview.chromium.org/1548673002
Cr-Commit-Position: refs/heads/master@{#366670}
Diffstat (limited to 'google_apis')
96 files changed, 520 insertions, 400 deletions
diff --git a/google_apis/drive/auth_service.cc b/google_apis/drive/auth_service.cc index 0fbc132..234536c 100644 --- a/google_apis/drive/auth_service.cc +++ b/google_apis/drive/auth_service.cc @@ -9,6 +9,7 @@ #include "base/bind.h" #include "base/location.h" +#include "base/macros.h" #include "base/message_loop/message_loop.h" #include "base/metrics/histogram.h" #include "google_apis/drive/auth_service_observer.h" diff --git a/google_apis/drive/auth_service.h b/google_apis/drive/auth_service.h index 9ce6abc..55f112d 100644 --- a/google_apis/drive/auth_service.h +++ b/google_apis/drive/auth_service.h @@ -8,6 +8,7 @@ #include <string> #include <vector> +#include "base/macros.h" #include "base/memory/weak_ptr.h" #include "base/observer_list.h" #include "base/threading/thread_checker.h" diff --git a/google_apis/drive/base_requests.cc b/google_apis/drive/base_requests.cc index 18846cb..a198138 100644 --- a/google_apis/drive/base_requests.cc +++ b/google_apis/drive/base_requests.cc @@ -4,10 +4,13 @@ #include "google_apis/drive/base_requests.h" +#include <stddef.h> + #include "base/files/file_util.h" #include "base/json/json_reader.h" #include "base/json/json_writer.h" #include "base/location.h" +#include "base/macros.h" #include "base/rand_util.h" #include "base/sequenced_task_runner.h" #include "base/strings/string_number_conversions.h" @@ -218,7 +221,7 @@ void GenerateMultipartBody(MultipartType multipart_type, const std::string& predetermined_boundary, const std::vector<ContentTypeAndData>& parts, ContentTypeAndData* output, - std::vector<uint64>* data_offset) { + std::vector<uint64_t>* data_offset) { std::string boundary; // Generate random boundary. if (predetermined_boundary.empty()) { @@ -450,8 +453,8 @@ void UrlFetchRequestBase::StartAfterPrepare( url_fetcher_->SetUploadData(upload_content_type, upload_content); } else { base::FilePath local_file_path; - int64 range_offset = 0; - int64 range_length = 0; + int64_t range_offset = 0; + int64_t range_length = 0; if (GetContentFile(&local_file_path, &range_offset, &range_length, &upload_content_type)) { url_fetcher_->SetUploadFilePath( @@ -492,8 +495,8 @@ bool UrlFetchRequestBase::GetContentData(std::string* upload_content_type, } bool UrlFetchRequestBase::GetContentFile(base::FilePath* local_file_path, - int64* range_offset, - int64* range_length, + int64_t* range_offset, + int64_t* range_length, std::string* upload_content_type) { return false; } @@ -600,7 +603,7 @@ InitiateUploadRequestBase::InitiateUploadRequestBase( RequestSender* sender, const InitiateUploadCallback& callback, const std::string& content_type, - int64 content_length) + int64_t content_length) : UrlFetchRequestBase(sender), callback_(callback), content_type_(content_type), @@ -651,12 +654,11 @@ UploadRangeResponse::UploadRangeResponse() } UploadRangeResponse::UploadRangeResponse(DriveApiErrorCode code, - int64 start_position_received, - int64 end_position_received) + int64_t start_position_received, + int64_t end_position_received) : code(code), start_position_received(start_position_received), - end_position_received(end_position_received) { -} + end_position_received(end_position_received) {} UploadRangeResponse::~UploadRangeResponse() { } @@ -692,8 +694,8 @@ void UploadRangeRequestBase::ProcessURLFetchResults( // The Range header is appeared only if there is at least one received // byte. So, initialize the positions by 0 so that the [0,0) will be // returned via the |callback_| for empty data case. - int64 start_position_received = 0; - int64 end_position_received = 0; + int64_t start_position_received = 0; + int64_t end_position_received = 0; std::string range_received; hdrs->EnumerateHeader(NULL, kUploadResponseRange, &range_received); if (!range_received.empty()) { // Parse the range header. @@ -755,9 +757,9 @@ void UploadRangeRequestBase::RunCallbackOnPrematureFailure( ResumeUploadRequestBase::ResumeUploadRequestBase( RequestSender* sender, const GURL& upload_location, - 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) : UploadRangeRequestBase(sender, upload_location), @@ -798,11 +800,10 @@ ResumeUploadRequestBase::GetExtraRequestHeaders() const { return headers; } -bool ResumeUploadRequestBase::GetContentFile( - base::FilePath* local_file_path, - int64* range_offset, - int64* range_length, - std::string* upload_content_type) { +bool ResumeUploadRequestBase::GetContentFile(base::FilePath* local_file_path, + int64_t* range_offset, + int64_t* range_length, + std::string* upload_content_type) { if (start_position_ == end_position_) { // No content data. return false; @@ -819,7 +820,7 @@ bool ResumeUploadRequestBase::GetContentFile( GetUploadStatusRequestBase::GetUploadStatusRequestBase(RequestSender* sender, const GURL& upload_url, - int64 content_length) + int64_t content_length) : UploadRangeRequestBase(sender, upload_url), content_length_(content_length) {} @@ -846,7 +847,7 @@ MultipartUploadRequestBase::MultipartUploadRequestBase( base::SequencedTaskRunner* blocking_task_runner, const std::string& metadata_json, const std::string& content_type, - int64 content_length, + int64_t content_length, const base::FilePath& local_file_path, const FileResourceCallback& callback, const ProgressCallback& progress_callback) @@ -939,8 +940,8 @@ void MultipartUploadRequestBase::NotifyError(DriveApiErrorCode code) { void MultipartUploadRequestBase::NotifyUploadProgress( const net::URLFetcher* source, - int64 current, - int64 total) { + int64_t current, + int64_t total) { if (!progress_callback_.is_null()) progress_callback_.Run(current, total); } @@ -994,8 +995,8 @@ void DownloadFileRequestBase::GetOutputFilePath( void DownloadFileRequestBase::OnURLFetchDownloadProgress( const URLFetcher* source, - int64 current, - int64 total) { + int64_t current, + int64_t total) { if (!progress_callback_.is_null()) progress_callback_.Run(current, total); } diff --git a/google_apis/drive/base_requests.h b/google_apis/drive/base_requests.h index ac64a54..f9e4f1d 100644 --- a/google_apis/drive/base_requests.h +++ b/google_apis/drive/base_requests.h @@ -8,11 +8,14 @@ #ifndef GOOGLE_APIS_DRIVE_BASE_REQUESTS_H_ #define GOOGLE_APIS_DRIVE_BASE_REQUESTS_H_ +#include <stdint.h> + #include <string> #include <vector> #include "base/callback.h" #include "base/files/file_path.h" +#include "base/macros.h" #include "base/memory/weak_ptr.h" #include "base/threading/thread_checker.h" #include "google_apis/drive/drive_api_error_codes.h" @@ -51,7 +54,7 @@ typedef base::Callback<void(DriveApiErrorCode error, FileResourceCallback; // Callback used for DownloadFileRequest and ResumeUploadRequestBase. -typedef base::Callback<void(int64 progress, int64 total)> ProgressCallback; +typedef base::Callback<void(int64_t progress, int64_t total)> ProgressCallback; // Callback used to get the content from DownloadFileRequest. typedef base::Callback<void( @@ -69,7 +72,7 @@ void GenerateMultipartBody(MultipartType multipart_type, const std::string& predetermined_boundary, const std::vector<ContentTypeAndData>& parts, ContentTypeAndData* output, - std::vector<uint64>* data_offset); + std::vector<uint64_t>* data_offset); //======================= AuthenticatedRequestInterface ====================== @@ -192,8 +195,8 @@ class UrlFetchRequestBase : public AuthenticatedRequestInterface, // uploaded. // Note that this and GetContentData() cannot be used together. virtual bool GetContentFile(base::FilePath* local_file_path, - int64* range_offset, - int64* range_length, + int64_t* range_offset, + int64_t* range_length, std::string* upload_content_type); // Used by a derived class to set an output file path if they want to save @@ -292,8 +295,8 @@ class BatchableDelegate { // Notifies progress. virtual void NotifyUploadProgress(const net::URLFetcher* source, - int64 current, - int64 total) = 0; + int64_t current, + int64_t total) = 0; }; //============================ EntryActionRequest ============================ @@ -348,7 +351,7 @@ class InitiateUploadRequestBase : public UrlFetchRequestBase { InitiateUploadRequestBase(RequestSender* sender, const InitiateUploadCallback& callback, const std::string& content_type, - int64 content_length); + int64_t content_length); ~InitiateUploadRequestBase() override; // UrlFetchRequestBase overrides. @@ -359,7 +362,7 @@ class InitiateUploadRequestBase : public UrlFetchRequestBase { private: const InitiateUploadCallback callback_; const std::string content_type_; - const int64 content_length_; + const int64_t content_length_; DISALLOW_COPY_AND_ASSIGN(InitiateUploadRequestBase); }; @@ -370,8 +373,8 @@ class InitiateUploadRequestBase : public UrlFetchRequestBase { struct UploadRangeResponse { UploadRangeResponse(); UploadRangeResponse(DriveApiErrorCode code, - int64 start_position_received, - int64 end_position_received); + int64_t start_position_received, + int64_t end_position_received); ~UploadRangeResponse(); DriveApiErrorCode code; @@ -381,8 +384,8 @@ struct UploadRangeResponse { // |start_position_received| is inclusive and |end_position_received| is // exclusive to follow the common C++ manner, although the response from // the server has "Range" header in inclusive format at both sides. - int64 start_position_received; - int64 end_position_received; + int64_t start_position_received; + int64_t end_position_received; }; // Base class for a URL fetch request expecting the response containing the @@ -454,9 +457,9 @@ class ResumeUploadRequestBase : public UploadRangeRequestBase { // meaning. ResumeUploadRequestBase(RequestSender* sender, const GURL& upload_location, - 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); ~ResumeUploadRequestBase() override; @@ -464,15 +467,15 @@ class ResumeUploadRequestBase : public UploadRangeRequestBase { // UrlFetchRequestBase overrides. std::vector<std::string> GetExtraRequestHeaders() const override; bool GetContentFile(base::FilePath* local_file_path, - int64* range_offset, - int64* range_length, + int64_t* range_offset, + int64_t* range_length, std::string* upload_content_type) override; private: // The parameters for the request. See ResumeUploadParams for the details. - const int64 start_position_; - const int64 end_position_; - const int64 content_length_; + const int64_t start_position_; + const int64_t end_position_; + const int64_t content_length_; const std::string content_type_; const base::FilePath local_file_path_; @@ -496,7 +499,7 @@ class GetUploadStatusRequestBase : public UploadRangeRequestBase { // parameters. GetUploadStatusRequestBase(RequestSender* sender, const GURL& upload_url, - int64 content_length); + int64_t content_length); ~GetUploadStatusRequestBase() override; protected: @@ -504,7 +507,7 @@ class GetUploadStatusRequestBase : public UploadRangeRequestBase { std::vector<std::string> GetExtraRequestHeaders() const override; private: - const int64 content_length_; + const int64_t content_length_; DISALLOW_COPY_AND_ASSIGN(GetUploadStatusRequestBase); }; @@ -526,7 +529,7 @@ class MultipartUploadRequestBase : public BatchableDelegate { MultipartUploadRequestBase(base::SequencedTaskRunner* blocking_task_runner, const std::string& metadata_json, const std::string& content_type, - int64 content_length, + int64_t content_length, const base::FilePath& local_file_path, const FileResourceCallback& callback, const ProgressCallback& progress_callback); @@ -542,8 +545,8 @@ class MultipartUploadRequestBase : public BatchableDelegate { const base::Closure& callback) override; void NotifyError(DriveApiErrorCode code) override; void NotifyUploadProgress(const net::URLFetcher* source, - int64 current, - int64 total) override; + int64_t current, + int64_t total) override; // Parses the response value and invokes |callback_| with |FileResource|. void OnDataParsed(DriveApiErrorCode code, const base::Closure& callback, @@ -626,8 +629,8 @@ class DownloadFileRequestBase : public UrlFetchRequestBase { // net::URLFetcherDelegate overrides. void OnURLFetchDownloadProgress(const net::URLFetcher* source, - int64 current, - int64 total) override; + int64_t current, + int64_t total) override; private: const DownloadActionCallback download_action_callback_; diff --git a/google_apis/drive/base_requests_unittest.cc b/google_apis/drive/base_requests_unittest.cc index c296c67..e5baf6c 100644 --- a/google_apis/drive/base_requests_unittest.cc +++ b/google_apis/drive/base_requests_unittest.cc @@ -4,6 +4,8 @@ #include "google_apis/drive/base_requests.h" +#include <stdint.h> + #include "base/bind.h" #include "base/memory/scoped_ptr.h" #include "base/message_loop/message_loop.h" @@ -58,7 +60,7 @@ class FakeMultipartUploadRequest : public MultipartUploadRequestBase { base::SequencedTaskRunner* blocking_task_runner, const std::string& metadata_json, const std::string& content_type, - int64 content_length, + int64_t content_length, const base::FilePath& local_file_path, const FileResourceCallback& callback, const google_apis::ProgressCallback& progress_callback, diff --git a/google_apis/drive/drive_api_parser.cc b/google_apis/drive/drive_api_parser.cc index 9eb00d2..ff08eb7 100644 --- a/google_apis/drive/drive_api_parser.cc +++ b/google_apis/drive/drive_api_parser.cc @@ -4,8 +4,10 @@ #include "google_apis/drive/drive_api_parser.h" -#include "base/basictypes.h" +#include <stddef.h> + #include "base/json/json_value_converter.h" +#include "base/macros.h" #include "base/memory/scoped_ptr.h" #include "base/strings/string_number_conversions.h" #include "base/strings/string_piece.h" @@ -17,7 +19,7 @@ namespace google_apis { namespace { -const int64 kUnsetFileSize = -1; +const int64_t kUnsetFileSize = -1; bool CreateFileResourceFromValue(const base::Value* value, scoped_ptr<FileResource>* file) { @@ -226,15 +228,14 @@ scoped_ptr<AboutResource> AboutResource::CreateFrom(const base::Value& value) { // static void AboutResource::RegisterJSONConverter( base::JSONValueConverter<AboutResource>* converter) { - converter->RegisterCustomField<int64>(kLargestChangeId, - &AboutResource::largest_change_id_, - &base::StringToInt64); - converter->RegisterCustomField<int64>(kQuotaBytesTotal, - &AboutResource::quota_bytes_total_, - &base::StringToInt64); - converter->RegisterCustomField<int64>( - kQuotaBytesUsedAggregate, - &AboutResource::quota_bytes_used_aggregate_, + converter->RegisterCustomField<int64_t>(kLargestChangeId, + &AboutResource::largest_change_id_, + &base::StringToInt64); + converter->RegisterCustomField<int64_t>(kQuotaBytesTotal, + &AboutResource::quota_bytes_total_, + &base::StringToInt64); + converter->RegisterCustomField<int64_t>( + kQuotaBytesUsedAggregate, &AboutResource::quota_bytes_used_aggregate_, &base::StringToInt64); converter->RegisterStringField(kRootFolderId, &AboutResource::root_folder_id_); @@ -459,9 +460,8 @@ void FileResource::RegisterJSONConverter( &util::GetTimeFromString); converter->RegisterBoolField(kShared, &FileResource::shared_); converter->RegisterStringField(kMd5Checksum, &FileResource::md5_checksum_); - converter->RegisterCustomField<int64>(kFileSize, - &FileResource::file_size_, - &base::StringToInt64); + converter->RegisterCustomField<int64_t>(kFileSize, &FileResource::file_size_, + &base::StringToInt64); converter->RegisterCustomField<GURL>(kAlternateLink, &FileResource::alternate_link_, GetGURLFromString); @@ -558,9 +558,8 @@ ChangeResource::~ChangeResource() {} // static void ChangeResource::RegisterJSONConverter( base::JSONValueConverter<ChangeResource>* converter) { - converter->RegisterCustomField<int64>(kId, - &ChangeResource::change_id_, - &base::StringToInt64); + converter->RegisterCustomField<int64_t>(kId, &ChangeResource::change_id_, + &base::StringToInt64); converter->RegisterStringField(kFileId, &ChangeResource::file_id_); converter->RegisterBoolField(kDeleted, &ChangeResource::deleted_); converter->RegisterCustomValueField(kFile, &ChangeResource::file_, @@ -603,9 +602,8 @@ void ChangeList::RegisterJSONConverter( converter->RegisterCustomField<GURL>(kNextLink, &ChangeList::next_link_, GetGURLFromString); - converter->RegisterCustomField<int64>(kLargestChangeId, - &ChangeList::largest_change_id_, - &base::StringToInt64); + converter->RegisterCustomField<int64_t>( + kLargestChangeId, &ChangeList::largest_change_id_, &base::StringToInt64); converter->RegisterRepeatedMessage<ChangeResource>(kItems, &ChangeList::items_); } diff --git a/google_apis/drive/drive_api_parser.h b/google_apis/drive/drive_api_parser.h index acbb93f..907b23b 100644 --- a/google_apis/drive/drive_api_parser.h +++ b/google_apis/drive/drive_api_parser.h @@ -5,10 +5,13 @@ #ifndef GOOGLE_APIS_DRIVE_DRIVE_API_PARSER_H_ #define GOOGLE_APIS_DRIVE_DRIVE_API_PARSER_H_ +#include <stdint.h> + #include <string> #include "base/compiler_specific.h" #include "base/gtest_prod_util.h" +#include "base/macros.h" #include "base/memory/scoped_ptr.h" #include "base/memory/scoped_vector.h" #include "base/strings/string_piece.h" @@ -44,23 +47,23 @@ class AboutResource { static scoped_ptr<AboutResource> CreateFrom(const base::Value& value); // Returns the largest change ID number. - int64 largest_change_id() const { return largest_change_id_; } + int64_t largest_change_id() const { return largest_change_id_; } // Returns total number of quota bytes. - int64 quota_bytes_total() const { return quota_bytes_total_; } + int64_t quota_bytes_total() const { return quota_bytes_total_; } // Returns the number of quota bytes used. - int64 quota_bytes_used_aggregate() const { + int64_t quota_bytes_used_aggregate() const { return quota_bytes_used_aggregate_; } // Returns root folder ID. const std::string& root_folder_id() const { return root_folder_id_; } - void set_largest_change_id(int64 largest_change_id) { + void set_largest_change_id(int64_t largest_change_id) { largest_change_id_ = largest_change_id; } - void set_quota_bytes_total(int64 quota_bytes_total) { + void set_quota_bytes_total(int64_t quota_bytes_total) { quota_bytes_total_ = quota_bytes_total; } - void set_quota_bytes_used_aggregate(int64 quota_bytes_used_aggregate) { + void set_quota_bytes_used_aggregate(int64_t quota_bytes_used_aggregate) { quota_bytes_used_aggregate_ = quota_bytes_used_aggregate; } void set_root_folder_id(const std::string& root_folder_id) { @@ -75,9 +78,9 @@ class AboutResource { // Return false if parsing fails. bool Parse(const base::Value& value); - int64 largest_change_id_; - int64 quota_bytes_total_; - int64 quota_bytes_used_aggregate_; + int64_t largest_change_id_; + int64_t quota_bytes_total_; + int64_t quota_bytes_used_aggregate_; std::string root_folder_id_; // This class is copyable on purpose. @@ -496,7 +499,7 @@ class FileResource { const std::string& md5_checksum() const { return md5_checksum_; } // Returns the size of this file in bytes. - int64 file_size() const { return file_size_; } + int64_t file_size() const { return file_size_; } // Return the link to open the file in Google editor or viewer. // E.g. Google Document, Google Spreadsheet. @@ -549,9 +552,7 @@ class FileResource { void set_md5_checksum(const std::string& md5_checksum) { md5_checksum_ = md5_checksum; } - void set_file_size(int64 file_size) { - file_size_ = file_size; - } + void set_file_size(int64_t file_size) { file_size_ = file_size; } void set_alternate_link(const GURL& alternate_link) { alternate_link_ = alternate_link; } @@ -584,7 +585,7 @@ class FileResource { base::Time shared_with_me_date_; bool shared_; std::string md5_checksum_; - int64 file_size_; + int64_t file_size_; GURL alternate_link_; GURL share_link_; std::vector<ParentReference> parents_; @@ -652,7 +653,7 @@ class ChangeResource { // Returns change ID for this change. This is a monotonically increasing // number. - int64 change_id() const { return change_id_; } + int64_t change_id() const { return change_id_; } // Returns a string file ID for corresponding file of the change. const std::string& file_id() const { return file_id_; } @@ -667,9 +668,7 @@ class ChangeResource { // Returns the time of this modification. const base::Time& modification_date() const { return modification_date_; } - void set_change_id(int64 change_id) { - change_id_ = change_id; - } + void set_change_id(int64_t change_id) { change_id_ = change_id; } void set_file_id(const std::string& file_id) { file_id_ = file_id; } @@ -691,7 +690,7 @@ class ChangeResource { // Return false if parsing fails. bool Parse(const base::Value& value); - int64 change_id_; + int64_t change_id_; std::string file_id_; bool deleted_; scoped_ptr<FileResource> file_; @@ -723,7 +722,7 @@ class ChangeList { const GURL& next_link() const { return next_link_; } // Returns the largest change ID number. - int64 largest_change_id() const { return largest_change_id_; } + int64_t largest_change_id() const { return largest_change_id_; } // Returns a set of changes in this list. const ScopedVector<ChangeResource>& items() const { return items_; } @@ -732,7 +731,7 @@ class ChangeList { void set_next_link(const GURL& next_link) { next_link_ = next_link; } - void set_largest_change_id(int64 largest_change_id) { + void set_largest_change_id(int64_t largest_change_id) { largest_change_id_ = largest_change_id; } @@ -745,7 +744,7 @@ class ChangeList { bool Parse(const base::Value& value); GURL next_link_; - int64 largest_change_id_; + int64_t largest_change_id_; ScopedVector<ChangeResource> items_; DISALLOW_COPY_AND_ASSIGN(ChangeList); diff --git a/google_apis/drive/drive_api_requests.cc b/google_apis/drive/drive_api_requests.cc index 68b12de..a14210e 100644 --- a/google_apis/drive/drive_api_requests.cc +++ b/google_apis/drive/drive_api_requests.cc @@ -4,6 +4,8 @@ #include "google_apis/drive/drive_api_requests.h" +#include <stddef.h> + #include "base/bind.h" #include "base/callback.h" #include "base/json/json_writer.h" @@ -801,18 +803,14 @@ InitiateUploadNewFileRequest::InitiateUploadNewFileRequest( RequestSender* sender, const DriveApiUrlGenerator& url_generator, const std::string& content_type, - int64 content_length, + int64_t content_length, const std::string& parent_resource_id, const std::string& title, const InitiateUploadCallback& callback) - : InitiateUploadRequestBase(sender, - callback, - content_type, - content_length), + : InitiateUploadRequestBase(sender, callback, content_type, content_length), url_generator_(url_generator), parent_resource_id_(parent_resource_id), - title_(title) { -} + title_(title) {} InitiateUploadNewFileRequest::~InitiateUploadNewFileRequest() {} @@ -860,18 +858,14 @@ InitiateUploadExistingFileRequest::InitiateUploadExistingFileRequest( RequestSender* sender, const DriveApiUrlGenerator& url_generator, const std::string& content_type, - int64 content_length, + int64_t content_length, const std::string& resource_id, const std::string& etag, const InitiateUploadCallback& callback) - : InitiateUploadRequestBase(sender, - callback, - content_type, - content_length), + : InitiateUploadRequestBase(sender, callback, content_type, content_length), url_generator_(url_generator), resource_id_(resource_id), - etag_(etag) { -} + etag_(etag) {} InitiateUploadExistingFileRequest::~InitiateUploadExistingFileRequest() {} @@ -930,9 +924,9 @@ bool InitiateUploadExistingFileRequest::GetContentData( ResumeUploadRequest::ResumeUploadRequest( RequestSender* sender, const GURL& upload_location, - 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 UploadRangeCallback& callback, @@ -959,7 +953,9 @@ void ResumeUploadRequest::OnRangeRequestComplete( } void ResumeUploadRequest::OnURLFetchUploadProgress( - const net::URLFetcher* source, int64 current, int64 total) { + const net::URLFetcher* source, + int64_t current, + int64_t total) { if (!progress_callback_.is_null()) progress_callback_.Run(current, total); } @@ -969,11 +965,9 @@ void ResumeUploadRequest::OnURLFetchUploadProgress( GetUploadStatusRequest::GetUploadStatusRequest( RequestSender* sender, const GURL& upload_url, - int64 content_length, + int64_t content_length, const UploadRangeCallback& callback) - : GetUploadStatusRequestBase(sender, - upload_url, - content_length), + : GetUploadStatusRequestBase(sender, upload_url, content_length), callback_(callback) { DCHECK(!callback.is_null()); } @@ -994,7 +988,7 @@ MultipartUploadNewFileDelegate::MultipartUploadNewFileDelegate( const std::string& title, const std::string& parent_resource_id, const std::string& content_type, - int64 content_length, + int64_t content_length, const base::Time& modified_date, const base::Time& last_viewed_by_me_date, const base::FilePath& local_file_path, @@ -1015,8 +1009,7 @@ MultipartUploadNewFileDelegate::MultipartUploadNewFileDelegate( callback, progress_callback), has_modified_date_(!modified_date.is_null()), - url_generator_(url_generator) { -} + url_generator_(url_generator) {} MultipartUploadNewFileDelegate::~MultipartUploadNewFileDelegate() { } @@ -1038,7 +1031,7 @@ MultipartUploadExistingFileDelegate::MultipartUploadExistingFileDelegate( const std::string& resource_id, const std::string& parent_resource_id, const std::string& content_type, - int64 content_length, + int64_t content_length, const base::Time& modified_date, const base::Time& last_viewed_by_me_date, const base::FilePath& local_file_path, @@ -1062,8 +1055,7 @@ MultipartUploadExistingFileDelegate::MultipartUploadExistingFileDelegate( resource_id_(resource_id), etag_(etag), has_modified_date_(!modified_date.is_null()), - url_generator_(url_generator) { -} + url_generator_(url_generator) {} MultipartUploadExistingFileDelegate::~MultipartUploadExistingFileDelegate() { } @@ -1228,8 +1220,8 @@ void SingleBatchableDelegateRequest::RunCallbackOnPrematureFailure( void SingleBatchableDelegateRequest::OnURLFetchUploadProgress( const net::URLFetcher* source, - int64 current, - int64 total) { + int64_t current, + int64_t total) { delegate_->NotifyUploadProgress(source, current, total); } @@ -1327,7 +1319,7 @@ void BatchUploadRequest::MayCompletePrepare() { } // Build multipart body here. - int64 total_size = 0; + int64_t total_size = 0; std::vector<ContentTypeAndData> parts; for (auto& child : child_requests_) { std::string type; @@ -1367,7 +1359,7 @@ void BatchUploadRequest::MayCompletePrepare() { UMA_HISTOGRAM_MEMORY_KB(kUMADriveTotalFileSizeInBatchUpload, total_size / 1024); - std::vector<uint64> part_data_offset; + std::vector<uint64_t> part_data_offset; GenerateMultipartBody(MULTIPART_MIXED, boundary_, parts, &upload_content_, &part_data_offset); DCHECK(part_data_offset.size() == child_requests_.size()); @@ -1451,8 +1443,8 @@ void BatchUploadRequest::RunCallbackOnPrematureFailure(DriveApiErrorCode code) { } void BatchUploadRequest::OnURLFetchUploadProgress(const net::URLFetcher* source, - int64 current, - int64 total) { + int64_t current, + int64_t total) { for (auto child : child_requests_) { if (child->data_offset <= current && current <= child->data_offset + child->data_size) { diff --git a/google_apis/drive/drive_api_requests.h b/google_apis/drive/drive_api_requests.h index 7024144..b34f970 100644 --- a/google_apis/drive/drive_api_requests.h +++ b/google_apis/drive/drive_api_requests.h @@ -5,11 +5,14 @@ #ifndef GOOGLE_APIS_DRIVE_DRIVE_API_REQUESTS_H_ #define GOOGLE_APIS_DRIVE_DRIVE_API_REQUESTS_H_ +#include <stdint.h> + #include <string> #include <vector> #include "base/callback_forward.h" #include "base/location.h" +#include "base/macros.h" #include "base/memory/scoped_ptr.h" #include "base/sequenced_task_runner.h" #include "base/task_runner_util.h" @@ -636,8 +639,8 @@ class ChangesListRequest : public DriveApiDataRequest<ChangeList> { page_token_ = page_token; } - int64 start_change_id() const { return start_change_id_; } - void set_start_change_id(int64 start_change_id) { + int64_t start_change_id() const { return start_change_id_; } + void set_start_change_id(int64_t start_change_id) { start_change_id_ = start_change_id; } @@ -650,7 +653,7 @@ class ChangesListRequest : public DriveApiDataRequest<ChangeList> { bool include_deleted_; int max_results_; std::string page_token_; - int64 start_change_id_; + int64_t start_change_id_; DISALLOW_COPY_AND_ASSIGN(ChangesListRequest); }; @@ -818,7 +821,7 @@ class InitiateUploadNewFileRequest : public InitiateUploadRequestBase { InitiateUploadNewFileRequest(RequestSender* sender, const DriveApiUrlGenerator& url_generator, const std::string& content_type, - int64 content_length, + int64_t content_length, const std::string& parent_resource_id, const std::string& title, const InitiateUploadCallback& callback); @@ -873,7 +876,7 @@ class InitiateUploadExistingFileRequest : public InitiateUploadRequestBase { InitiateUploadExistingFileRequest(RequestSender* sender, const DriveApiUrlGenerator& url_generator, const std::string& content_type, - int64 content_length, + int64_t content_length, const std::string& resource_id, const std::string& etag, const InitiateUploadCallback& callback); @@ -937,9 +940,9 @@ class ResumeUploadRequest : public ResumeUploadRequestBase { // |callback| must not be null. |progress_callback| may be null. ResumeUploadRequest(RequestSender* sender, const GURL& upload_location, - 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 UploadRangeCallback& callback, @@ -952,8 +955,8 @@ class ResumeUploadRequest : public ResumeUploadRequestBase { scoped_ptr<base::Value> value) override; // content::UrlFetcherDelegate overrides. void OnURLFetchUploadProgress(const net::URLFetcher* source, - int64 current, - int64 total) override; + int64_t current, + int64_t total) override; private: const UploadRangeCallback callback_; @@ -971,7 +974,7 @@ class GetUploadStatusRequest : public GetUploadStatusRequestBase { // |callback| must not be null. GetUploadStatusRequest(RequestSender* sender, const GURL& upload_url, - int64 content_length, + int64_t content_length, const UploadRangeCallback& callback); ~GetUploadStatusRequest() override; @@ -999,7 +1002,7 @@ class MultipartUploadNewFileDelegate : public MultipartUploadRequestBase { const std::string& title, const std::string& parent_resource_id, const std::string& content_type, - int64 content_length, + int64_t content_length, const base::Time& modified_date, const base::Time& last_viewed_by_me_date, const base::FilePath& local_file_path, @@ -1036,7 +1039,7 @@ class MultipartUploadExistingFileDelegate : public MultipartUploadRequestBase { const std::string& resource_id, const std::string& parent_resource_id, const std::string& content_type, - int64 content_length, + int64_t content_length, const base::Time& modified_date, const base::Time& last_viewed_by_me_date, const base::FilePath& local_file_path, @@ -1148,8 +1151,8 @@ class SingleBatchableDelegateRequest : public UrlFetchRequestBase { void RunCallbackOnPrematureFailure(DriveApiErrorCode code) override; void ProcessURLFetchResults(const net::URLFetcher* source) override; void OnURLFetchUploadProgress(const net::URLFetcher* source, - int64 current, - int64 total) override; + int64_t current, + int64_t total) override; scoped_ptr<BatchableDelegate> delegate_; // Note: This should remain the last member so it'll be destroyed and @@ -1167,8 +1170,8 @@ class BatchUploadChildEntry { ~BatchUploadChildEntry(); scoped_ptr<BatchableDelegate> request; bool prepared; - int64 data_offset; - int64 data_size; + int64_t data_offset; + int64_t data_size; private: DISALLOW_COPY_AND_ASSIGN(BatchUploadChildEntry); @@ -1213,8 +1216,8 @@ class BatchUploadRequest : public UrlFetchRequestBase { // content::UrlFetcherDelegate overrides. void OnURLFetchUploadProgress(const net::URLFetcher* source, - int64 current, - int64 total) override; + int64_t current, + int64_t total) override; private: typedef void* RequestID; @@ -1246,7 +1249,7 @@ class BatchUploadRequest : public UrlFetchRequestBase { ContentTypeAndData upload_content_; // Last reported progress value. - int64 last_progress_value_; + int64_t last_progress_value_; // Note: This should remain the last member so it'll be destroyed and // invalidate its weak pointers before any other members are destroyed. diff --git a/google_apis/drive/drive_api_requests_unittest.cc b/google_apis/drive/drive_api_requests_unittest.cc index 4ac64e5..07feea4 100644 --- a/google_apis/drive/drive_api_requests_unittest.cc +++ b/google_apis/drive/drive_api_requests_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 <stddef.h> +#include <stdint.h> + #include "base/bind.h" #include "base/files/file_path.h" #include "base/files/file_util.h" @@ -92,18 +95,20 @@ class TestBatchableDelegate : public BatchableDelegate { closure.Run(); } void NotifyUploadProgress(const net::URLFetcher* source, - int64 current, - int64 total) override { + int64_t current, + int64_t total) override { progress_values_.push_back(current); } - const std::vector<int64>& progress_values() const { return progress_values_; } + const std::vector<int64_t>& progress_values() const { + return progress_values_; + } private: GURL url_; std::string content_type_; std::string content_data_; base::Closure callback_; - std::vector<int64> progress_values_; + std::vector<int64_t> progress_values_; }; void EmptyPreapreCallback(DriveApiErrorCode) { @@ -359,9 +364,9 @@ class DriveApiRequestsTest : public testing::Test { return scoped_ptr<net::test_server::HttpResponse>(); } - int64 length = 0; - int64 start_position = 0; - int64 end_position = 0; + int64_t length = 0; + int64_t start_position = 0; + int64_t end_position = 0; if (!test_util::ParseContentRangeHeader( iter->second, &start_position, &end_position, &length)) { // Invalid "Content-Range" value. @@ -488,8 +493,8 @@ class DriveApiRequestsTest : public testing::Test { } // These are for the current upload file status. - int64 received_bytes_; - int64 content_length_; + int64_t received_bytes_; + int64_t content_length_; }; TEST_F(DriveApiRequestsTest, DriveApiDataRequest_Fields) { @@ -1373,7 +1378,8 @@ TEST_F(DriveApiRequestsTest, UploadNewLargeFileRequest) { // Check the response. EXPECT_EQ(HTTP_RESUME_INCOMPLETE, response.code); EXPECT_EQ(0, response.start_position_received); - EXPECT_EQ(static_cast<int64>(end_position), response.end_position_received); + EXPECT_EQ(static_cast<int64_t>(end_position), + response.end_position_received); // Check the response by GetUploadStatusRequest. { @@ -1403,7 +1409,7 @@ TEST_F(DriveApiRequestsTest, UploadNewLargeFileRequest) { // Check the response. EXPECT_EQ(HTTP_RESUME_INCOMPLETE, response.code); EXPECT_EQ(0, response.start_position_received); - EXPECT_EQ(static_cast<int64>(end_position), + EXPECT_EQ(static_cast<int64_t>(end_position), response.end_position_received); } } diff --git a/google_apis/drive/drive_api_url_generator.cc b/google_apis/drive/drive_api_url_generator.cc index a097527..9fddeb6 100644 --- a/google_apis/drive/drive_api_url_generator.cc +++ b/google_apis/drive/drive_api_url_generator.cc @@ -194,7 +194,7 @@ GURL DriveApiUrlGenerator::GetFilesTrashUrl(const std::string& file_id) const { GURL DriveApiUrlGenerator::GetChangesListUrl(bool include_deleted, int max_results, const std::string& page_token, - int64 start_change_id) const { + int64_t start_change_id) const { DCHECK_GE(start_change_id, 0); GURL url = base_url_.Resolve(kDriveV2ChangelistUrl); diff --git a/google_apis/drive/drive_api_url_generator.h b/google_apis/drive/drive_api_url_generator.h index 67f402f..fabfe3d 100644 --- a/google_apis/drive/drive_api_url_generator.h +++ b/google_apis/drive/drive_api_url_generator.h @@ -5,8 +5,11 @@ #ifndef GOOGLE_APIS_DRIVE_DRIVE_API_URL_GENERATOR_H_ #define GOOGLE_APIS_DRIVE_DRIVE_API_URL_GENERATOR_H_ +#include <stdint.h> + #include <string> +#include "base/macros.h" #include "url/gurl.h" namespace google_apis { @@ -78,7 +81,7 @@ class DriveApiUrlGenerator { GURL GetChangesListUrl(bool include_deleted, int max_results, const std::string& page_token, - int64 start_change_id) const; + int64_t start_change_id) const; // Returns a URL to add a resource to a directory with |folder_id|. GURL GetChildrenInsertUrl(const std::string& folder_id) const; diff --git a/google_apis/drive/drive_api_url_generator_unittest.cc b/google_apis/drive/drive_api_url_generator_unittest.cc index 1240b24..3d63370 100644 --- a/google_apis/drive/drive_api_url_generator_unittest.cc +++ b/google_apis/drive/drive_api_url_generator_unittest.cc @@ -4,6 +4,10 @@ #include "google_apis/drive/drive_api_url_generator.h" +#include <stddef.h> +#include <stdint.h> + +#include "base/macros.h" #include "google_apis/drive/test_util.h" #include "testing/gtest/include/gtest/gtest.h" #include "url/gurl.h" @@ -201,7 +205,7 @@ TEST_F(DriveApiUrlGeneratorTest, GetChangesListUrl) { bool include_deleted; int max_results; const std::string page_token; - int64 start_change_id; + int64_t start_change_id; const std::string expected_query; }; const TestPattern kTestPatterns[] = { diff --git a/google_apis/drive/files_list_request_runner.h b/google_apis/drive/files_list_request_runner.h index fc416be..1266137 100644 --- a/google_apis/drive/files_list_request_runner.h +++ b/google_apis/drive/files_list_request_runner.h @@ -7,8 +7,8 @@ #include <string> -#include "base/basictypes.h" #include "base/callback_forward.h" +#include "base/macros.h" #include "base/memory/scoped_ptr.h" #include "base/memory/weak_ptr.h" #include "google_apis/drive/drive_api_requests.h" diff --git a/google_apis/drive/request_sender.h b/google_apis/drive/request_sender.h index 6ace797..9c845c1 100644 --- a/google_apis/drive/request_sender.h +++ b/google_apis/drive/request_sender.h @@ -8,8 +8,8 @@ #include <set> #include <string> -#include "base/basictypes.h" #include "base/callback_forward.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/google_apis/drive/test_util.cc b/google_apis/drive/test_util.cc index e588519..64216af 100644 --- a/google_apis/drive/test_util.cc +++ b/google_apis/drive/test_util.cc @@ -122,9 +122,9 @@ scoped_ptr<net::test_server::HttpResponse> HandleDownloadFileRequest( } bool ParseContentRangeHeader(const std::string& value, - int64* start_position, - int64* end_position, - int64* length) { + int64_t* start_position, + int64_t* end_position, + int64_t* length) { DCHECK(start_position); DCHECK(end_position); DCHECK(length); @@ -151,8 +151,8 @@ bool ParseContentRangeHeader(const std::string& value, } void AppendProgressCallbackResult(std::vector<ProgressInfo>* progress_values, - int64 progress, - int64 total) { + int64_t progress, + int64_t total) { progress_values->push_back(ProgressInfo(progress, total)); } diff --git a/google_apis/drive/test_util.h b/google_apis/drive/test_util.h index 4672f53..f959ad7 100644 --- a/google_apis/drive/test_util.h +++ b/google_apis/drive/test_util.h @@ -5,12 +5,16 @@ #ifndef GOOGLE_APIS_DRIVE_TEST_UTIL_H_ #define GOOGLE_APIS_DRIVE_TEST_UTIL_H_ +#include <stddef.h> +#include <stdint.h> + #include <string> #include <utility> #include <vector> #include "base/bind.h" #include "base/callback.h" +#include "base/macros.h" #include "base/memory/scoped_ptr.h" #include "base/memory/scoped_vector.h" #include "base/template_util.h" @@ -97,9 +101,9 @@ scoped_ptr<net::test_server::HttpResponse> HandleDownloadFileRequest( // "bytes <start_position>-<end_position>/<length>". // Returns true on success. bool ParseContentRangeHeader(const std::string& value, - int64* start_position, - int64* end_position, - int64* length); + int64_t* start_position, + int64_t* end_position, + int64_t* length); // Google API related code and Drive File System code work on asynchronous // architecture and return the results via callbacks. @@ -265,12 +269,12 @@ CreateCopyResultCallback(T1* out1, T2* out2, T3* out3, T4* out4) { internal::OutputParams<T1, T2, T3, T4>(out1, out2, out3, out4)); } -typedef std::pair<int64, int64> ProgressInfo; +typedef std::pair<int64_t, int64_t> ProgressInfo; // Helper utility for recording the results via ProgressCallback. void AppendProgressCallbackResult(std::vector<ProgressInfo>* progress_values, - int64 progress, - int64 total); + int64_t progress, + int64_t total); // Helper utility for recording the content via GetContentCallback. class TestGetContentCallback { diff --git a/google_apis/gaia/fake_gaia.h b/google_apis/gaia/fake_gaia.h index ef955de..10de8f6 100644 --- a/google_apis/gaia/fake_gaia.h +++ b/google_apis/gaia/fake_gaia.h @@ -9,8 +9,8 @@ #include <set> #include <string> -#include "base/basictypes.h" #include "base/callback.h" +#include "base/macros.h" #include "base/memory/scoped_ptr.h" #include "url/gurl.h" diff --git a/google_apis/gaia/fake_oauth2_token_service.h b/google_apis/gaia/fake_oauth2_token_service.h index 77be353..9d9cc18 100644 --- a/google_apis/gaia/fake_oauth2_token_service.h +++ b/google_apis/gaia/fake_oauth2_token_service.h @@ -5,6 +5,7 @@ #ifndef GOOGLE_APIS_GAIA_FAKE_OAUTH2_TOKEN_SERVICE_H_ #define GOOGLE_APIS_GAIA_FAKE_OAUTH2_TOKEN_SERVICE_H_ +#include "base/macros.h" #include "google_apis/gaia/fake_oauth2_token_service_delegate.h" #include "google_apis/gaia/oauth2_token_service.h" diff --git a/google_apis/gaia/fake_oauth2_token_service_delegate.h b/google_apis/gaia/fake_oauth2_token_service_delegate.h index 127039c..e212f0a 100644 --- a/google_apis/gaia/fake_oauth2_token_service_delegate.h +++ b/google_apis/gaia/fake_oauth2_token_service_delegate.h @@ -5,6 +5,7 @@ #ifndef CHROME_BROWSER_SIGNIN_FAKE_OAUTH2_TOKEN_SERVICE_DELEGATE_H_ #define CHROME_BROWSER_SIGNIN_FAKE_OAUTH2_TOKEN_SERVICE_DELEGATE_H_ +#include "base/macros.h" #include "base/memory/linked_ptr.h" #include "google_apis/gaia/google_service_auth_error.h" #include "google_apis/gaia/oauth2_token_service_delegate.h" diff --git a/google_apis/gaia/gaia_auth_fetcher.cc b/google_apis/gaia/gaia_auth_fetcher.cc index be2e2e5..c807e13 100644 --- a/google_apis/gaia/gaia_auth_fetcher.cc +++ b/google_apis/gaia/gaia_auth_fetcher.cc @@ -10,6 +10,7 @@ #include "base/json/json_reader.h" #include "base/json/json_writer.h" +#include "base/macros.h" #include "base/profiler/scoped_tracker.h" #include "base/strings/string_split.h" #include "base/strings/string_util.h" diff --git a/google_apis/gaia/gaia_auth_fetcher.h b/google_apis/gaia/gaia_auth_fetcher.h index ced2601..9c877b6 100644 --- a/google_apis/gaia/gaia_auth_fetcher.h +++ b/google_apis/gaia/gaia_auth_fetcher.h @@ -9,6 +9,7 @@ #include <vector> #include "base/gtest_prod_util.h" +#include "base/macros.h" #include "base/memory/scoped_ptr.h" #include "google_apis/gaia/gaia_auth_consumer.h" #include "google_apis/gaia/google_service_auth_error.h" diff --git a/google_apis/gaia/gaia_auth_fetcher_unittest.cc b/google_apis/gaia/gaia_auth_fetcher_unittest.cc index 307a2bc..19ae5df 100644 --- a/google_apis/gaia/gaia_auth_fetcher_unittest.cc +++ b/google_apis/gaia/gaia_auth_fetcher_unittest.cc @@ -10,6 +10,7 @@ #include "base/json/json_reader.h" #include "base/strings/stringprintf.h" #include "base/values.h" +#include "build/build_config.h" #include "google_apis/gaia/gaia_auth_consumer.h" #include "google_apis/gaia/gaia_auth_fetcher.h" #include "google_apis/gaia/gaia_urls.h" diff --git a/google_apis/gaia/gaia_auth_util.cc b/google_apis/gaia/gaia_auth_util.cc index caf802f..f7eed9a 100644 --- a/google_apis/gaia/gaia_auth_util.cc +++ b/google_apis/gaia/gaia_auth_util.cc @@ -4,6 +4,8 @@ #include "google_apis/gaia/gaia_auth_util.h" +#include <stddef.h> + #include "base/json/json_reader.h" #include "base/logging.h" #include "base/strings/string_split.h" diff --git a/google_apis/gaia/gaia_oauth_client.h b/google_apis/gaia/gaia_oauth_client.h index 61f08eb..b0e1f23 100644 --- a/google_apis/gaia/gaia_oauth_client.h +++ b/google_apis/gaia/gaia_oauth_client.h @@ -8,6 +8,7 @@ #include <string> #include <vector> +#include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" #include "base/values.h" diff --git a/google_apis/gaia/gaia_oauth_client_unittest.cc b/google_apis/gaia/gaia_oauth_client_unittest.cc index b032b81..ac2968b 100644 --- a/google_apis/gaia/gaia_oauth_client_unittest.cc +++ b/google_apis/gaia/gaia_oauth_client_unittest.cc @@ -8,6 +8,7 @@ #include <vector> #include "base/json/json_reader.h" +#include "base/macros.h" #include "base/strings/string_number_conversions.h" #include "base/values.h" #include "google_apis/gaia/gaia_oauth_client.h" diff --git a/google_apis/gaia/gaia_urls.h b/google_apis/gaia/gaia_urls.h index 935aa82..fac4ce9 100644 --- a/google_apis/gaia/gaia_urls.h +++ b/google_apis/gaia/gaia_urls.h @@ -7,6 +7,7 @@ #include <string> +#include "base/macros.h" #include "base/memory/singleton.h" #include "url/gurl.h" diff --git a/google_apis/gaia/mock_url_fetcher_factory.h b/google_apis/gaia/mock_url_fetcher_factory.h index adc118b..e09fb07 100644 --- a/google_apis/gaia/mock_url_fetcher_factory.h +++ b/google_apis/gaia/mock_url_fetcher_factory.h @@ -10,6 +10,7 @@ #include <string> +#include "base/macros.h" #include "google_apis/gaia/gaia_auth_fetcher.h" #include "net/url_request/test_url_fetcher_factory.h" #include "net/url_request/url_request_status.h" diff --git a/google_apis/gaia/oauth2_access_token_fetcher.h b/google_apis/gaia/oauth2_access_token_fetcher.h index cd3ee5c..127101f 100644 --- a/google_apis/gaia/oauth2_access_token_fetcher.h +++ b/google_apis/gaia/oauth2_access_token_fetcher.h @@ -8,6 +8,7 @@ #include <string> #include <vector> +#include "base/macros.h" #include "google_apis/gaia/oauth2_access_token_consumer.h" #include "net/url_request/url_fetcher_delegate.h" diff --git a/google_apis/gaia/oauth2_access_token_fetcher_immediate_error.h b/google_apis/gaia/oauth2_access_token_fetcher_immediate_error.h index 0408deb..4af0b8f 100644 --- a/google_apis/gaia/oauth2_access_token_fetcher_immediate_error.h +++ b/google_apis/gaia/oauth2_access_token_fetcher_immediate_error.h @@ -5,6 +5,7 @@ #ifndef GOOGLE_APIS_GAIA_OAUTH2_ACCESS_TOKEN_FETCHER_IMMEDIATE_ERROR_H_ #define GOOGLE_APIS_GAIA_OAUTH2_ACCESS_TOKEN_FETCHER_IMMEDIATE_ERROR_H_ +#include "base/macros.h" #include "base/memory/ref_counted.h" #include "google_apis/gaia/google_service_auth_error.h" #include "google_apis/gaia/oauth2_access_token_consumer.h" diff --git a/google_apis/gaia/oauth2_access_token_fetcher_impl.h b/google_apis/gaia/oauth2_access_token_fetcher_impl.h index 6944d24..2e45a2e 100644 --- a/google_apis/gaia/oauth2_access_token_fetcher_impl.h +++ b/google_apis/gaia/oauth2_access_token_fetcher_impl.h @@ -9,6 +9,7 @@ #include <vector> #include "base/gtest_prod_util.h" +#include "base/macros.h" #include "base/memory/scoped_ptr.h" #include "google_apis/gaia/oauth2_access_token_consumer.h" #include "google_apis/gaia/oauth2_access_token_fetcher.h" diff --git a/google_apis/gaia/oauth2_access_token_fetcher_impl_unittest.cc b/google_apis/gaia/oauth2_access_token_fetcher_impl_unittest.cc index f234b39..de85bb7 100644 --- a/google_apis/gaia/oauth2_access_token_fetcher_impl_unittest.cc +++ b/google_apis/gaia/oauth2_access_token_fetcher_impl_unittest.cc @@ -9,6 +9,7 @@ #include "base/memory/scoped_ptr.h" #include "base/run_loop.h" #include "base/thread_task_runner_handle.h" +#include "build/build_config.h" #include "google_apis/gaia/gaia_urls.h" #include "google_apis/gaia/google_service_auth_error.h" #include "google_apis/gaia/oauth2_access_token_consumer.h" diff --git a/google_apis/gaia/oauth2_api_call_flow.cc b/google_apis/gaia/oauth2_api_call_flow.cc index 19d5b06..8b16032 100644 --- a/google_apis/gaia/oauth2_api_call_flow.cc +++ b/google_apis/gaia/oauth2_api_call_flow.cc @@ -7,7 +7,6 @@ #include <string> #include <vector> -#include "base/basictypes.h" #include "base/strings/stringprintf.h" #include "google_apis/gaia/gaia_urls.h" #include "net/base/escape.h" diff --git a/google_apis/gaia/oauth2_api_call_flow.h b/google_apis/gaia/oauth2_api_call_flow.h index cfb833f..6cf8f8c 100644 --- a/google_apis/gaia/oauth2_api_call_flow.h +++ b/google_apis/gaia/oauth2_api_call_flow.h @@ -7,6 +7,7 @@ #include <string> +#include "base/macros.h" #include "base/memory/scoped_ptr.h" #include "net/url_request/url_fetcher.h" #include "net/url_request/url_fetcher_delegate.h" diff --git a/google_apis/gaia/oauth2_mint_token_flow.cc b/google_apis/gaia/oauth2_mint_token_flow.cc index c2a6501..f8e662f 100644 --- a/google_apis/gaia/oauth2_mint_token_flow.cc +++ b/google_apis/gaia/oauth2_mint_token_flow.cc @@ -4,10 +4,11 @@ #include "google_apis/gaia/oauth2_mint_token_flow.h" +#include <stddef.h> + #include <string> #include <vector> -#include "base/basictypes.h" #include "base/bind.h" #include "base/command_line.h" #include "base/json/json_reader.h" diff --git a/google_apis/gaia/oauth2_mint_token_flow.h b/google_apis/gaia/oauth2_mint_token_flow.h index 9fe3b88..7d1b645 100644 --- a/google_apis/gaia/oauth2_mint_token_flow.h +++ b/google_apis/gaia/oauth2_mint_token_flow.h @@ -9,6 +9,7 @@ #include <vector> #include "base/gtest_prod_util.h" +#include "base/macros.h" #include "base/memory/weak_ptr.h" #include "base/strings/string16.h" #include "google_apis/gaia/oauth2_api_call_flow.h" diff --git a/google_apis/gaia/oauth2_token_service.cc b/google_apis/gaia/oauth2_token_service.cc index 0c7519b..72885a4 100644 --- a/google_apis/gaia/oauth2_token_service.cc +++ b/google_apis/gaia/oauth2_token_service.cc @@ -4,9 +4,12 @@ #include "google_apis/gaia/oauth2_token_service.h" +#include <stdint.h> + #include <vector> #include "base/bind.h" +#include "base/macros.h" #include "base/memory/weak_ptr.h" #include "base/message_loop/message_loop.h" #include "base/metrics/histogram_macros.h" @@ -159,7 +162,7 @@ class OAuth2TokenService::Fetcher : public OAuth2AccessTokenConsumer { void InformWaitingRequests(); void InformWaitingRequestsAndDelete(); static bool ShouldRetry(const GoogleServiceAuthError& error); - int64 ComputeExponentialBackOffMilliseconds(int retry_num); + int64_t ComputeExponentialBackOffMilliseconds(int retry_num); // |oauth2_token_service_| remains valid for the life of this Fetcher, since // this Fetcher is destructed in the dtor of the OAuth2TokenService or is @@ -304,10 +307,10 @@ void OAuth2TokenService::Fetcher::OnGetTokenFailure( // Returns an exponential backoff in milliseconds including randomness less than // 1000 ms when retrying fetching an OAuth2 access token. -int64 OAuth2TokenService::Fetcher::ComputeExponentialBackOffMilliseconds( +int64_t OAuth2TokenService::Fetcher::ComputeExponentialBackOffMilliseconds( int retry_num) { DCHECK(retry_num < max_fetch_retry_num_); - int64 exponential_backoff_in_seconds = 1 << retry_num; + int64_t exponential_backoff_in_seconds = 1 << retry_num; // Returns a backoff with randomness < 1000ms return (exponential_backoff_in_seconds + base::RandDouble()) * 1000; } diff --git a/google_apis/gaia/oauth2_token_service.h b/google_apis/gaia/oauth2_token_service.h index 85c3fc8..dad12ea 100644 --- a/google_apis/gaia/oauth2_token_service.h +++ b/google_apis/gaia/oauth2_token_service.h @@ -5,12 +5,14 @@ #ifndef GOOGLE_APIS_GAIA_OAUTH2_TOKEN_SERVICE_H_ #define GOOGLE_APIS_GAIA_OAUTH2_TOKEN_SERVICE_H_ +#include <stddef.h> + #include <map> #include <set> #include <string> -#include "base/basictypes.h" #include "base/gtest_prod_util.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/google_apis/gaia/oauth2_token_service_delegate.h b/google_apis/gaia/oauth2_token_service_delegate.h index b727633..3a6c00c 100644 --- a/google_apis/gaia/oauth2_token_service_delegate.h +++ b/google_apis/gaia/oauth2_token_service_delegate.h @@ -5,6 +5,7 @@ #ifndef GOOGLE_APIS_GAIA_OAUTH2_TOKEN_SERVICE_DELEGATE_H_ #define GOOGLE_APIS_GAIA_OAUTH2_TOKEN_SERVICE_DELEGATE_H_ +#include "base/macros.h" #include "base/observer_list.h" #include "google_apis/gaia/gaia_auth_util.h" #include "google_apis/gaia/oauth2_token_service.h" diff --git a/google_apis/gaia/oauth2_token_service_request.cc b/google_apis/gaia/oauth2_token_service_request.cc index 3af40c3..d843b04 100644 --- a/google_apis/gaia/oauth2_token_service_request.cc +++ b/google_apis/gaia/oauth2_token_service_request.cc @@ -6,6 +6,7 @@ #include "base/bind.h" #include "base/location.h" +#include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" #include "base/single_thread_task_runner.h" diff --git a/google_apis/gaia/oauth2_token_service_request.h b/google_apis/gaia/oauth2_token_service_request.h index 8d81ba4..4b46f17 100644 --- a/google_apis/gaia/oauth2_token_service_request.h +++ b/google_apis/gaia/oauth2_token_service_request.h @@ -8,6 +8,7 @@ #include <set> #include <string> +#include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" #include "base/single_thread_task_runner.h" diff --git a/google_apis/gaia/oauth2_token_service_unittest.cc b/google_apis/gaia/oauth2_token_service_unittest.cc index 924ae4c..aae5cab 100644 --- a/google_apis/gaia/oauth2_token_service_unittest.cc +++ b/google_apis/gaia/oauth2_token_service_unittest.cc @@ -2,8 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include <stddef.h> + #include <string> +#include "base/macros.h" #include "base/message_loop/message_loop.h" #include "base/run_loop.h" #include "google_apis/gaia/fake_oauth2_token_service_delegate.h" diff --git a/google_apis/gaia/oauth_request_signer.cc b/google_apis/gaia/oauth_request_signer.cc index 2772c04..ee35e23 100644 --- a/google_apis/gaia/oauth_request_signer.cc +++ b/google_apis/gaia/oauth_request_signer.cc @@ -4,6 +4,8 @@ #include "google_apis/gaia/oauth_request_signer.h" +#include <stddef.h> + #include <cctype> #include <cstddef> #include <cstdlib> diff --git a/google_apis/gaia/oauth_request_signer.h b/google_apis/gaia/oauth_request_signer.h index 3b91d4d..29bb10b 100644 --- a/google_apis/gaia/oauth_request_signer.h +++ b/google_apis/gaia/oauth_request_signer.h @@ -8,7 +8,7 @@ #include <map> #include <string> -#include "base/basictypes.h" +#include "base/macros.h" class GURL; diff --git a/google_apis/gaia/ubertoken_fetcher.h b/google_apis/gaia/ubertoken_fetcher.h index 5601746..5ff73bd 100644 --- a/google_apis/gaia/ubertoken_fetcher.h +++ b/google_apis/gaia/ubertoken_fetcher.h @@ -5,6 +5,7 @@ #ifndef GOOGLE_APIS_GAIA_UBERTOKEN_FETCHER_H_ #define GOOGLE_APIS_GAIA_UBERTOKEN_FETCHER_H_ +#include "base/macros.h" #include "base/memory/scoped_ptr.h" #include "base/timer/timer.h" #include "google_apis/gaia/gaia_auth_consumer.h" diff --git a/google_apis/gcm/base/mcs_message.cc b/google_apis/gcm/base/mcs_message.cc index f0c130b..c3d5151 100644 --- a/google_apis/gcm/base/mcs_message.cc +++ b/google_apis/gcm/base/mcs_message.cc @@ -11,7 +11,7 @@ namespace gcm { MCSMessage::Core::Core() {} -MCSMessage::Core::Core(uint8 tag, +MCSMessage::Core::Core(uint8_t tag, const google::protobuf::MessageLite& protobuf) { scoped_ptr<google::protobuf::MessageLite> owned_protobuf(protobuf.New()); owned_protobuf->CheckTypeAndMergeFrom(protobuf); @@ -19,7 +19,7 @@ MCSMessage::Core::Core(uint8 tag, } MCSMessage::Core::Core( - uint8 tag, + uint8_t tag, scoped_ptr<const google::protobuf::MessageLite> protobuf) { protobuf_ = protobuf.Pass(); } @@ -38,19 +38,17 @@ MCSMessage::MCSMessage(const google::protobuf::MessageLite& protobuf) core_(new Core(tag_, protobuf)) { } -MCSMessage::MCSMessage(uint8 tag, +MCSMessage::MCSMessage(uint8_t tag, const google::protobuf::MessageLite& protobuf) - : tag_(tag), - size_(protobuf.ByteSize()), - core_(new Core(tag_, protobuf)) { + : tag_(tag), size_(protobuf.ByteSize()), core_(new Core(tag_, protobuf)) { DCHECK_EQ(tag, GetMCSProtoTag(protobuf)); } -MCSMessage::MCSMessage(uint8 tag, +MCSMessage::MCSMessage(uint8_t tag, scoped_ptr<const google::protobuf::MessageLite> protobuf) - : tag_(tag), - size_(protobuf->ByteSize()), - core_(new Core(tag_, protobuf.Pass())) { + : tag_(tag), + size_(protobuf->ByteSize()), + core_(new Core(tag_, protobuf.Pass())) { DCHECK_EQ(tag, GetMCSProtoTag(core_->Get())); } diff --git a/google_apis/gcm/base/mcs_message.h b/google_apis/gcm/base/mcs_message.h index 14d80ed..5be4aef 100644 --- a/google_apis/gcm/base/mcs_message.h +++ b/google_apis/gcm/base/mcs_message.h @@ -5,9 +5,11 @@ #ifndef GOOGLE_APIS_GCM_BASE_MCS_MESSAGE_H_ #define GOOGLE_APIS_GCM_BASE_MCS_MESSAGE_H_ +#include <stdint.h> + #include <string> -#include "base/basictypes.h" +#include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" #include "google_apis/gcm/base/gcm_export.h" @@ -32,9 +34,9 @@ class GCM_EXPORT MCSMessage { // Infers tag from |message|. explicit MCSMessage(const google::protobuf::MessageLite& protobuf); // |tag| must match |protobuf|'s message type. - MCSMessage(uint8 tag, const google::protobuf::MessageLite& protobuf); + MCSMessage(uint8_t tag, const google::protobuf::MessageLite& protobuf); // |tag| must match |protobuf|'s message type. Takes ownership of |protobuf|. - MCSMessage(uint8 tag, + MCSMessage(uint8_t tag, scoped_ptr<const google::protobuf::MessageLite> protobuf); ~MCSMessage(); @@ -43,7 +45,7 @@ class GCM_EXPORT MCSMessage { bool IsValid() const; // Getters for serialization. - uint8 tag() const { return tag_; } + uint8_t tag() const { return tag_; } int size() const {return size_; } std::string SerializeAsString() const; @@ -57,8 +59,8 @@ class GCM_EXPORT MCSMessage { class Core : public base::RefCountedThreadSafe<MCSMessage::Core> { public: Core(); - Core(uint8 tag, const google::protobuf::MessageLite& protobuf); - Core(uint8 tag, scoped_ptr<const google::protobuf::MessageLite> protobuf); + Core(uint8_t tag, const google::protobuf::MessageLite& protobuf); + Core(uint8_t tag, scoped_ptr<const google::protobuf::MessageLite> protobuf); const google::protobuf::MessageLite& Get() const; @@ -73,7 +75,7 @@ class GCM_EXPORT MCSMessage { }; // These are cached separately to avoid having to recompute them. - const uint8 tag_; + const uint8_t tag_; const int size_; // The refcounted core, containing the protobuf memory. diff --git a/google_apis/gcm/base/mcs_message_unittest.cc b/google_apis/gcm/base/mcs_message_unittest.cc index 4dd52d6..c27a7c5 100644 --- a/google_apis/gcm/base/mcs_message_unittest.cc +++ b/google_apis/gcm/base/mcs_message_unittest.cc @@ -4,6 +4,8 @@ #include "google_apis/gcm/base/mcs_message.h" +#include <stdint.h> + #include "base/logging.h" #include "base/test/test_simple_task_runner.h" #include "base/thread_task_runner_handle.h" @@ -13,8 +15,8 @@ namespace gcm { -const uint64 kAndroidId = 12345; -const uint64 kSecret = 54321; +const uint64_t kAndroidId = 12345; +const uint64_t kSecret = 54321; class MCSMessageTest : public testing::Test { public: diff --git a/google_apis/gcm/base/mcs_util.cc b/google_apis/gcm/base/mcs_util.cc index b5fb928..b35b23c 100644 --- a/google_apis/gcm/base/mcs_util.cc +++ b/google_apis/gcm/base/mcs_util.cc @@ -4,8 +4,11 @@ #include "google_apis/gcm/base/mcs_util.h" +#include <stddef.h> + #include "base/format_macros.h" #include "base/logging.h" +#include "base/macros.h" #include "base/strings/string_number_conversions.h" #include "base/strings/stringprintf.h" #include "base/time/clock.h" @@ -51,8 +54,8 @@ const int kMaxTTLSeconds = 24 * 60 * 60; // 1 day. } // namespace scoped_ptr<mcs_proto::LoginRequest> BuildLoginRequest( - uint64 auth_id, - uint64 auth_token, + uint64_t auth_id, + uint64_t auth_token, const std::string& version_string) { // Create a hex encoded auth id for the device id field. std::string auth_id_hex; @@ -106,7 +109,7 @@ scoped_ptr<mcs_proto::IqStanza> BuildSelectiveAck( // Utility method to build a google::protobuf::MessageLite object from a MCS // tag. -scoped_ptr<google::protobuf::MessageLite> BuildProtobufFromTag(uint8 tag) { +scoped_ptr<google::protobuf::MessageLite> BuildProtobufFromTag(uint8_t tag) { switch(tag) { case kHeartbeatPingTag: return scoped_ptr<google::protobuf::MessageLite>( @@ -187,7 +190,8 @@ void SetPersistentId(const std::string& persistent_id, NOTREACHED(); } -uint32 GetLastStreamIdReceived(const google::protobuf::MessageLite& protobuf) { +uint32_t GetLastStreamIdReceived( + const google::protobuf::MessageLite& protobuf) { if (protobuf.GetTypeName() == kProtoNames[kIqStanzaTag]) { return reinterpret_cast<const mcs_proto::IqStanza*>(&protobuf)-> last_stream_id_received(); @@ -208,7 +212,7 @@ uint32 GetLastStreamIdReceived(const google::protobuf::MessageLite& protobuf) { return 0; } -void SetLastStreamIdReceived(uint32 val, +void SetLastStreamIdReceived(uint32_t val, google::protobuf::MessageLite* protobuf) { if (protobuf->GetTypeName() == kProtoNames[kIqStanzaTag]) { reinterpret_cast<mcs_proto::IqStanza*>(protobuf)-> @@ -238,8 +242,8 @@ bool HasTTLExpired(const google::protobuf::MessageLite& protobuf, base::Clock* clock) { if (protobuf.GetTypeName() != kProtoNames[kDataMessageStanzaTag]) return false; - uint64 ttl = GetTTL(protobuf); - uint64 sent = + uint64_t ttl = GetTTL(protobuf); + uint64_t sent = reinterpret_cast<const mcs_proto::DataMessageStanza*>(&protobuf)->sent(); DCHECK(sent); return ttl > 0 && diff --git a/google_apis/gcm/base/mcs_util.h b/google_apis/gcm/base/mcs_util.h index e6fc1e0..53f53ea 100644 --- a/google_apis/gcm/base/mcs_util.h +++ b/google_apis/gcm/base/mcs_util.h @@ -7,10 +7,11 @@ #ifndef GOOGLE_APIS_GCM_BASE_MCS_UTIL_H_ #define GOOGLE_APIS_GCM_BASE_MCS_UTIL_H_ +#include <stdint.h> + #include <string> #include <vector> -#include "base/basictypes.h" #include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" #include "google_apis/gcm/base/gcm_export.h" @@ -56,8 +57,8 @@ enum MCSIqStanzaExtension { // Builds a LoginRequest with the hardcoded local data. GCM_EXPORT scoped_ptr<mcs_proto::LoginRequest> BuildLoginRequest( - uint64 auth_id, - uint64 auth_token, + uint64_t auth_id, + uint64_t auth_token, const std::string& version_string); // Builds a StreamAck IqStanza message. @@ -66,8 +67,8 @@ GCM_EXPORT scoped_ptr<mcs_proto::IqStanza> BuildSelectiveAck( const std::vector<std::string>& acked_ids); // Utility methods for building and identifying MCS protobufs. -GCM_EXPORT scoped_ptr<google::protobuf::MessageLite> - BuildProtobufFromTag(uint8 tag); +GCM_EXPORT scoped_ptr<google::protobuf::MessageLite> BuildProtobufFromTag( + uint8_t tag); GCM_EXPORT int GetMCSProtoTag(const google::protobuf::MessageLite& message); // RMQ utility methods for extracting/setting common data from/to protobufs. @@ -76,10 +77,10 @@ GCM_EXPORT std::string GetPersistentId( GCM_EXPORT void SetPersistentId( const std::string& persistent_id, google::protobuf::MessageLite* message); -GCM_EXPORT uint32 GetLastStreamIdReceived( - const google::protobuf::MessageLite& protobuf); +GCM_EXPORT uint32_t +GetLastStreamIdReceived(const google::protobuf::MessageLite& protobuf); GCM_EXPORT void SetLastStreamIdReceived( - uint32 last_stream_id_received, + uint32_t last_stream_id_received, google::protobuf::MessageLite* protobuf); // Returns whether the TTL (time to live) for this message has expired, based diff --git a/google_apis/gcm/base/mcs_util_unittest.cc b/google_apis/gcm/base/mcs_util_unittest.cc index 34d482d..cef47fa 100644 --- a/google_apis/gcm/base/mcs_util_unittest.cc +++ b/google_apis/gcm/base/mcs_util_unittest.cc @@ -4,7 +4,11 @@ #include "google_apis/gcm/base/mcs_util.h" +#include <stddef.h> +#include <stdint.h> + #include "base/bind.h" +#include "base/macros.h" #include "base/memory/scoped_ptr.h" #include "base/run_loop.h" #include "base/strings/string_number_conversions.h" @@ -13,8 +17,8 @@ namespace gcm { namespace { -const uint64 kAuthId = 4421448356646222460; -const uint64 kAuthToken = 12345; +const uint64_t kAuthId = 4421448356646222460; +const uint64_t kAuthToken = 12345; // Build a login request protobuf. TEST(MCSUtilTest, BuildLoginRequest) { @@ -31,7 +35,7 @@ TEST(MCSUtilTest, BuildLoginRequest) { // Test building a protobuf and extracting the tag from a protobuf. TEST(MCSUtilTest, ProtobufToTag) { - for (uint8 i = 0; i < kNumProtoTypes; ++i) { + for (uint8_t i = 0; i < kNumProtoTypes; ++i) { scoped_ptr<google::protobuf::MessageLite> protobuf = BuildProtobufFromTag(i); if (!protobuf.get()) // Not all tags have protobuf definitions. diff --git a/google_apis/gcm/base/socket_stream.cc b/google_apis/gcm/base/socket_stream.cc index 48c7da8..45af7579 100644 --- a/google_apis/gcm/base/socket_stream.cc +++ b/google_apis/gcm/base/socket_stream.cc @@ -4,6 +4,8 @@ #include "google_apis/gcm/base/socket_stream.h" +#include <stddef.h> + #include "base/bind.h" #include "base/callback.h" #include "net/base/io_buffer.h" @@ -71,7 +73,7 @@ bool SocketInputStream::Skip(int count) { return false; } -int64 SocketInputStream::ByteCount() const { +int64_t SocketInputStream::ByteCount() const { DCHECK_NE(GetState(), CLOSED); DCHECK_NE(GetState(), READING); return next_pos_; @@ -245,7 +247,7 @@ void SocketOutputStream::BackUp(int count) { << next_pos_ << " bytes used."; } -int64 SocketOutputStream::ByteCount() const { +int64_t SocketOutputStream::ByteCount() const { DCHECK_NE(GetState(), CLOSED); DCHECK_NE(GetState(), FLUSHING); return next_pos_; diff --git a/google_apis/gcm/base/socket_stream.h b/google_apis/gcm/base/socket_stream.h index 527056a..e9bdaa7 100644 --- a/google_apis/gcm/base/socket_stream.h +++ b/google_apis/gcm/base/socket_stream.h @@ -8,9 +8,11 @@ #ifndef GOOGLE_APIS_GCM_BASE_SOCKET_STREAM_H_ #define GOOGLE_APIS_GCM_BASE_SOCKET_STREAM_H_ -#include "base/basictypes.h" +#include <stdint.h> + #include "base/callback_forward.h" #include "base/compiler_specific.h" +#include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/memory/weak_ptr.h" #include "google/protobuf/io/zero_copy_stream.h" @@ -69,7 +71,7 @@ class GCM_EXPORT SocketInputStream bool Next(const void** data, int* size) override; void BackUp(int count) override; bool Skip(int count) override; // Not implemented. - int64 ByteCount() const override; + int64_t ByteCount() const override; // The remaining amount of valid data available to be read. int UnreadByteCount() const; @@ -164,7 +166,7 @@ class GCM_EXPORT SocketOutputStream // ZeroCopyOutputStream implementation. bool Next(void** data, int* size) override; void BackUp(int count) override; - int64 ByteCount() const override; + int64_t ByteCount() const override; // Writes the buffer into the Socket. net::Error Flush(const base::Closure& callback); diff --git a/google_apis/gcm/base/socket_stream_unittest.cc b/google_apis/gcm/base/socket_stream_unittest.cc index 561e5cf..ca53c3b 100644 --- a/google_apis/gcm/base/socket_stream_unittest.cc +++ b/google_apis/gcm/base/socket_stream_unittest.cc @@ -4,8 +4,10 @@ #include "google_apis/gcm/base/socket_stream.h" -#include "base/basictypes.h" +#include <stdint.h> + #include "base/bind.h" +#include "base/macros.h" #include "base/memory/scoped_ptr.h" #include "base/run_loop.h" #include "base/strings/string_piece.h" @@ -113,8 +115,8 @@ base::StringPiece GCMSocketStreamTest::DoInputStreamRead(int bytes) { break; total_bytes_read += size; if (initial_buffer) { // Verify the buffer doesn't skip data. - EXPECT_EQ(static_cast<const uint8*>(initial_buffer) + total_bytes_read, - static_cast<const uint8*>(buffer) + size); + EXPECT_EQ(static_cast<const uint8_t*>(initial_buffer) + total_bytes_read, + static_cast<const uint8_t*>(buffer) + size); } else { initial_buffer = buffer; } diff --git a/google_apis/gcm/engine/account_mapping.cc b/google_apis/gcm/engine/account_mapping.cc index 7b0bfb0..57f8b80 100644 --- a/google_apis/gcm/engine/account_mapping.cc +++ b/google_apis/gcm/engine/account_mapping.cc @@ -4,6 +4,8 @@ #include "google_apis/gcm/engine/account_mapping.h" +#include <stdint.h> + #include "base/strings/string_number_conversions.h" #include "base/strings/string_split.h" #include "base/strings/string_util.h" @@ -13,12 +15,12 @@ namespace gcm { namespace { const char kSeparator[] = "&"; -const uint32 kEmailIndex = 0; -const uint32 kStatusIndex = 1; -const uint32 kStatusChangeTimestampIndex = 2; -const uint32 kSizeWithNoMessage = kStatusChangeTimestampIndex + 1; -const uint32 kMessageIdIndex = 3; -const uint32 kSizeWithMessage = kMessageIdIndex + 1; +const uint32_t kEmailIndex = 0; +const uint32_t kStatusIndex = 1; +const uint32_t kStatusChangeTimestampIndex = 2; +const uint32_t kSizeWithNoMessage = kStatusChangeTimestampIndex + 1; +const uint32_t kMessageIdIndex = 3; +const uint32_t kSizeWithMessage = kMessageIdIndex + 1; const char kStatusNew[] = "new"; const char kStatusAdding[] = "adding"; @@ -104,7 +106,7 @@ bool AccountMapping::ParseFromString(const std::string& value) { if (values.size() == kSizeWithNoMessage && temp_status == ADDING) return false; - int64 status_change_ts_internal = 0LL; + int64_t status_change_ts_internal = 0LL; if (!base::StringToInt64(values[kStatusChangeTimestampIndex], &status_change_ts_internal)) { return false; diff --git a/google_apis/gcm/engine/account_mapping.h b/google_apis/gcm/engine/account_mapping.h index a152d56..ffed95c 100644 --- a/google_apis/gcm/engine/account_mapping.h +++ b/google_apis/gcm/engine/account_mapping.h @@ -7,7 +7,6 @@ #include <string> -#include "base/basictypes.h" #include "base/time/time.h" #include "google_apis/gcm/base/gcm_export.h" diff --git a/google_apis/gcm/engine/checkin_request.cc b/google_apis/gcm/engine/checkin_request.cc index c1c73e8..5d47f7b 100644 --- a/google_apis/gcm/engine/checkin_request.cc +++ b/google_apis/gcm/engine/checkin_request.cc @@ -80,8 +80,8 @@ void RecordCheckinStatusAndReportUMA(CheckinRequestStatus status, } // namespace CheckinRequest::RequestInfo::RequestInfo( - uint64 android_id, - uint64 security_token, + uint64_t android_id, + uint64_t security_token, const std::map<std::string, std::string>& account_tokens, const std::string& settings_digest, const checkin_proto::ChromeBuildProto& chrome_build_proto) @@ -89,8 +89,7 @@ CheckinRequest::RequestInfo::RequestInfo( security_token(security_token), account_tokens(account_tokens), settings_digest(settings_digest), - chrome_build_proto(chrome_build_proto) { -} + chrome_build_proto(chrome_build_proto) {} CheckinRequest::RequestInfo::~RequestInfo() {} diff --git a/google_apis/gcm/engine/checkin_request.h b/google_apis/gcm/engine/checkin_request.h index 619a8f9..f77e66d 100644 --- a/google_apis/gcm/engine/checkin_request.h +++ b/google_apis/gcm/engine/checkin_request.h @@ -5,10 +5,12 @@ #ifndef GOOGLE_APIS_GCM_ENGINE_CHECKIN_REQUEST_H_ #define GOOGLE_APIS_GCM_ENGINE_CHECKIN_REQUEST_H_ +#include <stdint.h> + #include <string> -#include "base/basictypes.h" #include "base/callback.h" +#include "base/macros.h" #include "base/memory/weak_ptr.h" #include "base/time/time.h" #include "google_apis/gcm/base/gcm_export.h" @@ -39,17 +41,17 @@ class GCM_EXPORT CheckinRequest : public net::URLFetcherDelegate { // Checkin request details. struct GCM_EXPORT RequestInfo { - RequestInfo(uint64 android_id, - uint64 security_token, + RequestInfo(uint64_t android_id, + uint64_t security_token, const std::map<std::string, std::string>& account_tokens, const std::string& settings_digest, const checkin_proto::ChromeBuildProto& chrome_build_proto); ~RequestInfo(); // Android ID of the device. - uint64 android_id; + uint64_t android_id; // Security token of the device. - uint64 security_token; + uint64_t security_token; // Map of account OAuth2 tokens keyed by emails. std::map<std::string, std::string> account_tokens; // Digest of GServices settings on the device. diff --git a/google_apis/gcm/engine/checkin_request_unittest.cc b/google_apis/gcm/engine/checkin_request_unittest.cc index 9939c27..4740815 100644 --- a/google_apis/gcm/engine/checkin_request_unittest.cc +++ b/google_apis/gcm/engine/checkin_request_unittest.cc @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include <stdint.h> + #include <string> #include "google_apis/gcm/engine/checkin_request.h" @@ -11,12 +13,12 @@ namespace gcm { -const uint64 kAndroidId = 42UL; -const uint64 kBlankAndroidId = 999999UL; -const uint64 kBlankSecurityToken = 999999UL; +const uint64_t kAndroidId = 42UL; +const uint64_t kBlankAndroidId = 999999UL; +const uint64_t kBlankSecurityToken = 999999UL; const char kCheckinURL[] = "http://foo.bar/checkin"; const char kChromeVersion[] = "Version String"; -const uint64 kSecurityToken = 77; +const uint64_t kSecurityToken = 77; const char kSettingsDigest[] = "settings_digest"; const char kEmailAddress[] = "test_user@gmail.com"; const char kTokenValue[] = "token_value"; @@ -37,14 +39,14 @@ class CheckinRequestTest : public GCMRequestTestBase { void FetcherCallback( const checkin_proto::AndroidCheckinResponse& response); - void CreateRequest(uint64 android_id, uint64 security_token); + void CreateRequest(uint64_t android_id, uint64_t security_token); void SetResponseScenario(ResponseScenario response_scenario); protected: bool callback_called_; - uint64 android_id_; - uint64 security_token_; + uint64_t android_id_; + uint64_t security_token_; int checkin_device_type_; checkin_proto::ChromeBuildProto chrome_build_proto_; scoped_ptr<CheckinRequest> request_; @@ -69,8 +71,8 @@ void CheckinRequestTest::FetcherCallback( security_token_ = checkin_response.security_token(); } -void CheckinRequestTest::CreateRequest(uint64 android_id, - uint64 security_token) { +void CheckinRequestTest::CreateRequest(uint64_t android_id, + uint64_t security_token) { // First setup a chrome_build protobuf. chrome_build_proto_.set_platform( checkin_proto::ChromeBuildProto::PLATFORM_LINUX); @@ -108,8 +110,9 @@ void CheckinRequestTest::SetResponseScenario( checkin_proto::AndroidCheckinResponse response; response.set_stats_ok(true); - uint64 android_id = response_scenario == ANDROID_ID_IS_ZER0 ? 0 : kAndroidId; - uint64 security_token = + uint64_t android_id = + response_scenario == ANDROID_ID_IS_ZER0 ? 0 : kAndroidId; + uint64_t security_token = response_scenario == SECURITY_TOKEN_IS_ZERO ? 0 : kSecurityToken; if (response_scenario != MISSING_ANDROID_ID) @@ -134,7 +137,7 @@ TEST_F(CheckinRequestTest, FetcherDataAndURL) { checkin_proto::AndroidCheckinRequest request_proto; request_proto.ParseFromString(fetcher->upload_data()); - EXPECT_EQ(kAndroidId, static_cast<uint64>(request_proto.id())); + EXPECT_EQ(kAndroidId, static_cast<uint64_t>(request_proto.id())); EXPECT_EQ(kSecurityToken, request_proto.security_token()); EXPECT_EQ(chrome_build_proto_.platform(), request_proto.checkin().chrome_build().platform()); diff --git a/google_apis/gcm/engine/connection_factory_impl.h b/google_apis/gcm/engine/connection_factory_impl.h index a07de12..26bc1de 100644 --- a/google_apis/gcm/engine/connection_factory_impl.h +++ b/google_apis/gcm/engine/connection_factory_impl.h @@ -7,6 +7,9 @@ #include "google_apis/gcm/engine/connection_factory.h" +#include <stddef.h> + +#include "base/macros.h" #include "base/memory/weak_ptr.h" #include "base/time/time.h" #include "google_apis/gcm/engine/connection_handler.h" diff --git a/google_apis/gcm/engine/connection_handler_impl.cc b/google_apis/gcm/engine/connection_handler_impl.cc index 95c0286..0b7dce9 100644 --- a/google_apis/gcm/engine/connection_handler_impl.cc +++ b/google_apis/gcm/engine/connection_handler_impl.cc @@ -289,7 +289,7 @@ void ConnectionHandlerImpl::WaitForData(ProcessingState state) { } void ConnectionHandlerImpl::OnGotVersion() { - uint8 version = 0; + uint8_t version = 0; { CodedInputStream coded_input_stream(input_stream_.get()); coded_input_stream.ReadRaw(&version, 1); @@ -421,8 +421,8 @@ void ConnectionHandlerImpl::OnGotMessageBytes() { int size = 0; input_stream_->Next(&data_ptr, &size); payload_input_buffer_.insert(payload_input_buffer_.end(), - static_cast<const uint8*>(data_ptr), - static_cast<const uint8*>(data_ptr) + size); + static_cast<const uint8_t*>(data_ptr), + static_cast<const uint8_t*>(data_ptr) + size); DCHECK_LE(payload_input_buffer_.size(), message_size_); if (payload_input_buffer_.size() == message_size_) { diff --git a/google_apis/gcm/engine/connection_handler_impl.h b/google_apis/gcm/engine/connection_handler_impl.h index e2702c0..0fee8d5 100644 --- a/google_apis/gcm/engine/connection_handler_impl.h +++ b/google_apis/gcm/engine/connection_handler_impl.h @@ -5,8 +5,11 @@ #ifndef GOOGLE_APIS_GCM_ENGINE_CONNECTION_HANDLER_IMPL_H_ #define GOOGLE_APIS_GCM_ENGINE_CONNECTION_HANDLER_IMPL_H_ +#include <stdint.h> + #include <vector> +#include "base/macros.h" #include "base/memory/weak_ptr.h" #include "base/time/time.h" #include "base/timer/timer.h" @@ -105,8 +108,8 @@ class GCM_EXPORT ConnectionHandlerImpl : public ConnectionHandler { bool handshake_complete_; // State for the message currently being processed, if there is one. - uint8 message_tag_; - uint32 message_size_; + uint8_t message_tag_; + uint32_t message_size_; ProtoReceivedCallback read_callback_; ProtoSentCallback write_callback_; @@ -115,11 +118,11 @@ class GCM_EXPORT ConnectionHandlerImpl : public ConnectionHandler { // The number of bytes of the size packet read so far without finishing the // read. This can be up to but no larger than 5 (the max number of bytes for // a varint32). - uint8 size_packet_so_far_; + uint8_t size_packet_so_far_; // A temporary input buffer for holding large messages. Will hold // message_size_ bytes for messages larger than the normal size limit (and // will be empty otherwise). - std::vector<uint8> payload_input_buffer_; + std::vector<uint8_t> payload_input_buffer_; base::WeakPtrFactory<ConnectionHandlerImpl> weak_ptr_factory_; diff --git a/google_apis/gcm/engine/connection_handler_impl_unittest.cc b/google_apis/gcm/engine/connection_handler_impl_unittest.cc index ab5fdf2..2aabba3 100644 --- a/google_apis/gcm/engine/connection_handler_impl_unittest.cc +++ b/google_apis/gcm/engine/connection_handler_impl_unittest.cc @@ -4,6 +4,8 @@ #include "google_apis/gcm/engine/connection_handler_impl.h" +#include <stdint.h> + #include <string> #include "base/bind.h" @@ -28,8 +30,8 @@ typedef scoped_ptr<google::protobuf::MessageLite> ScopedMessage; typedef std::vector<net::MockRead> ReadList; typedef std::vector<net::MockWrite> WriteList; -const uint64 kAuthId = 54321; -const uint64 kAuthToken = 12345; +const uint64_t kAuthId = 54321; +const uint64_t kAuthToken = 12345; const char kMCSVersion = 41; // The protocol version. const int kMCSPort = 5228; // The server port. const char kDataMsgFrom[] = "data_from"; @@ -44,13 +46,13 @@ const char kDataMsgFromLong2[] = "this is a second long from that will result in a message > 128 bytes"; const char kDataMsgCategoryLong2[] = "this is a second long category that will result in a message > 128 bytes"; -const uint8 kInvalidTag = 100; // An invalid tag. +const uint8_t kInvalidTag = 100; // An invalid tag. // ---- Helpers for building messages. ---- // Encode a protobuf packet with protobuf type |tag| and serialized protobuf // bytes |proto| into the MCS message form (tag + varint size + bytes). -std::string EncodePacket(uint8 tag, const std::string& proto) { +std::string EncodePacket(uint8_t tag, const std::string& proto) { std::string result; google::protobuf::io::StringOutputStream string_output_stream(&result); { diff --git a/google_apis/gcm/engine/fake_connection_factory.h b/google_apis/gcm/engine/fake_connection_factory.h index 5769922..4e4b86d 100644 --- a/google_apis/gcm/engine/fake_connection_factory.h +++ b/google_apis/gcm/engine/fake_connection_factory.h @@ -5,6 +5,7 @@ #ifndef GOOGLE_APIS_GCM_ENGINE_FAKE_CONNECTION_FACTORY_H_ #define GOOGLE_APIS_GCM_ENGINE_FAKE_CONNECTION_FACTORY_H_ +#include "base/macros.h" #include "base/memory/scoped_ptr.h" #include "google_apis/gcm/engine/connection_factory.h" diff --git a/google_apis/gcm/engine/fake_connection_handler.h b/google_apis/gcm/engine/fake_connection_handler.h index f109478..1c79667 100644 --- a/google_apis/gcm/engine/fake_connection_handler.h +++ b/google_apis/gcm/engine/fake_connection_handler.h @@ -7,6 +7,7 @@ #include <list> +#include "base/macros.h" #include "google_apis/gcm/base/mcs_message.h" #include "google_apis/gcm/engine/connection_handler.h" diff --git a/google_apis/gcm/engine/gcm_registration_request_handler.h b/google_apis/gcm/engine/gcm_registration_request_handler.h index 934f927..523bdc1 100644 --- a/google_apis/gcm/engine/gcm_registration_request_handler.h +++ b/google_apis/gcm/engine/gcm_registration_request_handler.h @@ -5,6 +5,7 @@ #ifndef GOOGLE_APIS_GCM_ENGINE_GCM_REGISTRATION_REQUEST_HANDLER_H_ #define GOOGLE_APIS_GCM_ENGINE_GCM_REGISTRATION_REQUEST_HANDLER_H_ +#include "base/macros.h" #include "google_apis/gcm/engine/registration_request.h" namespace gcm { diff --git a/google_apis/gcm/engine/gcm_request_test_base.h b/google_apis/gcm/engine/gcm_request_test_base.h index 2af7b0a..d980568 100644 --- a/google_apis/gcm/engine/gcm_request_test_base.h +++ b/google_apis/gcm/engine/gcm_request_test_base.h @@ -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 "base/memory/ref_counted.h" #include "base/test/test_mock_time_task_runner.h" #include "base/thread_task_runner_handle.h" diff --git a/google_apis/gcm/engine/gcm_store.h b/google_apis/gcm/engine/gcm_store.h index 9375882..6395edf 100644 --- a/google_apis/gcm/engine/gcm_store.h +++ b/google_apis/gcm/engine/gcm_store.h @@ -11,9 +11,10 @@ #include <vector> #include <google/protobuf/message_lite.h> +#include <stdint.h> -#include "base/basictypes.h" #include "base/callback_forward.h" +#include "base/macros.h" #include "base/memory/linked_ptr.h" #include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" @@ -50,8 +51,8 @@ class GCM_EXPORT GCMStore { bool success; bool store_does_not_exist; - uint64 device_android_id; - uint64 device_security_token; + uint64_t device_android_id; + uint64_t device_security_token; std::map<std::string, std::string> registrations; std::vector<std::string> incoming_messages; OutgoingMessageMap outgoing_messages; @@ -83,8 +84,8 @@ class GCM_EXPORT GCMStore { virtual void Destroy(const UpdateCallback& callback) = 0; // Sets this device's messaging credentials. - virtual void SetDeviceCredentials(uint64 device_android_id, - uint64 device_security_token, + virtual void SetDeviceCredentials(uint64_t device_android_id, + uint64_t device_security_token, const UpdateCallback& callback) = 0; // Registration info for both GCM registrations and InstanceID tokens. diff --git a/google_apis/gcm/engine/gcm_store_impl.cc b/google_apis/gcm/engine/gcm_store_impl.cc index 3ad9b99..e3127b9 100644 --- a/google_apis/gcm/engine/gcm_store_impl.cc +++ b/google_apis/gcm/engine/gcm_store_impl.cc @@ -4,12 +4,12 @@ #include "google_apis/gcm/engine/gcm_store_impl.h" -#include "base/basictypes.h" #include "base/bind.h" #include "base/callback.h" #include "base/files/file_path.h" #include "base/files/file_util.h" #include "base/logging.h" +#include "base/macros.h" #include "base/metrics/histogram_macros.h" #include "base/profiler/scoped_tracker.h" #include "base/sequenced_task_runner.h" @@ -189,8 +189,8 @@ class GCMStoreImpl::Backend void Load(StoreOpenMode open_mode, const LoadCallback& callback); void Close(); void Destroy(const UpdateCallback& callback); - void SetDeviceCredentials(uint64 device_android_id, - uint64 device_security_token, + void SetDeviceCredentials(uint64_t device_android_id, + uint64_t device_security_token, const UpdateCallback& callback); void AddRegistration(const std::string& serialized_key, const std::string& serialized_value, @@ -209,7 +209,7 @@ class GCMStoreImpl::Backend const base::Callback<void(bool, const AppIdToMessageCountMap&)> callback); void AddUserSerialNumber(const std::string& username, - int64 serial_number, + int64_t serial_number, const UpdateCallback& callback); void RemoveUserSerialNumber(const std::string& username, const UpdateCallback& callback); @@ -245,7 +245,7 @@ class GCMStoreImpl::Backend ~Backend(); LoadStatus OpenStoreAndLoadData(StoreOpenMode open_mode, LoadResult* result); - bool LoadDeviceCredentials(uint64* android_id, uint64* security_token); + bool LoadDeviceCredentials(uint64_t* android_id, uint64_t* security_token); bool LoadRegistrations(std::map<std::string, std::string>* registrations); bool LoadIncomingMessages(std::vector<std::string>* incoming_messages); bool LoadOutgoingMessages(OutgoingMessageMap* outgoing_messages); @@ -366,7 +366,7 @@ void GCMStoreImpl::Backend::Load(StoreOpenMode open_mode, // Only record histograms if GCM had already been set up for this device. if (result->device_android_id != 0 && result->device_security_token != 0) { - int64 file_size = 0; + int64_t file_size = 0; if (base::GetFileSize(path_, &file_size)) { UMA_HISTOGRAM_COUNTS("GCM.StoreSizeKB", static_cast<int>(file_size / 1024)); @@ -418,8 +418,8 @@ void GCMStoreImpl::Backend::Destroy(const UpdateCallback& callback) { } void GCMStoreImpl::Backend::SetDeviceCredentials( - uint64 device_android_id, - uint64 device_security_token, + uint64_t device_android_id, + uint64_t device_security_token, const UpdateCallback& callback) { DVLOG(1) << "Saving device credentials with AID " << device_android_id; if (!db_.get()) { @@ -636,7 +636,7 @@ void GCMStoreImpl::Backend::SetLastCheckinInfo( const UpdateCallback& callback) { leveldb::WriteBatch write_batch; - int64 last_checkin_time_internal = time.ToInternalValue(); + int64_t last_checkin_time_internal = time.ToInternalValue(); write_batch.Put(MakeSlice(kLastCheckinTimeKey), MakeSlice(base::Int64ToString(last_checkin_time_internal))); @@ -899,8 +899,8 @@ void GCMStoreImpl::Backend::SetValue(const std::string& key, foreground_task_runner_->PostTask(FROM_HERE, base::Bind(callback, s.ok())); } -bool GCMStoreImpl::Backend::LoadDeviceCredentials(uint64* android_id, - uint64* security_token) { +bool GCMStoreImpl::Backend::LoadDeviceCredentials(uint64_t* android_id, + uint64_t* security_token) { leveldb::ReadOptions read_options; read_options.verify_checksums = true; @@ -991,7 +991,7 @@ bool GCMStoreImpl::Backend::LoadOutgoingMessages( LOG(ERROR) << "Error reading incoming message with key " << s.ToString(); return false; } - uint8 tag = iter->value().data()[0]; + uint8_t tag = iter->value().data()[0]; std::string id = ParseOutgoingKey(iter->key().ToString()); scoped_ptr<google::protobuf::MessageLite> message( BuildProtobufFromTag(tag)); @@ -1019,7 +1019,7 @@ bool GCMStoreImpl::Backend::LoadLastCheckinInfo( leveldb::Status s = db_->Get(read_options, MakeSlice(kLastCheckinTimeKey), &result); - int64 time_internal = 0LL; + int64_t time_internal = 0LL; if (s.ok() && !base::StringToInt64(result, &time_internal)) { LOG(ERROR) << "Failed to restore last checkin time. Using default = 0."; time_internal = 0LL; @@ -1100,7 +1100,7 @@ bool GCMStoreImpl::Backend::LoadLastTokenFetchTime( std::string result; leveldb::Status s = db_->Get(read_options, MakeSlice(kLastTokenFetchTimeKey), &result); - int64 time_internal = 0LL; + int64_t time_internal = 0LL; if (s.ok() && !base::StringToInt64(result, &time_internal)) { LOG(ERROR) << "Failed to restore last token fetching time. Using default = 0."; @@ -1197,8 +1197,8 @@ void GCMStoreImpl::Destroy(const UpdateCallback& callback) { base::Bind(&GCMStoreImpl::Backend::Destroy, backend_, callback)); } -void GCMStoreImpl::SetDeviceCredentials(uint64 device_android_id, - uint64 device_security_token, +void GCMStoreImpl::SetDeviceCredentials(uint64_t device_android_id, + uint64_t device_security_token, const UpdateCallback& callback) { blocking_task_runner_->PostTask( FROM_HERE, diff --git a/google_apis/gcm/engine/gcm_store_impl.h b/google_apis/gcm/engine/gcm_store_impl.h index af89cff..5fe06a5 100644 --- a/google_apis/gcm/engine/gcm_store_impl.h +++ b/google_apis/gcm/engine/gcm_store_impl.h @@ -5,7 +5,9 @@ #ifndef GOOGLE_APIS_GCM_ENGINE_GCM_STORE_IMPL_H_ #define GOOGLE_APIS_GCM_ENGINE_GCM_STORE_IMPL_H_ -#include "base/basictypes.h" +#include <stdint.h> + +#include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/memory/weak_ptr.h" #include "google_apis/gcm/base/gcm_export.h" @@ -44,8 +46,8 @@ class GCM_EXPORT GCMStoreImpl : public GCMStore { void Destroy(const UpdateCallback& callback) override; // Sets this device's messaging credentials. - void SetDeviceCredentials(uint64 device_android_id, - uint64 device_security_token, + void SetDeviceCredentials(uint64_t device_android_id, + uint64_t device_security_token, const UpdateCallback& callback) override; // Registration info. diff --git a/google_apis/gcm/engine/gcm_store_impl_unittest.cc b/google_apis/gcm/engine/gcm_store_impl_unittest.cc index 9b74855..62bee77 100644 --- a/google_apis/gcm/engine/gcm_store_impl_unittest.cc +++ b/google_apis/gcm/engine/gcm_store_impl_unittest.cc @@ -4,6 +4,8 @@ #include "google_apis/gcm/engine/gcm_store_impl.h" +#include <stdint.h> + #include <string> #include <vector> @@ -38,8 +40,8 @@ const char kAppName2[] = "my_app_2"; // Category name for testing. const char kCategoryName[] = "my_category"; -const uint64 kDeviceId = 22; -const uint64 kDeviceToken = 55; +const uint64_t kDeviceId = 22; +const uint64_t kDeviceToken = 55; class GCMStoreImplTest : public testing::Test { public: @@ -65,7 +67,7 @@ class GCMStoreImplTest : public testing::Test { base::ThreadTaskRunnerHandle task_runner_handle_; base::ScopedTempDir temp_directory_; bool expected_success_; - uint64 next_persistent_id_; + uint64_t next_persistent_id_; }; GCMStoreImplTest::GCMStoreImplTest() diff --git a/google_apis/gcm/engine/gcm_unregistration_request_handler.cc b/google_apis/gcm/engine/gcm_unregistration_request_handler.cc index 5d37382..2e1fde6 100644 --- a/google_apis/gcm/engine/gcm_unregistration_request_handler.cc +++ b/google_apis/gcm/engine/gcm_unregistration_request_handler.cc @@ -4,6 +4,7 @@ #include "google_apis/gcm/engine/gcm_unregistration_request_handler.h" +#include "base/macros.h" #include "base/metrics/histogram.h" #include "google_apis/gcm/base/gcm_util.h" #include "net/url_request/url_fetcher.h" diff --git a/google_apis/gcm/engine/gcm_unregistration_request_handler.h b/google_apis/gcm/engine/gcm_unregistration_request_handler.h index e66f355..b5a3b94 100644 --- a/google_apis/gcm/engine/gcm_unregistration_request_handler.h +++ b/google_apis/gcm/engine/gcm_unregistration_request_handler.h @@ -5,6 +5,7 @@ #ifndef GOOGLE_APIS_GCM_ENGINE_GCM_UNREGISTRATION_REQUEST_HANDLER_H_ #define GOOGLE_APIS_GCM_ENGINE_GCM_UNREGISTRATION_REQUEST_HANDLER_H_ +#include "base/macros.h" #include "google_apis/gcm/engine/unregistration_request.h" namespace gcm { diff --git a/google_apis/gcm/engine/gservices_settings.cc b/google_apis/gcm/engine/gservices_settings.cc index 1e3cf59..cde4d7fb 100644 --- a/google_apis/gcm/engine/gservices_settings.cc +++ b/google_apis/gcm/engine/gservices_settings.cc @@ -4,8 +4,11 @@ #include "google_apis/gcm/engine/gservices_settings.h" +#include <stdint.h> + #include "base/bind.h" #include "base/command_line.h" +#include "base/macros.h" #include "base/sha1.h" #include "base/strings/string_number_conversions.h" #include "base/strings/string_util.h" @@ -24,8 +27,8 @@ const char kMCSSecurePortKey[] = "gcm_secure_port"; // The URL to get MCS registration IDs. const char kRegistrationURLKey[] = "gcm_registration_url"; -const int64 kDefaultCheckinInterval = 2 * 24 * 60 * 60; // seconds = 2 days. -const int64 kMinimumCheckinInterval = 12 * 60 * 60; // seconds = 12 hours. +const int64_t kDefaultCheckinInterval = 2 * 24 * 60 * 60; // seconds = 2 days. +const int64_t kMinimumCheckinInterval = 12 * 60 * 60; // seconds = 12 hours. const char kDefaultCheckinURL[] = "https://android.clients.google.com/checkin"; const char kDefaultMCSHostname[] = "mtalk.google.com"; const int kDefaultMCSMainSecurePort = 5228; @@ -61,12 +64,12 @@ bool VerifyCheckinInterval( if (iter == settings.end()) return CanBeOmitted(kCheckinIntervalKey); - int64 checkin_interval = kMinimumCheckinInterval; + int64_t checkin_interval = kMinimumCheckinInterval; if (!base::StringToInt64(iter->second, &checkin_interval)) { DVLOG(1) << "Failed to parse checkin interval: " << iter->second; return false; } - if (checkin_interval == std::numeric_limits<int64>::max()) { + if (checkin_interval == std::numeric_limits<int64_t>::max()) { DVLOG(1) << "Checkin interval is too big: " << checkin_interval; return false; } @@ -264,7 +267,7 @@ void GServicesSettings::UpdateFromLoadResult( } base::TimeDelta GServicesSettings::GetCheckinInterval() const { - int64 checkin_interval = kMinimumCheckinInterval; + int64_t checkin_interval = kMinimumCheckinInterval; SettingsMap::const_iterator iter = settings_.find(kCheckinIntervalKey); if (iter == settings_.end() || !base::StringToInt64(iter->second, &checkin_interval)) { diff --git a/google_apis/gcm/engine/gservices_settings.h b/google_apis/gcm/engine/gservices_settings.h index 7811f9e..663b8b2 100644 --- a/google_apis/gcm/engine/gservices_settings.h +++ b/google_apis/gcm/engine/gservices_settings.h @@ -8,6 +8,7 @@ #include <map> #include <string> +#include "base/macros.h" #include "base/memory/weak_ptr.h" #include "base/time/time.h" #include "google_apis/gcm/base/gcm_export.h" diff --git a/google_apis/gcm/engine/gservices_settings_unittest.cc b/google_apis/gcm/engine/gservices_settings_unittest.cc index fcf633e..c6a8dad 100644 --- a/google_apis/gcm/engine/gservices_settings_unittest.cc +++ b/google_apis/gcm/engine/gservices_settings_unittest.cc @@ -2,6 +2,8 @@ // 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/strings/string_number_conversions.h" #include "google_apis/gcm/engine/gservices_settings.h" #include "testing/gtest/include/gtest/gtest.h" @@ -10,14 +12,14 @@ namespace gcm { namespace { -const int64 kAlternativeCheckinInterval = 16 * 60 * 60; +const int64_t kAlternativeCheckinInterval = 16 * 60 * 60; const char kAlternativeCheckinURL[] = "http://alternative.url/checkin"; const char kAlternativeMCSHostname[] = "alternative.gcm.host"; const int kAlternativeMCSSecurePort = 7777; const char kAlternativeRegistrationURL[] = "http://alternative.url/registration"; -const int64 kDefaultCheckinInterval = 2 * 24 * 60 * 60; // seconds = 2 days. +const int64_t kDefaultCheckinInterval = 2 * 24 * 60 * 60; // seconds = 2 days. const char kDefaultCheckinURL[] = "https://android.clients.google.com/checkin"; const char kDefaultRegistrationURL[] = "https://android.clients.google.com/c2dm/register3"; diff --git a/google_apis/gcm/engine/heartbeat_manager.cc b/google_apis/gcm/engine/heartbeat_manager.cc index 0e78b02..d7ec689 100644 --- a/google_apis/gcm/engine/heartbeat_manager.cc +++ b/google_apis/gcm/engine/heartbeat_manager.cc @@ -11,6 +11,7 @@ #include "base/thread_task_runner_handle.h" #include "base/time/time.h" #include "base/timer/timer.h" +#include "build/build_config.h" #include "google_apis/gcm/protocol/mcs.pb.h" #include "net/base/network_change_notifier.h" diff --git a/google_apis/gcm/engine/heartbeat_manager.h b/google_apis/gcm/engine/heartbeat_manager.h index 83a25cf..fe3bba6 100644 --- a/google_apis/gcm/engine/heartbeat_manager.h +++ b/google_apis/gcm/engine/heartbeat_manager.h @@ -7,6 +7,7 @@ #include "base/callback.h" #include "base/logging.h" +#include "base/macros.h" #include "base/memory/scoped_ptr.h" #include "base/memory/weak_ptr.h" #include "base/power_monitor/power_observer.h" diff --git a/google_apis/gcm/engine/instance_id_delete_token_request_handler.cc b/google_apis/gcm/engine/instance_id_delete_token_request_handler.cc index b7b745f..35dac62 100644 --- a/google_apis/gcm/engine/instance_id_delete_token_request_handler.cc +++ b/google_apis/gcm/engine/instance_id_delete_token_request_handler.cc @@ -4,6 +4,7 @@ #include "google_apis/gcm/engine/instance_id_delete_token_request_handler.h" +#include "base/macros.h" #include "base/metrics/histogram.h" #include "base/strings/string_number_conversions.h" #include "google_apis/gcm/base/gcm_util.h" diff --git a/google_apis/gcm/engine/instance_id_delete_token_request_handler.h b/google_apis/gcm/engine/instance_id_delete_token_request_handler.h index cd10d34..cb1ed06 100644 --- a/google_apis/gcm/engine/instance_id_delete_token_request_handler.h +++ b/google_apis/gcm/engine/instance_id_delete_token_request_handler.h @@ -7,6 +7,7 @@ #include <string> +#include "base/macros.h" #include "google_apis/gcm/engine/unregistration_request.h" namespace gcm { diff --git a/google_apis/gcm/engine/instance_id_get_token_request_handler.h b/google_apis/gcm/engine/instance_id_get_token_request_handler.h index de92ab9..b539c71 100644 --- a/google_apis/gcm/engine/instance_id_get_token_request_handler.h +++ b/google_apis/gcm/engine/instance_id_get_token_request_handler.h @@ -8,6 +8,7 @@ #include <map> #include <string> +#include "base/macros.h" #include "google_apis/gcm/engine/registration_request.h" namespace gcm { diff --git a/google_apis/gcm/engine/mcs_client.cc b/google_apis/gcm/engine/mcs_client.cc index 2e52ddb..9385451 100644 --- a/google_apis/gcm/engine/mcs_client.cc +++ b/google_apis/gcm/engine/mcs_client.cc @@ -4,9 +4,10 @@ #include "google_apis/gcm/engine/mcs_client.h" +#include <stddef.h> + #include <set> -#include "base/basictypes.h" #include "base/bind.h" #include "base/location.h" #include "base/metrics/histogram.h" @@ -86,12 +87,12 @@ class CollapseKey { std::string token() const { return token_; } std::string app_id() const { return app_id_; } - int64 device_user_id() const { return device_user_id_; } + int64_t device_user_id() const { return device_user_id_; } private: const std::string token_; const std::string app_id_; - const int64 device_user_id_; + const int64_t device_user_id_; }; CollapseKey::CollapseKey(const mcs_proto::DataMessageStanza& message) @@ -119,13 +120,13 @@ struct ReliablePacketInfo { ~ReliablePacketInfo(); // The stream id with which the message was sent. - uint32 stream_id; + uint32_t stream_id; // If reliable delivery was requested, the persistent id of the message. std::string persistent_id; // The type of message itself (for easier lookup). - uint8 tag; + uint8_t tag; // The protobuf of the message itself. MCSProto protobuf; @@ -227,12 +228,12 @@ void MCSClient::Initialize( restored_unackeds_server_ids_ = load_result->incoming_messages; // First go through and order the outgoing messages by recency. - std::map<uint64, google::protobuf::MessageLite*> ordered_messages; + std::map<uint64_t, google::protobuf::MessageLite*> ordered_messages; std::vector<PersistentId> expired_ttl_ids; for (GCMStore::OutgoingMessageMap::iterator iter = load_result->outgoing_messages.begin(); iter != load_result->outgoing_messages.end(); ++iter) { - uint64 timestamp = 0; + uint64_t timestamp = 0; if (!base::StringToUint64(iter->first, ×tamp)) { LOG(ERROR) << "Invalid restored message."; // TODO(fgorski): Error: data unreadable @@ -259,8 +260,8 @@ void MCSClient::Initialize( // Now go through and add the outgoing messages to the send queue in their // appropriate order (oldest at front, most recent at back). - for (std::map<uint64, google::protobuf::MessageLite*>::iterator - iter = ordered_messages.begin(); + for (std::map<uint64_t, google::protobuf::MessageLite*>::iterator iter = + ordered_messages.begin(); iter != ordered_messages.end(); ++iter) { ReliablePacketInfo* packet_info = new ReliablePacketInfo(); packet_info->protobuf.reset(iter->second); @@ -285,7 +286,7 @@ void MCSClient::Initialize( heartbeat_manager_.SetClientHeartbeatIntervalMs(min_interval_ms); } -void MCSClient::Login(uint64 android_id, uint64 security_token) { +void MCSClient::Login(uint64_t android_id, uint64_t security_token) { DCHECK_EQ(state_, LOADED); DCHECK(android_id_ == 0 || android_id_ == android_id); DCHECK(security_token_ == 0 || security_token_ == security_token); @@ -566,7 +567,7 @@ void MCSClient::SendPacketToWire(ReliablePacketInfo* packet_info) { mcs_proto::DataMessageStanza* data_message = reinterpret_cast<mcs_proto::DataMessageStanza*>( packet_info->protobuf.get()); - uint64 sent = data_message->sent(); + uint64_t sent = data_message->sent(); DCHECK_GT(sent, 0U); int queued = (clock_->Now().ToInternalValue() / base::Time::kMicrosecondsPerSecond) - sent; @@ -639,7 +640,7 @@ void MCSClient::HandlePacketFromWire( scoped_ptr<google::protobuf::MessageLite> protobuf) { if (!protobuf.get()) return; - uint8 tag = GetMCSProtoTag(*protobuf); + uint8_t tag = GetMCSProtoTag(*protobuf); PersistentId persistent_id = GetPersistentId(*protobuf); StreamId last_stream_id_received = GetLastStreamIdReceived(*protobuf); diff --git a/google_apis/gcm/engine/mcs_client.h b/google_apis/gcm/engine/mcs_client.h index 8d35fd4..d9ce4a6 100644 --- a/google_apis/gcm/engine/mcs_client.h +++ b/google_apis/gcm/engine/mcs_client.h @@ -5,12 +5,15 @@ #ifndef GOOGLE_APIS_GCM_ENGINE_MCS_CLIENT_H_ #define GOOGLE_APIS_GCM_ENGINE_MCS_CLIENT_H_ +#include <stdint.h> + #include <deque> #include <map> #include <string> #include <vector> #include "base/files/file_path.h" +#include "base/macros.h" #include "base/memory/linked_ptr.h" #include "base/memory/scoped_ptr.h" #include "base/memory/weak_ptr.h" @@ -91,11 +94,10 @@ class GCM_EXPORT MCSClient { OnMessageReceivedCallback; // Callback when a message is sent (and receipt has been acknowledged by // the MCS endpoint). - typedef base::Callback< - void(int64 user_serial_number, - const std::string& app_id, - const std::string& message_id, - MessageSendStatus status)> OnMessageSentCallback; + typedef base::Callback<void(int64_t user_serial_number, + const std::string& app_id, + const std::string& message_id, + MessageSendStatus status)> OnMessageSentCallback; MCSClient(const std::string& version_string, base::Clock* clock, @@ -125,7 +127,7 @@ class GCM_EXPORT MCSClient { // with a valid LoginResponse. // Login failure (typically invalid id/token) will shut down the client, and // |initialization_callback| to be invoked with |success = false|. - virtual void Login(uint64 android_id, uint64 security_token); + virtual void Login(uint64_t android_id, uint64_t security_token); // Sends a message, with or without reliable message queueing (RMQ) support. // Will asynchronously invoke the OnMessageSent callback regardless. @@ -165,7 +167,7 @@ class GCM_EXPORT MCSClient { } private: - typedef uint32 StreamId; + typedef uint32_t StreamId; typedef std::string PersistentId; typedef std::vector<StreamId> StreamIdList; typedef std::vector<PersistentId> PersistentIdList; @@ -244,8 +246,8 @@ class GCM_EXPORT MCSClient { OnMessageSentCallback message_sent_callback_; // The android id and security token in use by this device. - uint64 android_id_; - uint64 security_token_; + uint64_t android_id_; + uint64_t security_token_; // Factory for creating new connections and connection handlers. ConnectionFactory* connection_factory_; diff --git a/google_apis/gcm/engine/mcs_client_unittest.cc b/google_apis/gcm/engine/mcs_client_unittest.cc index 961c36d..b1b2941 100644 --- a/google_apis/gcm/engine/mcs_client_unittest.cc +++ b/google_apis/gcm/engine/mcs_client_unittest.cc @@ -4,6 +4,9 @@ #include "google_apis/gcm/engine/mcs_client.h" +#include <stddef.h> +#include <stdint.h> + #include "base/bind.h" #include "base/bind_helpers.h" #include "base/command_line.h" @@ -26,8 +29,8 @@ namespace gcm { namespace { -const uint64 kAndroidId = 54321; -const uint64 kSecurityToken = 12345; +const uint64_t kAndroidId = 54321; +const uint64_t kSecurityToken = 12345; // Number of messages to send when testing batching. // Note: must be even for tests that split batches in half. @@ -55,10 +58,10 @@ MCSMessage BuildDataMessage(const std::string& from, int last_stream_id_received, const std::string& persistent_id, int ttl, - uint64 sent, + uint64_t sent, int queued, const std::string& token, - const uint64& user_id, + const uint64_t& user_id, RequestImmediateAck immediate_ack) { mcs_proto::DataMessageStanza data_message; data_message.set_id(message_id); @@ -94,7 +97,7 @@ class TestMCSClient : public MCSClient { } private: - uint32 next_id_; + uint32_t next_id_; }; class TestConnectionListener : public ConnectionFactory::ConnectionListener { @@ -136,8 +139,8 @@ class MCSClientTest : public testing::Test { return &connection_factory_; } bool init_success() const { return init_success_; } - uint64 restored_android_id() const { return restored_android_id_; } - uint64 restored_security_token() const { return restored_security_token_; } + uint64_t restored_android_id() const { return restored_android_id_; } + uint64_t restored_security_token() const { return restored_security_token_; } MCSMessage* received_message() const { return received_message_.get(); } std::string sent_message_id() const { return sent_message_id_;} MCSClient::MessageSendStatus message_send_status() const { @@ -154,7 +157,7 @@ class MCSClientTest : public testing::Test { private: void ErrorCallback(); void MessageReceivedCallback(const MCSMessage& message); - void MessageSentCallback(int64 user_serial_number, + void MessageSentCallback(int64_t user_serial_number, const std::string& app_id, const std::string& message_id, MCSClient::MessageSendStatus status); @@ -169,8 +172,8 @@ class MCSClientTest : public testing::Test { FakeConnectionFactory connection_factory_; scoped_ptr<TestMCSClient> mcs_client_; bool init_success_; - uint64 restored_android_id_; - uint64 restored_security_token_; + uint64_t restored_android_id_; + uint64_t restored_security_token_; scoped_ptr<MCSMessage> received_message_; std::string sent_message_id_; MCSClient::MessageSendStatus message_send_status_; @@ -287,7 +290,7 @@ void MCSClientTest::MessageReceivedCallback(const MCSMessage& message) { run_loop_->Quit(); } -void MCSClientTest::MessageSentCallback(int64 user_serial_number, +void MCSClientTest::MessageSentCallback(int64_t user_serial_number, const std::string& app_id, const std::string& message_id, MCSClient::MessageSendStatus status) { diff --git a/google_apis/gcm/engine/registration_request.cc b/google_apis/gcm/engine/registration_request.cc index fa66a77..c0ed642 100644 --- a/google_apis/gcm/engine/registration_request.cc +++ b/google_apis/gcm/engine/registration_request.cc @@ -4,8 +4,11 @@ #include "google_apis/gcm/engine/registration_request.h" +#include <stddef.h> + #include "base/bind.h" #include "base/location.h" +#include "base/macros.h" #include "base/message_loop/message_loop.h" #include "base/metrics/histogram.h" #include "base/strings/string_number_conversions.h" @@ -69,13 +72,10 @@ bool ShouldRetryWithStatus(RegistrationRequest::Status status) { } // namespace -RegistrationRequest::RequestInfo::RequestInfo( - uint64 android_id, - uint64 security_token, - const std::string& app_id) - : android_id(android_id), - security_token(security_token), - app_id(app_id) { +RegistrationRequest::RequestInfo::RequestInfo(uint64_t android_id, + uint64_t security_token, + const std::string& app_id) + : android_id(android_id), security_token(security_token), app_id(app_id) { DCHECK(android_id != 0UL); DCHECK(security_token != 0UL); } diff --git a/google_apis/gcm/engine/registration_request.h b/google_apis/gcm/engine/registration_request.h index bcc3ee0..14427a7 100644 --- a/google_apis/gcm/engine/registration_request.h +++ b/google_apis/gcm/engine/registration_request.h @@ -5,12 +5,14 @@ #ifndef GOOGLE_APIS_GCM_ENGINE_REGISTRATION_REQUEST_H_ #define GOOGLE_APIS_GCM_ENGINE_REGISTRATION_REQUEST_H_ +#include <stdint.h> + #include <map> #include <string> #include <vector> -#include "base/basictypes.h" #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" @@ -63,15 +65,15 @@ class GCM_EXPORT RegistrationRequest : public net::URLFetcherDelegate { // Defines the common info about a registration/token request. All parameters // are mandatory. struct GCM_EXPORT RequestInfo { - RequestInfo(uint64 android_id, - uint64 security_token, + RequestInfo(uint64_t android_id, + uint64_t security_token, const std::string& app_id); ~RequestInfo(); // Android ID of the device. - uint64 android_id; + uint64_t android_id; // Security token of the device. - uint64 security_token; + uint64_t security_token; // Application ID. std::string app_id; }; diff --git a/google_apis/gcm/engine/registration_request_unittest.cc b/google_apis/gcm/engine/registration_request_unittest.cc index 495b1e1..a4e1039 100644 --- a/google_apis/gcm/engine/registration_request_unittest.cc +++ b/google_apis/gcm/engine/registration_request_unittest.cc @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include <stdint.h> + #include <map> #include <string> #include <vector> @@ -20,12 +22,12 @@ namespace gcm { namespace { -const uint64 kAndroidId = 42UL; +const uint64_t kAndroidId = 42UL; const char kAppId[] = "TestAppId"; const char kDeveloperId[] = "Project1"; const char kLoginHeader[] = "AidLogin"; const char kRegistrationURL[] = "http://foo.bar/register"; -const uint64 kSecurityToken = 77UL; +const uint64_t kSecurityToken = 77UL; const int kGCMVersion = 40; const char kInstanceId[] = "IID1"; const char kScope[] = "GCM"; diff --git a/google_apis/gcm/engine/unregistration_request.cc b/google_apis/gcm/engine/unregistration_request.cc index 6cde581..9e76807 100644 --- a/google_apis/gcm/engine/unregistration_request.cc +++ b/google_apis/gcm/engine/unregistration_request.cc @@ -35,13 +35,10 @@ const char kLoginHeader[] = "AidLogin"; } // namespace -UnregistrationRequest::RequestInfo::RequestInfo( - uint64 android_id, - uint64 security_token, - const std::string& app_id) - : android_id(android_id), - security_token(security_token), - app_id(app_id) { +UnregistrationRequest::RequestInfo::RequestInfo(uint64_t android_id, + uint64_t security_token, + const std::string& app_id) + : android_id(android_id), security_token(security_token), app_id(app_id) { DCHECK(android_id != 0UL); DCHECK(security_token != 0UL); } diff --git a/google_apis/gcm/engine/unregistration_request.h b/google_apis/gcm/engine/unregistration_request.h index b6b5eac..33c35b3 100644 --- a/google_apis/gcm/engine/unregistration_request.h +++ b/google_apis/gcm/engine/unregistration_request.h @@ -5,8 +5,10 @@ #ifndef GOOGLE_APIS_GCM_ENGINE_UNREGISTRATION_REQUEST_H_ #define GOOGLE_APIS_GCM_ENGINE_UNREGISTRATION_REQUEST_H_ -#include "base/basictypes.h" +#include <stdint.h> + #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" @@ -59,15 +61,15 @@ class GCM_EXPORT UnregistrationRequest : public net::URLFetcherDelegate { // Defines the common info about an unregistration/token-deletion request. // All parameters are mandatory. struct GCM_EXPORT RequestInfo { - RequestInfo(uint64 android_id, - uint64 security_token, + RequestInfo(uint64_t android_id, + uint64_t security_token, const std::string& app_id); ~RequestInfo(); // Android ID of the device. - uint64 android_id; + uint64_t android_id; // Security token of the device. - uint64 security_token; + uint64_t security_token; // Application ID. std::string app_id; }; diff --git a/google_apis/gcm/engine/unregistration_request_unittest.cc b/google_apis/gcm/engine/unregistration_request_unittest.cc index e6ca23d..0b30678 100644 --- a/google_apis/gcm/engine/unregistration_request_unittest.cc +++ b/google_apis/gcm/engine/unregistration_request_unittest.cc @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include <stdint.h> + #include <map> #include <string> #include <vector> @@ -18,13 +20,13 @@ namespace gcm { namespace { const int kMaxRetries = 2; -const uint64 kAndroidId = 42UL; +const uint64_t kAndroidId = 42UL; const char kLoginHeader[] = "AidLogin"; const char kAppId[] = "TestAppId"; const char kDeletedAppId[] = "deleted=TestAppId"; const char kDeletedToken[] = "token=SomeToken"; const char kRegistrationURL[] = "http://foo.bar/register"; -const uint64 kSecurityToken = 77UL; +const uint64_t kSecurityToken = 77UL; const int kGCMVersion = 40; const char kInstanceId[] = "IID1"; const char kDeveloperId[] = "Project1"; diff --git a/google_apis/gcm/monitoring/fake_gcm_stats_recorder.cc b/google_apis/gcm/monitoring/fake_gcm_stats_recorder.cc index e61570a..5b138d2 100644 --- a/google_apis/gcm/monitoring/fake_gcm_stats_recorder.cc +++ b/google_apis/gcm/monitoring/fake_gcm_stats_recorder.cc @@ -12,11 +12,10 @@ FakeGCMStatsRecorder::FakeGCMStatsRecorder() { FakeGCMStatsRecorder::~FakeGCMStatsRecorder() { } -void FakeGCMStatsRecorder::RecordCheckinInitiated(uint64 android_id) { -} +void FakeGCMStatsRecorder::RecordCheckinInitiated(uint64_t android_id) {} -void FakeGCMStatsRecorder::RecordCheckinDelayedDueToBackoff(int64 delay_msec) { -} +void FakeGCMStatsRecorder::RecordCheckinDelayedDueToBackoff( + int64_t delay_msec) {} void FakeGCMStatsRecorder::RecordCheckinSuccess() { } @@ -28,8 +27,7 @@ void FakeGCMStatsRecorder::RecordConnectionInitiated(const std::string& host) { } void FakeGCMStatsRecorder::RecordConnectionDelayedDueToBackoff( - int64 delay_msec) { -} + int64_t delay_msec) {} void FakeGCMStatsRecorder::RecordConnectionSuccess() { } @@ -55,9 +53,8 @@ void FakeGCMStatsRecorder::RecordRegistrationResponse( void FakeGCMStatsRecorder::RecordRegistrationRetryDelayed( const std::string& app_id, const std::string& source, - int64 delay_msec, - int retries_left) { -} + int64_t delay_msec, + int retries_left) {} void FakeGCMStatsRecorder::RecordUnregistrationSent( const std::string& app_id, const std::string& source) { @@ -72,9 +69,8 @@ void FakeGCMStatsRecorder::RecordUnregistrationResponse( void FakeGCMStatsRecorder::RecordUnregistrationRetryDelayed( const std::string& app_id, const std::string& source, - int64 delay_msec, - int retries_left) { -} + int64_t delay_msec, + int retries_left) {} void FakeGCMStatsRecorder::RecordDataMessageReceived( const std::string& app_id, diff --git a/google_apis/gcm/monitoring/fake_gcm_stats_recorder.h b/google_apis/gcm/monitoring/fake_gcm_stats_recorder.h index e0350f4..8e10231 100644 --- a/google_apis/gcm/monitoring/fake_gcm_stats_recorder.h +++ b/google_apis/gcm/monitoring/fake_gcm_stats_recorder.h @@ -5,6 +5,9 @@ #ifndef GOOGLE_APIS_GCM_MONITORING_FAKE_GCM_STATS_RECODER_H_ #define GOOGLE_APIS_GCM_MONITORING_FAKE_GCM_STATS_RECODER_H_ +#include <stdint.h> + +#include "base/macros.h" #include "google_apis/gcm/monitoring/gcm_stats_recorder.h" namespace gcm { @@ -15,13 +18,13 @@ class FakeGCMStatsRecorder : public GCMStatsRecorder { FakeGCMStatsRecorder(); ~FakeGCMStatsRecorder() override; - void RecordCheckinInitiated(uint64 android_id) override; - void RecordCheckinDelayedDueToBackoff(int64 delay_msec) override; + void RecordCheckinInitiated(uint64_t android_id) override; + void RecordCheckinDelayedDueToBackoff(int64_t delay_msec) override; void RecordCheckinSuccess() override; void RecordCheckinFailure(const std::string& status, bool will_retry) override; void RecordConnectionInitiated(const std::string& host) override; - void RecordConnectionDelayedDueToBackoff(int64 delay_msec) override; + void RecordConnectionDelayedDueToBackoff(int64_t delay_msec) override; void RecordConnectionSuccess() override; void RecordConnectionFailure(int network_error) override; void RecordConnectionResetSignaled( @@ -31,11 +34,10 @@ class FakeGCMStatsRecorder : public GCMStatsRecorder { void RecordRegistrationResponse(const std::string& app_id, const std::string& source, RegistrationRequest::Status status) override; - void RecordRegistrationRetryDelayed( - const std::string& app_id, - const std::string& source, - int64 delay_msec, - int retries_left) override; + void RecordRegistrationRetryDelayed(const std::string& app_id, + const std::string& source, + int64_t delay_msec, + int retries_left) override; void RecordUnregistrationSent( const std::string& app_id, const std::string& source) override; @@ -45,7 +47,7 @@ class FakeGCMStatsRecorder : public GCMStatsRecorder { UnregistrationRequest::Status status) override; void RecordUnregistrationRetryDelayed(const std::string& app_id, const std::string& source, - int64 delay_msec, + int64_t delay_msec, int retries_left) override; void RecordDataMessageReceived(const std::string& app_id, const std::string& from, diff --git a/google_apis/gcm/monitoring/gcm_stats_recorder.h b/google_apis/gcm/monitoring/gcm_stats_recorder.h index 72c4446..aee9179 100644 --- a/google_apis/gcm/monitoring/gcm_stats_recorder.h +++ b/google_apis/gcm/monitoring/gcm_stats_recorder.h @@ -5,6 +5,8 @@ #ifndef GOOGLE_APIS_GCM_MONITORING_GCM_STATS_RECORDER_H_ #define GOOGLE_APIS_GCM_MONITORING_GCM_STATS_RECORDER_H_ +#include <stdint.h> + #include <string> #include <vector> @@ -42,10 +44,10 @@ class GCM_EXPORT GCMStatsRecorder { virtual ~GCMStatsRecorder() {} // Records that a check-in has been initiated. - virtual void RecordCheckinInitiated(uint64 android_id) = 0; + virtual void RecordCheckinInitiated(uint64_t android_id) = 0; // Records that a check-in has been delayed due to backoff. - virtual void RecordCheckinDelayedDueToBackoff(int64 delay_msec) = 0; + virtual void RecordCheckinDelayedDueToBackoff(int64_t delay_msec) = 0; // Records that a check-in request has succeeded. virtual void RecordCheckinSuccess() = 0; @@ -59,7 +61,7 @@ class GCM_EXPORT GCMStatsRecorder { virtual void RecordConnectionInitiated(const std::string& host) = 0; // Records that a connection has been delayed due to backoff. - virtual void RecordConnectionDelayedDueToBackoff(int64 delay_msec) = 0; + virtual void RecordConnectionDelayedDueToBackoff(int64_t delay_msec) = 0; // Records that connection has been successfully established. virtual void RecordConnectionSuccess() = 0; @@ -84,11 +86,10 @@ class GCM_EXPORT GCMStatsRecorder { // Records that a registration retry has been requested and delayed due to // backoff logic. - virtual void RecordRegistrationRetryDelayed( - const std::string& app_id, - const std::string& source, - int64 delay_msec, - int retries_left) = 0; + virtual void RecordRegistrationRetryDelayed(const std::string& app_id, + const std::string& source, + int64_t delay_msec, + int retries_left) = 0; // Records that an unregistration request has been sent. This could be // initiated directly from API, or from retry logic. @@ -105,7 +106,7 @@ class GCM_EXPORT GCMStatsRecorder { // backoff logic. virtual void RecordUnregistrationRetryDelayed(const std::string& app_id, const std::string& source, - int64 delay_msec, + int64_t delay_msec, int retries_left) = 0; // Records that a data message has been received. If this message is not diff --git a/google_apis/gcm/tools/mcs_probe.cc b/google_apis/gcm/tools/mcs_probe.cc index 20bcffd..230d6a1 100644 --- a/google_apis/gcm/tools/mcs_probe.cc +++ b/google_apis/gcm/tools/mcs_probe.cc @@ -5,6 +5,8 @@ // A standalone tool for testing MCS connections and the MCS client on their // own. +#include <stdint.h> + #include <cstddef> #include <cstdio> #include <string> @@ -25,6 +27,7 @@ #include "base/threading/worker_pool.h" #include "base/time/default_clock.h" #include "base/values.h" +#include "build/build_config.h" #include "google_apis/gcm/base/fake_encryptor.h" #include "google_apis/gcm/base/mcs_message.h" #include "google_apis/gcm/base/mcs_util.h" @@ -90,7 +93,7 @@ const char kChromeVersion[] = "Chrome MCS Probe"; // The default server to communicate with. const char kMCSServerHost[] = "mtalk.google.com"; -const uint16 kMCSServerPort = 5228; +const uint16_t kMCSServerPort = 5228; // Command line switches. const char kRMQFileName[] = "rmq_file"; @@ -122,7 +125,7 @@ void MessageReceivedCallback(const MCSMessage& message) { } } -void MessageSentCallback(int64 user_serial_number, +void MessageSentCallback(int64_t user_serial_number, const std::string& app_id, const std::string& message_id, MCSClient::MessageSendStatus status) { @@ -215,8 +218,8 @@ class MCSProbe { void Start(); - uint64 android_id() const { return android_id_; } - uint64 secret() const { return secret_; } + uint64_t android_id() const { return android_id_; } + uint64_t secret() const { return secret_; } private: void CheckIn(); @@ -235,8 +238,8 @@ class MCSProbe { base::CommandLine command_line_; base::FilePath gcm_store_path_; - uint64 android_id_; - uint64 secret_; + uint64_t android_id_; + uint64_t secret_; std::string server_host_; int server_port_; diff --git a/google_apis/google_api_keys.cc b/google_apis/google_api_keys.cc index f919630..52542cf 100644 --- a/google_apis/google_api_keys.cc +++ b/google_apis/google_api_keys.cc @@ -6,6 +6,9 @@ // If you add more includes to this list, you also need to add them to // google_api_keys_unittest.cc. + +#include <stddef.h> + #include "base/command_line.h" #include "base/environment.h" #include "base/lazy_instance.h" diff --git a/google_apis/google_api_keys_unittest.cc b/google_apis/google_api_keys_unittest.cc index e889179..45dfa81 100644 --- a/google_apis/google_api_keys_unittest.cc +++ b/google_apis/google_api_keys_unittest.cc @@ -12,6 +12,7 @@ #include "google_apis/google_api_keys.h" +#include "base/macros.h" #include "build/build_config.h" #include "google_apis/gaia/gaia_switches.h" #include "testing/gtest/include/gtest/gtest.h" @@ -30,6 +31,9 @@ // below. We used to include that file in its entirety here, but that // can cause problems if the linker decides the version of symbols // from that file included here is the "right" version. + +#include <stddef.h> + #include <string> #include "base/command_line.h" #include "base/environment.h" |