diff options
Diffstat (limited to 'storage')
156 files changed, 927 insertions, 616 deletions
diff --git a/storage/browser/blob/blob_async_builder_host.cc b/storage/browser/blob/blob_async_builder_host.cc index 1cd2e77..6d44327 100644 --- a/storage/browser/blob/blob_async_builder_host.cc +++ b/storage/browser/blob/blob_async_builder_host.cc @@ -4,6 +4,9 @@ #include "storage/browser/blob/blob_async_builder_host.h" +#include <stddef.h> +#include <stdint.h> + #include <utility> #include "base/memory/shared_memory.h" diff --git a/storage/browser/blob/blob_async_builder_host.h b/storage/browser/blob/blob_async_builder_host.h index 0e4a0d4..c84f2b5 100644 --- a/storage/browser/blob/blob_async_builder_host.h +++ b/storage/browser/blob/blob_async_builder_host.h @@ -5,6 +5,9 @@ #ifndef STORAGE_BROWSER_BLOB_BLOB_ASYNC_BUILDER_HOST_H_ #define STORAGE_BROWSER_BLOB_BLOB_ASYNC_BUILDER_HOST_H_ +#include <stddef.h> +#include <stdint.h> + #include <map> #include <string> #include <vector> diff --git a/storage/browser/blob/blob_async_transport_strategy.cc b/storage/browser/blob/blob_async_transport_strategy.cc index 8dbe52e..edae52c 100644 --- a/storage/browser/blob/blob_async_transport_strategy.cc +++ b/storage/browser/blob/blob_async_transport_strategy.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 <algorithm> #include "base/numerics/safe_math.h" diff --git a/storage/browser/blob/blob_async_transport_strategy.h b/storage/browser/blob/blob_async_transport_strategy.h index fe8d374..3e07771 100644 --- a/storage/browser/blob/blob_async_transport_strategy.h +++ b/storage/browser/blob/blob_async_transport_strategy.h @@ -5,6 +5,9 @@ #ifndef STORAGE_BROWSER_BLOB_BLOB_ASYNC_TRANSPORT_STRATEGY_H_ #define STORAGE_BROWSER_BLOB_BLOB_ASYNC_TRANSPORT_STRATEGY_H_ +#include <stddef.h> +#include <stdint.h> + #include <map> #include <vector> diff --git a/storage/browser/blob/blob_data_builder.cc b/storage/browser/blob/blob_data_builder.cc index 69d9773..d40d418 100644 --- a/storage/browser/blob/blob_data_builder.cc +++ b/storage/browser/blob/blob_data_builder.cc @@ -4,6 +4,9 @@ #include "storage/browser/blob/blob_data_builder.h" +#include <stddef.h> +#include <stdint.h> + #include "base/numerics/safe_conversions.h" #include "base/numerics/safe_math.h" #include "base/time/time.h" @@ -21,11 +24,12 @@ BlobDataBuilder::~BlobDataBuilder() { } void BlobDataBuilder::AppendIPCDataElement(const DataElement& ipc_data) { - uint64 length = ipc_data.length(); + uint64_t length = ipc_data.length(); switch (ipc_data.type()) { case DataElement::TYPE_BYTES: DCHECK(!ipc_data.offset()); - AppendData(ipc_data.bytes(), base::checked_cast<size_t, uint64>(length)); + AppendData(ipc_data.bytes(), + base::checked_cast<size_t, uint64_t>(length)); break; case DataElement::TYPE_FILE: AppendFile(ipc_data.path(), ipc_data.offset(), length, diff --git a/storage/browser/blob/blob_data_builder.h b/storage/browser/blob/blob_data_builder.h index f075c21..0960188 100644 --- a/storage/browser/blob/blob_data_builder.h +++ b/storage/browser/blob/blob_data_builder.h @@ -5,13 +5,14 @@ #ifndef STORAGE_BROWSER_BLOB_BLOB_DATA_BUILDER_H_ #define STORAGE_BROWSER_BLOB_BLOB_DATA_BUILDER_H_ +#include <stddef.h> #include <stdint.h> #include <ostream> #include <string> #include <vector> -#include "base/basictypes.h" #include "base/files/file_path.h" +#include "base/macros.h" #include "base/memory/ref_counted.h" #include "storage/browser/blob/blob_data_item.h" #include "storage/browser/blob/blob_data_snapshot.h" diff --git a/storage/browser/blob/blob_data_handle.cc b/storage/browser/blob/blob_data_handle.cc index 3e864fa..efc757e 100644 --- a/storage/browser/blob/blob_data_handle.cc +++ b/storage/browser/blob/blob_data_handle.cc @@ -4,9 +4,12 @@ #include "storage/browser/blob/blob_data_handle.h" +#include <stdint.h> + #include "base/bind.h" #include "base/location.h" #include "base/logging.h" +#include "base/macros.h" #include "base/sequenced_task_runner.h" #include "base/task_runner.h" #include "base/time/time.h" diff --git a/storage/browser/blob/blob_data_handle.h b/storage/browser/blob/blob_data_handle.h index 8eba2c6..7d0bef8 100644 --- a/storage/browser/blob/blob_data_handle.h +++ b/storage/browser/blob/blob_data_handle.h @@ -7,6 +7,7 @@ #include <string> +#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/storage/browser/blob/blob_data_item.h b/storage/browser/blob/blob_data_item.h index 9de0be9..c0495c3 100644 --- a/storage/browser/blob/blob_data_item.h +++ b/storage/browser/blob/blob_data_item.h @@ -5,10 +5,11 @@ #ifndef STORAGE_BROWSER_BLOB_BLOB_DATA_ITEM_H_ #define STORAGE_BROWSER_BLOB_BLOB_DATA_ITEM_H_ +#include <stdint.h> + #include <ostream> #include <string> -#include "base/basictypes.h" #include "base/memory/ref_counted.h" #include "storage/browser/storage_browser_export.h" #include "storage/common/data_element.h" @@ -46,8 +47,8 @@ class STORAGE_EXPORT BlobDataItem : public base::RefCounted<BlobDataItem> { const base::FilePath& path() const { return item_->path(); } const GURL& filesystem_url() const { return item_->filesystem_url(); } const std::string& blob_uuid() const { return item_->blob_uuid(); } - uint64 offset() const { return item_->offset(); } - uint64 length() const { return item_->length(); } + uint64_t offset() const { return item_->offset(); } + uint64_t length() const { return item_->length(); } const base::Time& expected_modification_time() const { return item_->expected_modification_time(); } diff --git a/storage/browser/blob/blob_data_snapshot.cc b/storage/browser/blob/blob_data_snapshot.cc index 8eb8ee2..0071a11 100644 --- a/storage/browser/blob/blob_data_snapshot.cc +++ b/storage/browser/blob/blob_data_snapshot.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 "storage/browser/blob/blob_data_snapshot.h" namespace storage { @@ -36,7 +39,7 @@ BlobDataSnapshot::~BlobDataSnapshot() { } size_t BlobDataSnapshot::GetMemoryUsage() const { - int64 memory = 0; + int64_t memory = 0; for (const auto& data_item : items_) { if (data_item->type() == DataElement::TYPE_BYTES) memory += data_item->length(); diff --git a/storage/browser/blob/blob_data_snapshot.h b/storage/browser/blob/blob_data_snapshot.h index 01ea2ef..31b2973 100644 --- a/storage/browser/blob/blob_data_snapshot.h +++ b/storage/browser/blob/blob_data_snapshot.h @@ -5,6 +5,8 @@ #ifndef STORAGE_BROWSER_BLOB_BLOB_DATA_SNAPSHOT_H_ #define STORAGE_BROWSER_BLOB_BLOB_DATA_SNAPSHOT_H_ +#include <stddef.h> + #include <string> #include <vector> diff --git a/storage/browser/blob/blob_reader.cc b/storage/browser/blob/blob_reader.cc index 9c6375d..8a38bfe 100644 --- a/storage/browser/blob/blob_reader.cc +++ b/storage/browser/blob/blob_reader.cc @@ -4,6 +4,9 @@ #include "storage/browser/blob/blob_reader.h" +#include <stddef.h> +#include <stdint.h> + #include <algorithm> #include <limits> @@ -240,11 +243,11 @@ bool BlobReader::ResolveFileItemLength(const BlobDataItem& item, return false; } - uint64 max_length = file_length - item_offset; + uint64_t max_length = file_length - item_offset; // If item length is undefined, then we need to use the file size being // resolved in the real time. - if (item_length == std::numeric_limits<uint64>::max()) { + if (item_length == std::numeric_limits<uint64_t>::max()) { item_length = max_length; } else if (item_length > max_length) { return false; diff --git a/storage/browser/blob/blob_reader.h b/storage/browser/blob/blob_reader.h index 54b262f..0756f0f 100644 --- a/storage/browser/blob/blob_reader.h +++ b/storage/browser/blob/blob_reader.h @@ -5,6 +5,7 @@ #ifndef STORAGE_BROWSER_BLOB_BLOB_READER_H_ #define STORAGE_BROWSER_BLOB_BLOB_READER_H_ +#include <stddef.h> #include <stdint.h> #include <map> #include <vector> diff --git a/storage/browser/blob/blob_storage_context.cc b/storage/browser/blob/blob_storage_context.cc index 27db3cf..e9e9601 100644 --- a/storage/browser/blob/blob_storage_context.cc +++ b/storage/browser/blob/blob_storage_context.cc @@ -4,6 +4,9 @@ #include "storage/browser/blob/blob_storage_context.h" +#include <stddef.h> +#include <stdint.h> + #include <algorithm> #include <limits> @@ -41,7 +44,7 @@ GURL ClearBlobUrlRef(const GURL& url) { // TODO(michaeln): use base::SysInfo::AmountOfPhysicalMemoryMB() in some // way to come up with a better limit. -static const int64 kMaxMemoryUsage = 500 * 1024 * 1024; // Half a gig. +static const int64_t kMaxMemoryUsage = 500 * 1024 * 1024; // Half a gig. } // namespace @@ -264,7 +267,7 @@ scoped_refptr<BlobDataItem> BlobStorageContext::AllocateBlobItem( const DataElement& ipc_data) { scoped_refptr<BlobDataItem> blob_item; - uint64 length = ipc_data.length(); + uint64_t length = ipc_data.length(); scoped_ptr<DataElement> element(new DataElement()); switch (ipc_data.type()) { case DataElement::TYPE_BYTES: @@ -321,8 +324,8 @@ bool BlobStorageContext::AppendAllocatedBlobItem( // portion of the item is copied. const DataElement& data_element = blob_item->data_element(); - uint64 length = data_element.length(); - uint64 offset = data_element.offset(); + uint64_t length = data_element.length(); + uint64_t offset = data_element.offset(); UMA_HISTOGRAM_COUNTS("Storage.Blob.StorageSizeBeforeAppend", memory_usage_ / 1024); switch (data_element.type()) { @@ -338,7 +341,7 @@ bool BlobStorageContext::AppendAllocatedBlobItem( new ShareableBlobDataItem(target_blob_uuid, blob_item)); break; case DataElement::TYPE_FILE: { - bool full_file = (length == std::numeric_limits<uint64>::max()); + bool full_file = (length == std::numeric_limits<uint64_t>::max()); UMA_HISTOGRAM_BOOLEAN("Storage.BlobItemSize.File.Unknown", full_file); if (!full_file) { UMA_HISTOGRAM_COUNTS("Storage.BlobItemSize.File", @@ -349,7 +352,7 @@ bool BlobStorageContext::AppendAllocatedBlobItem( break; } case DataElement::TYPE_FILE_FILESYSTEM: { - bool full_file = (length == std::numeric_limits<uint64>::max()); + bool full_file = (length == std::numeric_limits<uint64_t>::max()); UMA_HISTOGRAM_BOOLEAN("Storage.BlobItemSize.FileSystem.Unknown", full_file); if (!full_file) { @@ -441,13 +444,13 @@ bool BlobStorageContext::AppendBlob( DCHECK(!item.offset()); scoped_ptr<DataElement> element(new DataElement()); element->SetToBytes(item.bytes() + offset, - static_cast<int64>(new_length)); + static_cast<int64_t>(new_length)); memory_usage_ += new_length; target_blob_builder->AppendSharedBlobItem(new ShareableBlobDataItem( target_blob_uuid, new BlobDataItem(element.Pass()))); } break; case DataElement::TYPE_FILE: { - DCHECK_NE(item.length(), std::numeric_limits<uint64>::max()) + DCHECK_NE(item.length(), std::numeric_limits<uint64_t>::max()) << "We cannot use a section of a file with an unknown length"; UMA_HISTOGRAM_COUNTS("Storage.BlobItemSize.BlobSlice.File", new_length / 1024); diff --git a/storage/browser/blob/blob_storage_context.h b/storage/browser/blob/blob_storage_context.h index eba8abe..54cff9b 100644 --- a/storage/browser/blob/blob_storage_context.h +++ b/storage/browser/blob/blob_storage_context.h @@ -5,10 +5,14 @@ #ifndef STORAGE_BROWSER_BLOB_BLOB_STORAGE_CONTEXT_H_ #define STORAGE_BROWSER_BLOB_BLOB_STORAGE_CONTEXT_H_ +#include <stddef.h> +#include <stdint.h> + #include <map> #include <string> #include <vector> +#include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/memory/weak_ptr.h" #include "storage/browser/blob/blob_data_handle.h" diff --git a/storage/browser/blob/blob_storage_registry.cc b/storage/browser/blob/blob_storage_registry.cc index 805a677d..8ee624f 100644 --- a/storage/browser/blob/blob_storage_registry.cc +++ b/storage/browser/blob/blob_storage_registry.cc @@ -4,6 +4,8 @@ #include "storage/browser/blob/blob_storage_registry.h" +#include <stddef.h> + #include "base/bind.h" #include "base/callback.h" #include "base/location.h" diff --git a/storage/browser/blob/blob_storage_registry.h b/storage/browser/blob/blob_storage_registry.h index 8a79493..54e8b0e 100644 --- a/storage/browser/blob/blob_storage_registry.h +++ b/storage/browser/blob/blob_storage_registry.h @@ -5,6 +5,8 @@ #ifndef STORAGE_BROWSER_BLOB_BLOB_STORAGE_REGISTRY_H_ #define STORAGE_BROWSER_BLOB_BLOB_STORAGE_REGISTRY_H_ +#include <stddef.h> + #include <map> #include <string> #include <vector> diff --git a/storage/browser/blob/blob_url_request_job.cc b/storage/browser/blob/blob_url_request_job.cc index deea300..783c386 100644 --- a/storage/browser/blob/blob_url_request_job.cc +++ b/storage/browser/blob/blob_url_request_job.cc @@ -4,12 +4,13 @@ #include "storage/browser/blob/blob_url_request_job.h" +#include <stdint.h> + #include <algorithm> #include <limits> #include <string> #include <vector> -#include "base/basictypes.h" #include "base/bind.h" #include "base/compiler_specific.h" #include "base/files/file_util_proxy.h" diff --git a/storage/browser/blob/blob_url_request_job.h b/storage/browser/blob/blob_url_request_job.h index 1f0b9fb..70f0356 100644 --- a/storage/browser/blob/blob_url_request_job.h +++ b/storage/browser/blob/blob_url_request_job.h @@ -5,9 +5,12 @@ #ifndef STORAGE_BROWSER_BLOB_BLOB_URL_REQUEST_JOB_H_ #define STORAGE_BROWSER_BLOB_BLOB_URL_REQUEST_JOB_H_ +#include <stddef.h> + #include <map> #include <vector> +#include "base/macros.h" #include "base/memory/scoped_ptr.h" #include "base/memory/weak_ptr.h" #include "net/http/http_byte_range.h" diff --git a/storage/browser/blob/blob_url_request_job_factory.cc b/storage/browser/blob/blob_url_request_job_factory.cc index 5961697..7e814d4 100644 --- a/storage/browser/blob/blob_url_request_job_factory.cc +++ b/storage/browser/blob/blob_url_request_job_factory.cc @@ -4,7 +4,6 @@ #include "storage/browser/blob/blob_url_request_job_factory.h" -#include "base/basictypes.h" #include "base/strings/string_util.h" #include "net/base/request_priority.h" #include "net/url_request/url_request_context.h" diff --git a/storage/browser/blob/blob_url_request_job_factory.h b/storage/browser/blob/blob_url_request_job_factory.h index dcb2fd6..326da9b 100644 --- a/storage/browser/blob/blob_url_request_job_factory.h +++ b/storage/browser/blob/blob_url_request_job_factory.h @@ -6,6 +6,7 @@ #define STORAGE_BROWSER_BLOB_BLOB_URL_REQUEST_JOB_FACTORY_H_ #include "base/compiler_specific.h" +#include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" #include "net/url_request/url_request.h" diff --git a/storage/browser/blob/internal_blob_data.cc b/storage/browser/blob/internal_blob_data.cc index 8441f89..fae109a 100644 --- a/storage/browser/blob/internal_blob_data.cc +++ b/storage/browser/blob/internal_blob_data.cc @@ -4,6 +4,8 @@ #include "storage/browser/blob/internal_blob_data.h" +#include <stddef.h> + #include "base/containers/hash_tables.h" #include "base/metrics/histogram.h" #include "storage/browser/blob/blob_data_item.h" diff --git a/storage/browser/blob/internal_blob_data.h b/storage/browser/blob/internal_blob_data.h index 7ec2bf8..c751762a 100644 --- a/storage/browser/blob/internal_blob_data.h +++ b/storage/browser/blob/internal_blob_data.h @@ -5,6 +5,8 @@ #ifndef STORAGE_BROWSER_BLOB_INTERNAL_BLOB_DATA_H_ #define STORAGE_BROWSER_BLOB_INTERNAL_BLOB_DATA_H_ +#include <stddef.h> + #include <string> #include <vector> diff --git a/storage/browser/blob/shareable_file_reference.cc b/storage/browser/blob/shareable_file_reference.cc index e660239..187ea70 100644 --- a/storage/browser/blob/shareable_file_reference.cc +++ b/storage/browser/blob/shareable_file_reference.cc @@ -7,6 +7,7 @@ #include <map> #include "base/lazy_instance.h" +#include "base/macros.h" #include "base/task_runner.h" #include "base/threading/non_thread_safe.h" diff --git a/storage/browser/blob/shareable_file_reference.h b/storage/browser/blob/shareable_file_reference.h index 10f986f..084c46f 100644 --- a/storage/browser/blob/shareable_file_reference.h +++ b/storage/browser/blob/shareable_file_reference.h @@ -5,6 +5,7 @@ #ifndef STORAGE_BROWSER_BLOB_SHAREABLE_FILE_REFERENCE_H_ #define STORAGE_BROWSER_BLOB_SHAREABLE_FILE_REFERENCE_H_ +#include "base/macros.h" #include "storage/browser/blob/blob_data_item.h" #include "storage/browser/blob/scoped_file.h" #include "storage/browser/storage_browser_export.h" diff --git a/storage/browser/blob/upload_blob_element_reader.cc b/storage/browser/blob/upload_blob_element_reader.cc index e4d6d4a..d44f840 100644 --- a/storage/browser/blob/upload_blob_element_reader.cc +++ b/storage/browser/blob/upload_blob_element_reader.cc @@ -4,6 +4,8 @@ #include "storage/browser/blob/upload_blob_element_reader.h" +#include <stdint.h> + #include "base/single_thread_task_runner.h" #include "net/base/net_errors.h" #include "storage/browser/blob/blob_data_handle.h" diff --git a/storage/browser/blob/upload_blob_element_reader.h b/storage/browser/blob/upload_blob_element_reader.h index 47ff90d..f8192d0 100644 --- a/storage/browser/blob/upload_blob_element_reader.h +++ b/storage/browser/blob/upload_blob_element_reader.h @@ -5,6 +5,8 @@ #ifndef STORAGE_BROWSER_BLOB_UPLOAD_BLOB_ELEMENT_READER_H_ #define STORAGE_BROWSER_BLOB_UPLOAD_BLOB_ELEMENT_READER_H_ +#include <stdint.h> + #include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" diff --git a/storage/browser/blob/view_blob_internals_job.cc b/storage/browser/blob/view_blob_internals_job.cc index 185338b..cf18d3e 100644 --- a/storage/browser/blob/view_blob_internals_job.cc +++ b/storage/browser/blob/view_blob_internals_job.cc @@ -4,6 +4,9 @@ #include "storage/browser/blob/view_blob_internals_job.h" +#include <stddef.h> +#include <stdint.h> + #include "base/bind.h" #include "base/compiler_specific.h" #include "base/format_macros.h" @@ -230,11 +233,13 @@ void ViewBlobInternalsJob::GenerateHTMLForBlobData( } if (item.offset()) { AddHTMLListItem(kOffset, base::UTF16ToUTF8(base::FormatNumber( - static_cast<int64>(item.offset()))), out); + static_cast<int64_t>(item.offset()))), + out); } - if (static_cast<int64>(item.length()) != -1) { + if (static_cast<int64_t>(item.length()) != -1) { AddHTMLListItem(kLength, base::UTF16ToUTF8(base::FormatNumber( - static_cast<int64>(item.length()))), out); + static_cast<int64_t>(item.length()))), + out); } if (has_multi_items) diff --git a/storage/browser/blob/view_blob_internals_job.h b/storage/browser/blob/view_blob_internals_job.h index 6216dd3..876df99 100644 --- a/storage/browser/blob/view_blob_internals_job.h +++ b/storage/browser/blob/view_blob_internals_job.h @@ -7,6 +7,7 @@ #include <string> +#include "base/macros.h" #include "base/memory/weak_ptr.h" #include "net/url_request/url_request_simple_job.h" #include "storage/browser/storage_browser_export.h" diff --git a/storage/browser/database/database_quota_client.cc b/storage/browser/database/database_quota_client.cc index fd55a6f..66d3dbe 100644 --- a/storage/browser/database/database_quota_client.cc +++ b/storage/browser/database/database_quota_client.cc @@ -4,6 +4,8 @@ #include "storage/browser/database/database_quota_client.h" +#include <stdint.h> + #include <vector> #include "base/bind.h" @@ -24,9 +26,8 @@ namespace storage { namespace { -int64 GetOriginUsageOnDBThread( - DatabaseTracker* db_tracker, - const GURL& origin_url) { +int64_t GetOriginUsageOnDBThread(DatabaseTracker* db_tracker, + const GURL& origin_url) { OriginInfo info; if (db_tracker->GetOriginInfo(storage::GetIdentifierFromOrigin(origin_url), &info)) diff --git a/storage/browser/database/database_quota_client.h b/storage/browser/database/database_quota_client.h index a876029..43431dc 100644 --- a/storage/browser/database/database_quota_client.h +++ b/storage/browser/database/database_quota_client.h @@ -8,6 +8,7 @@ #include <set> #include <string> +#include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/single_thread_task_runner.h" #include "storage/browser/quota/quota_client.h" diff --git a/storage/browser/database/database_tracker.cc b/storage/browser/database/database_tracker.cc index 3d579dc..6a10107 100644 --- a/storage/browser/database/database_tracker.cc +++ b/storage/browser/database/database_tracker.cc @@ -4,10 +4,11 @@ #include "storage/browser/database/database_tracker.h" +#include <stdint.h> + #include <algorithm> #include <vector> -#include "base/basictypes.h" #include "base/bind.h" #include "base/files/file_enumerator.h" #include "base/files/file_util.h" @@ -59,7 +60,7 @@ void OriginInfo::GetAllDatabaseNames( } } -int64 OriginInfo::GetDatabaseSize(const base::string16& database_name) const { +int64_t OriginInfo::GetDatabaseSize(const base::string16& database_name) const { DatabaseInfoMap::const_iterator it = database_info_.find(database_name); if (it != database_info_.end()) return it->second.first; @@ -74,7 +75,7 @@ base::string16 OriginInfo::GetDatabaseDescription( return base::string16(); } -OriginInfo::OriginInfo(const std::string& origin_identifier, int64 total_size) +OriginInfo::OriginInfo(const std::string& origin_identifier, int64_t total_size) : origin_identifier_(origin_identifier), total_size_(total_size) {} DatabaseTracker::DatabaseTracker( @@ -110,8 +111,8 @@ DatabaseTracker::~DatabaseTracker() { void DatabaseTracker::DatabaseOpened(const std::string& origin_identifier, const base::string16& database_name, const base::string16& database_description, - int64 estimated_size, - int64* database_size) { + int64_t estimated_size, + int64_t* database_size) { if (shutting_down_ || !LazyInit()) { *database_size = 0; return; @@ -287,7 +288,8 @@ base::FilePath DatabaseTracker::GetFullDBFilePath( if (!LazyInit()) return base::FilePath(); - int64 id = databases_table_->GetDatabaseID(origin_identifier, database_name); + int64_t id = + databases_table_->GetDatabaseID(origin_identifier, database_name); if (id < 0) return base::FilePath(); @@ -348,9 +350,9 @@ bool DatabaseTracker::DeleteClosedDatabase( if (database_connections_.IsDatabaseOpened(origin_identifier, database_name)) return false; - int64 db_file_size = quota_manager_proxy_.get() - ? GetDBFileSize(origin_identifier, database_name) - : 0; + int64_t db_file_size = quota_manager_proxy_.get() + ? GetDBFileSize(origin_identifier, database_name) + : 0; // Try to delete the file on the hard drive. base::FilePath db_file = GetFullDBFilePath(origin_identifier, database_name); @@ -386,7 +388,7 @@ bool DatabaseTracker::DeleteOrigin(const std::string& origin_identifier, if (database_connections_.IsOriginUsed(origin_identifier) && !force) return false; - int64 deleted_size = 0; + int64_t deleted_size = 0; if (quota_manager_proxy_.get()) { CachedOriginInfo* origin_info = GetCachedOriginInfo(origin_identifier); if (origin_info) @@ -510,7 +512,7 @@ void DatabaseTracker::InsertOrUpdateDatabaseDetails( const std::string& origin_identifier, const base::string16& database_name, const base::string16& database_description, - int64 estimated_size) { + int64_t estimated_size) { DatabaseDetails details; if (!databases_table_->GetDatabaseDetails( origin_identifier, database_name, &details)) { @@ -551,7 +553,7 @@ DatabaseTracker::CachedOriginInfo* DatabaseTracker::MaybeGetCachedOriginInfo( origin_info.SetOriginIdentifier(origin_identifier); for (std::vector<DatabaseDetails>::const_iterator it = details.begin(); it != details.end(); it++) { - int64 db_file_size; + int64_t db_file_size; if (database_connections_.IsDatabaseOpened( origin_identifier, it->database_name)) { db_file_size = database_connections_.GetOpenDatabaseSize( @@ -567,21 +569,22 @@ DatabaseTracker::CachedOriginInfo* DatabaseTracker::MaybeGetCachedOriginInfo( return &origins_info_map_[origin_identifier]; } -int64 DatabaseTracker::GetDBFileSize(const std::string& origin_identifier, - const base::string16& database_name) { +int64_t DatabaseTracker::GetDBFileSize(const std::string& origin_identifier, + const base::string16& database_name) { base::FilePath db_file_name = GetFullDBFilePath(origin_identifier, database_name); - int64 db_file_size = 0; + int64_t db_file_size = 0; if (!base::GetFileSize(db_file_name, &db_file_size)) db_file_size = 0; return db_file_size; } -int64 DatabaseTracker::SeedOpenDatabaseInfo( - const std::string& origin_id, const base::string16& name, +int64_t DatabaseTracker::SeedOpenDatabaseInfo( + const std::string& origin_id, + const base::string16& name, const base::string16& description) { DCHECK(database_connections_.IsDatabaseOpened(origin_id, name)); - int64 size = GetDBFileSize(origin_id, name); + int64_t size = GetDBFileSize(origin_id, name); database_connections_.SetOpenDatabaseSize(origin_id, name, size); CachedOriginInfo* info = MaybeGetCachedOriginInfo(origin_id, false); if (info) { @@ -591,12 +594,13 @@ int64 DatabaseTracker::SeedOpenDatabaseInfo( return size; } -int64 DatabaseTracker::UpdateOpenDatabaseInfoAndNotify( - const std::string& origin_id, const base::string16& name, +int64_t DatabaseTracker::UpdateOpenDatabaseInfoAndNotify( + const std::string& origin_id, + const base::string16& name, const base::string16* opt_description) { DCHECK(database_connections_.IsDatabaseOpened(origin_id, name)); - int64 new_size = GetDBFileSize(origin_id, name); - int64 old_size = database_connections_.GetOpenDatabaseSize(origin_id, name); + int64_t new_size = GetDBFileSize(origin_id, name); + int64_t old_size = database_connections_.GetOpenDatabaseSize(origin_id, name); CachedOriginInfo* info = MaybeGetCachedOriginInfo(origin_id, false); if (info && opt_description) info->SetDatabaseDescription(name, *opt_description); diff --git a/storage/browser/database/database_tracker.h b/storage/browser/database/database_tracker.h index 051fe1e..4b7158e 100644 --- a/storage/browser/database/database_tracker.h +++ b/storage/browser/database/database_tracker.h @@ -5,6 +5,8 @@ #ifndef STORAGE_BROWSER_DATABASE_DATABASE_TRACKER_H_ #define STORAGE_BROWSER_DATABASE_DATABASE_TRACKER_H_ +#include <stdint.h> + #include <map> #include <set> #include <utility> @@ -58,20 +60,20 @@ class STORAGE_EXPORT OriginInfo { ~OriginInfo(); const std::string& GetOriginIdentifier() const { return origin_identifier_; } - int64 TotalSize() const { return total_size_; } + int64_t TotalSize() const { return total_size_; } void GetAllDatabaseNames(std::vector<base::string16>* databases) const; - int64 GetDatabaseSize(const base::string16& database_name) const; + int64_t GetDatabaseSize(const base::string16& database_name) const; base::string16 GetDatabaseDescription( const base::string16& database_name) const; protected: - typedef std::map<base::string16, std::pair<int64, base::string16> > + typedef std::map<base::string16, std::pair<int64_t, base::string16>> DatabaseInfoMap; - OriginInfo(const std::string& origin_identifier, int64 total_size); + OriginInfo(const std::string& origin_identifier, int64_t total_size); std::string origin_identifier_; - int64 total_size_; + int64_t total_size_; DatabaseInfoMap database_info_; }; @@ -92,7 +94,7 @@ class STORAGE_EXPORT DatabaseTracker public: virtual void OnDatabaseSizeChanged(const std::string& origin_identifier, const base::string16& database_name, - int64 database_size) = 0; + int64_t database_size) = 0; virtual void OnDatabaseScheduledForDeletion( const std::string& origin_identifier, const base::string16& database_name) = 0; @@ -110,8 +112,8 @@ class STORAGE_EXPORT DatabaseTracker void DatabaseOpened(const std::string& origin_identifier, const base::string16& database_name, const base::string16& database_details, - int64 estimated_size, - int64* database_size); + int64_t estimated_size, + int64_t* database_size); void DatabaseModified(const std::string& origin_identifier, const base::string16& database_name); void DatabaseClosed(const std::string& origin_identifier, @@ -198,8 +200,9 @@ class STORAGE_EXPORT DatabaseTracker void SetOriginIdentifier(const std::string& origin_identifier) { origin_identifier_ = origin_identifier; } - void SetDatabaseSize(const base::string16& database_name, int64 new_size) { - int64 old_size = 0; + void SetDatabaseSize(const base::string16& database_name, + int64_t new_size) { + int64_t old_size = 0; if (database_info_.find(database_name) != database_info_.end()) old_size = database_info_[database_name].first; database_info_[database_name].first = new_size; @@ -236,7 +239,7 @@ class STORAGE_EXPORT DatabaseTracker void InsertOrUpdateDatabaseDetails(const std::string& origin_identifier, const base::string16& database_name, const base::string16& database_details, - int64 estimated_size); + int64_t estimated_size); void ClearAllCachedOriginInfo(); CachedOriginInfo* MaybeGetCachedOriginInfo( @@ -247,16 +250,17 @@ class STORAGE_EXPORT DatabaseTracker return MaybeGetCachedOriginInfo(origin_identifier, true); } - int64 GetDBFileSize(const std::string& origin_identifier, - const base::string16& database_name); - int64 SeedOpenDatabaseInfo(const std::string& origin_identifier, - const base::string16& database_name, - const base::string16& description); - int64 UpdateOpenDatabaseInfoAndNotify(const std::string& origin_identifier, - const base::string16& database_name, - const base::string16* opt_description); - int64 UpdateOpenDatabaseSizeAndNotify(const std::string& origin_identifier, - const base::string16& database_name) { + int64_t GetDBFileSize(const std::string& origin_identifier, + const base::string16& database_name); + int64_t SeedOpenDatabaseInfo(const std::string& origin_identifier, + const base::string16& database_name, + const base::string16& description); + int64_t UpdateOpenDatabaseInfoAndNotify( + const std::string& origin_identifier, + const base::string16& database_name, + const base::string16* opt_description); + int64_t UpdateOpenDatabaseSizeAndNotify(const std::string& origin_identifier, + const base::string16& database_name) { return UpdateOpenDatabaseInfoAndNotify( origin_identifier, database_name, NULL); } diff --git a/storage/browser/database/database_util.cc b/storage/browser/database/database_util.cc index f020302..77e3888 100644 --- a/storage/browser/database/database_util.cc +++ b/storage/browser/database/database_util.cc @@ -4,7 +4,8 @@ #include "storage/browser/database/database_util.h" -#include "base/basictypes.h" +#include <stddef.h> + #include "base/strings/utf_string_conversions.h" #include "storage/browser/database/database_tracker.h" #include "storage/browser/database/vfs_backend.h" diff --git a/storage/browser/database/databases_table.cc b/storage/browser/database/databases_table.cc index 6d84ae8..a1bc479 100644 --- a/storage/browser/database/databases_table.cc +++ b/storage/browser/database/databases_table.cc @@ -4,6 +4,8 @@ #include "storage/browser/database/databases_table.h" +#include <stdint.h> + #include "base/logging.h" #include "base/strings/utf_string_conversions.h" #include "sql/statement.h" @@ -37,8 +39,8 @@ bool DatabasesTable::Init() { "CREATE UNIQUE INDEX unique_index ON Databases (origin, name)")); } -int64 DatabasesTable::GetDatabaseID(const std::string& origin_identifier, - const base::string16& database_name) { +int64_t DatabasesTable::GetDatabaseID(const std::string& origin_identifier, + const base::string16& database_name) { sql::Statement select_statement(db_->GetCachedStatement( SQL_FROM_HERE, "SELECT id FROM Databases WHERE origin = ? AND name = ?")); select_statement.BindString(0, origin_identifier); diff --git a/storage/browser/database/databases_table.h b/storage/browser/database/databases_table.h index 0b98c31..78e18ba 100644 --- a/storage/browser/database/databases_table.h +++ b/storage/browser/database/databases_table.h @@ -5,6 +5,8 @@ #ifndef STORAGE_BROWSER_DATABASE_DATABASES_TABLE_H_ #define STORAGE_BROWSER_DATABASE_DATABASES_TABLE_H_ +#include <stdint.h> + #include <vector> #include "base/strings/string16.h" @@ -23,7 +25,7 @@ struct STORAGE_EXPORT DatabaseDetails { std::string origin_identifier; base::string16 database_name; base::string16 description; - int64 estimated_size; + int64_t estimated_size; }; class STORAGE_EXPORT DatabasesTable { @@ -31,8 +33,8 @@ class STORAGE_EXPORT DatabasesTable { explicit DatabasesTable(sql::Connection* db) : db_(db) { } bool Init(); - int64 GetDatabaseID(const std::string& origin_identifier, - const base::string16& database_name); + int64_t GetDatabaseID(const std::string& origin_identifier, + const base::string16& database_name); bool GetDatabaseDetails(const std::string& origin_identifier, const base::string16& database_name, DatabaseDetails* details); diff --git a/storage/browser/database/vfs_backend.cc b/storage/browser/database/vfs_backend.cc index 2cd0246..e7282f1 100644 --- a/storage/browser/database/vfs_backend.cc +++ b/storage/browser/database/vfs_backend.cc @@ -4,6 +4,8 @@ #include "storage/browser/database/vfs_backend.h" +#include <stdint.h> + #include "base/files/file_path.h" #include "base/files/file_util.h" #include "base/logging.h" @@ -134,15 +136,15 @@ int VfsBackend::DeleteFile(const base::FilePath& file_path, bool sync_dir) { } // static -uint32 VfsBackend::GetFileAttributes(const base::FilePath& file_path) { +uint32_t VfsBackend::GetFileAttributes(const base::FilePath& file_path) { #if defined(OS_WIN) - uint32 attributes = ::GetFileAttributes(file_path.value().c_str()); + uint32_t attributes = ::GetFileAttributes(file_path.value().c_str()); #elif defined(OS_POSIX) - uint32 attributes = 0; + uint32_t attributes = 0; if (!access(file_path.value().c_str(), R_OK)) - attributes |= static_cast<uint32>(R_OK); + attributes |= static_cast<uint32_t>(R_OK); if (!access(file_path.value().c_str(), W_OK)) - attributes |= static_cast<uint32>(W_OK); + attributes |= static_cast<uint32_t>(W_OK); if (!attributes) attributes = -1; #endif @@ -150,13 +152,13 @@ uint32 VfsBackend::GetFileAttributes(const base::FilePath& file_path) { } // static -int64 VfsBackend::GetFileSize(const base::FilePath& file_path) { - int64 size = 0; +int64_t VfsBackend::GetFileSize(const base::FilePath& file_path) { + int64_t size = 0; return (base::GetFileSize(file_path, &size) ? size : 0); } // static -bool VfsBackend::SetFileSize(const base::FilePath& file_path, int64 size) { +bool VfsBackend::SetFileSize(const base::FilePath& file_path, int64_t size) { int flags = 0; flags |= base::File::FLAG_READ; flags |= base::File::FLAG_WRITE; diff --git a/storage/browser/database/vfs_backend.h b/storage/browser/database/vfs_backend.h index 2b625d1..9fcb08b 100644 --- a/storage/browser/database/vfs_backend.h +++ b/storage/browser/database/vfs_backend.h @@ -5,6 +5,8 @@ #ifndef STORAGE_BROWSER_DATABASE_VFS_BACKEND_H_ #define STORAGE_BROWSER_DATABASE_VFS_BACKEND_H_ +#include <stdint.h> + #include "base/files/file.h" #include "base/process/process.h" #include "base/strings/string16.h" @@ -26,11 +28,11 @@ class STORAGE_EXPORT VfsBackend { static int DeleteFile(const base::FilePath& file_path, bool sync_dir); - static uint32 GetFileAttributes(const base::FilePath& file_path); + static uint32_t GetFileAttributes(const base::FilePath& file_path); - static int64 GetFileSize(const base::FilePath& file_path); + static int64_t GetFileSize(const base::FilePath& file_path); - static bool SetFileSize(const base::FilePath& file_path, int64 size); + static bool SetFileSize(const base::FilePath& file_path, int64_t size); // Used to make decisions in the DatabaseDispatcherHost. static bool OpenTypeIsReadWrite(int desired_flags); diff --git a/storage/browser/fileapi/async_file_util.h b/storage/browser/fileapi/async_file_util.h index 799396b..a36114c 100644 --- a/storage/browser/fileapi/async_file_util.h +++ b/storage/browser/fileapi/async_file_util.h @@ -5,12 +5,14 @@ #ifndef STORAGE_BROWSER_FILEAPI_ASYNC_FILE_UTIL_H_ #define STORAGE_BROWSER_FILEAPI_ASYNC_FILE_UTIL_H_ +#include <stdint.h> + #include <vector> -#include "base/basictypes.h" #include "base/callback_forward.h" #include "base/files/file.h" #include "base/files/file_util_proxy.h" +#include "base/macros.h" #include "base/memory/scoped_ptr.h" #include "storage/browser/fileapi/file_system_operation.h" #include "storage/browser/storage_browser_export.h" @@ -77,7 +79,7 @@ class AsyncFileUtil { const scoped_refptr<storage::ShareableFileReference>& file_ref)> CreateSnapshotFileCallback; - typedef base::Callback<void(int64 size)> CopyFileProgressCallback; + typedef base::Callback<void(int64_t size)> CopyFileProgressCallback; typedef FileSystemOperation::CopyOrMoveOption CopyOrMoveOption; typedef FileSystemOperation::GetMetadataField GetMetadataField; @@ -201,11 +203,10 @@ class AsyncFileUtil { // This reports following error code via |callback|: // - File::FILE_ERROR_NOT_FOUND if the file doesn't exist. // - virtual void Truncate( - scoped_ptr<FileSystemOperationContext> context, - const FileSystemURL& url, - int64 length, - const StatusCallback& callback) = 0; + virtual void Truncate(scoped_ptr<FileSystemOperationContext> context, + const FileSystemURL& url, + int64_t length, + const StatusCallback& callback) = 0; // Copies a file from |src_url| to |dest_url|. // This must be called for files that belong to the same filesystem diff --git a/storage/browser/fileapi/async_file_util_adapter.cc b/storage/browser/fileapi/async_file_util_adapter.cc index 6a7664f..6f7cafd 100644 --- a/storage/browser/fileapi/async_file_util_adapter.cc +++ b/storage/browser/fileapi/async_file_util_adapter.cc @@ -4,9 +4,13 @@ #include "storage/browser/fileapi/async_file_util_adapter.h" +#include <stddef.h> +#include <stdint.h> + #include <vector> #include "base/bind.h" +#include "base/macros.h" #include "base/sequenced_task_runner.h" #include "base/task_runner_util.h" #include "base/thread_task_runner_handle.h" @@ -239,7 +243,7 @@ void AsyncFileUtilAdapter::Touch( void AsyncFileUtilAdapter::Truncate( scoped_ptr<FileSystemOperationContext> context, const FileSystemURL& url, - int64 length, + int64_t length, const StatusCallback& callback) { FileSystemOperationContext* context_ptr = context.release(); const bool success = base::PostTaskAndReplyWithResult( diff --git a/storage/browser/fileapi/async_file_util_adapter.h b/storage/browser/fileapi/async_file_util_adapter.h index 7a126b0..5cbf829 100644 --- a/storage/browser/fileapi/async_file_util_adapter.h +++ b/storage/browser/fileapi/async_file_util_adapter.h @@ -5,6 +5,9 @@ #ifndef STORAGE_BROWSER_FILEAPI_ASYNC_FILE_UTIL_ADAPTER_H_ #define STORAGE_BROWSER_FILEAPI_ASYNC_FILE_UTIL_ADAPTER_H_ +#include <stdint.h> + +#include "base/macros.h" #include "base/memory/scoped_ptr.h" #include "storage/browser/fileapi/async_file_util.h" @@ -64,7 +67,7 @@ class STORAGE_EXPORT AsyncFileUtilAdapter const StatusCallback& callback) override; void Truncate(scoped_ptr<FileSystemOperationContext> context, const FileSystemURL& url, - int64 length, + int64_t length, const StatusCallback& callback) override; void CopyFileLocal(scoped_ptr<FileSystemOperationContext> context, const FileSystemURL& src_url, diff --git a/storage/browser/fileapi/copy_or_move_operation_delegate.cc b/storage/browser/fileapi/copy_or_move_operation_delegate.cc index 715999b..f3072a1 100644 --- a/storage/browser/fileapi/copy_or_move_operation_delegate.cc +++ b/storage/browser/fileapi/copy_or_move_operation_delegate.cc @@ -4,8 +4,11 @@ #include "storage/browser/fileapi/copy_or_move_operation_delegate.h" +#include <stdint.h> + #include "base/bind.h" #include "base/files/file_path.h" +#include "base/macros.h" #include "net/base/io_buffer.h" #include "net/base/net_errors.h" #include "storage/browser/blob/shareable_file_reference.h" @@ -20,7 +23,7 @@ namespace storage { -const int64 kFlushIntervalInBytes = 10 << 20; // 10MB. +const int64_t kFlushIntervalInBytes = 10 << 20; // 10MB. class CopyOrMoveOperationDelegate::CopyOrMoveImpl { public: @@ -1013,7 +1016,8 @@ void CopyOrMoveOperationDelegate::DidRemoveSourceForMove( } void CopyOrMoveOperationDelegate::OnCopyFileProgress( - const FileSystemURL& src_url, int64 size) { + const FileSystemURL& src_url, + int64_t size) { if (!progress_callback_.is_null()) { progress_callback_.Run( FileSystemOperation::PROGRESS, src_url, FileSystemURL(), size); diff --git a/storage/browser/fileapi/copy_or_move_operation_delegate.h b/storage/browser/fileapi/copy_or_move_operation_delegate.h index e86c0ab..c3ff20a 100644 --- a/storage/browser/fileapi/copy_or_move_operation_delegate.h +++ b/storage/browser/fileapi/copy_or_move_operation_delegate.h @@ -5,9 +5,12 @@ #ifndef STORAGE_BROWSER_FILEAPI_COPY_OR_MOVE_OPERATION_DELEGATE_H_ #define STORAGE_BROWSER_FILEAPI_COPY_OR_MOVE_OPERATION_DELEGATE_H_ +#include <stdint.h> + #include <set> #include <stack> +#include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" #include "base/time/time.h" @@ -83,8 +86,8 @@ class CopyOrMoveOperationDelegate const FlushPolicy flush_policy_; FileSystemOperation::CopyFileProgressCallback file_progress_callback_; scoped_refptr<net::IOBufferWithSize> io_buffer_; - int64 num_copied_bytes_; - int64 previous_flush_offset_; + int64_t num_copied_bytes_; + int64_t previous_flush_offset_; base::Time last_progress_callback_invocation_time_; base::TimeDelta min_progress_callback_invocation_span_; bool cancel_requested_; @@ -141,7 +144,7 @@ class CopyOrMoveOperationDelegate void DidRemoveSourceForMove(const StatusCallback& callback, base::File::Error error); - void OnCopyFileProgress(const FileSystemURL& src_url, int64 size); + void OnCopyFileProgress(const FileSystemURL& src_url, int64_t size); FileSystemURL CreateDestURL(const FileSystemURL& src_url) const; FileSystemURL src_root_; diff --git a/storage/browser/fileapi/dragged_file_util.cc b/storage/browser/fileapi/dragged_file_util.cc index ff581fe..dc6db41 100644 --- a/storage/browser/fileapi/dragged_file_util.cc +++ b/storage/browser/fileapi/dragged_file_util.cc @@ -4,6 +4,8 @@ #include "storage/browser/fileapi/dragged_file_util.h" +#include <stdint.h> + #include <string> #include <vector> @@ -39,7 +41,7 @@ class SetFileEnumerator : public FileSystemFileUtil::AbstractFileEnumerator { NativeFileUtil::GetFileInfo(platform_file, &file_info_); return platform_file; } - int64 Size() override { return file_info_.size; } + int64_t Size() override { return file_info_.size; } bool IsDirectory() override { return file_info_.is_directory; } base::Time LastModifiedTime() override { return file_info_.last_modified; } diff --git a/storage/browser/fileapi/dragged_file_util.h b/storage/browser/fileapi/dragged_file_util.h index 50a4e83..adf47d3 100644 --- a/storage/browser/fileapi/dragged_file_util.h +++ b/storage/browser/fileapi/dragged_file_util.h @@ -5,6 +5,7 @@ #ifndef STORAGE_BROWSER_FILEAPI_DRAGGED_FILE_UTIL_H_ #define STORAGE_BROWSER_FILEAPI_DRAGGED_FILE_UTIL_H_ +#include "base/macros.h" #include "base/memory/scoped_ptr.h" #include "storage/browser/fileapi/local_file_util.h" #include "storage/browser/storage_browser_export.h" diff --git a/storage/browser/fileapi/dump_file_system.cc b/storage/browser/fileapi/dump_file_system.cc index 67f0aa6..786fef1 100644 --- a/storage/browser/fileapi/dump_file_system.cc +++ b/storage/browser/fileapi/dump_file_system.cc @@ -28,6 +28,8 @@ // children, and file_content_path is empty if the file is a directory. // +#include <stddef.h> +#include <stdint.h> #include <stdio.h> #include <stdlib.h> @@ -115,9 +117,9 @@ static void DumpDirectoryTree(const std::string& origin_name, const char* display_name = name.c_str() + 1; const char* directory_suffix = info.is_directory() ? "/" : ""; if (g_opt_long) { - int64 size; + int64_t size; if (info.is_directory()) { - size = static_cast<int64>(children.size()); + size = static_cast<int64_t>(children.size()); } else { base::GetFileSize(origin_dir.Append(info.data_path), &size); } diff --git a/storage/browser/fileapi/external_mount_points.cc b/storage/browser/fileapi/external_mount_points.cc index d497b4d..9fdb4f9 100644 --- a/storage/browser/fileapi/external_mount_points.cc +++ b/storage/browser/fileapi/external_mount_points.cc @@ -6,6 +6,7 @@ #include "base/files/file_path.h" #include "base/lazy_instance.h" +#include "base/macros.h" #include "base/stl_util.h" #include "storage/browser/fileapi/file_system_url.h" diff --git a/storage/browser/fileapi/external_mount_points.h b/storage/browser/fileapi/external_mount_points.h index 37d4149..af853d7 100644 --- a/storage/browser/fileapi/external_mount_points.h +++ b/storage/browser/fileapi/external_mount_points.h @@ -9,6 +9,7 @@ #include <string> #include <vector> +#include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/synchronization/lock.h" #include "storage/browser/fileapi/mount_points.h" diff --git a/storage/browser/fileapi/file_observers.h b/storage/browser/fileapi/file_observers.h index 7a07193..f45c633 100644 --- a/storage/browser/fileapi/file_observers.h +++ b/storage/browser/fileapi/file_observers.h @@ -5,7 +5,9 @@ #ifndef STORAGE_BROWSER_FILEAPI_FILE_OBSERVERS_H_ #define STORAGE_BROWSER_FILEAPI_FILE_OBSERVERS_H_ -#include "base/basictypes.h" +#include <stdint.h> + +#include "base/macros.h" #include "storage/browser/storage_browser_export.h" // TODO(kinuko): Split this file into per-observer multiple files. @@ -33,7 +35,7 @@ class STORAGE_EXPORT FileUpdateObserver { virtual ~FileUpdateObserver() {} virtual void OnStartUpdate(const FileSystemURL& url) = 0; - virtual void OnUpdate(const FileSystemURL& url, int64 delta) = 0; + virtual void OnUpdate(const FileSystemURL& url, int64_t delta) = 0; virtual void OnEndUpdate(const FileSystemURL& url) = 0; private: diff --git a/storage/browser/fileapi/file_stream_reader.cc b/storage/browser/fileapi/file_stream_reader.cc index 00d3e22..db237a1 100644 --- a/storage/browser/fileapi/file_stream_reader.cc +++ b/storage/browser/fileapi/file_stream_reader.cc @@ -4,11 +4,13 @@ #include "storage/browser/fileapi/file_stream_reader.h" +#include <stdint.h> + #include "base/time/time.h" namespace storage { -// Int64->double->int64 conversions (e.g. through Blink) may lose some +// Int64->double->int64_t conversions (e.g. through Blink) may lose some // precision in the microsecond range. Allow 10us delta. const int kModificationTimeAllowedDeltaMicroseconds = 10; diff --git a/storage/browser/fileapi/file_stream_reader.h b/storage/browser/fileapi/file_stream_reader.h index 9b2ce02..d7abbf2 100644 --- a/storage/browser/fileapi/file_stream_reader.h +++ b/storage/browser/fileapi/file_stream_reader.h @@ -5,7 +5,8 @@ #ifndef STORAGE_BLOB_FILE_STREAM_READER_H_ #define STORAGE_BLOB_FILE_STREAM_READER_H_ -#include "base/basictypes.h" +#include <stdint.h> + #include "base/compiler_specific.h" #include "base/files/file.h" #include "net/base/completion_callback.h" @@ -40,22 +41,22 @@ class FileStreamReader { // actual modification time to see if the file has been modified, and if // it does any succeeding read operations should fail with // ERR_UPLOAD_FILE_CHANGED error. - STORAGE_EXPORT static FileStreamReader* - CreateForLocalFile(base::TaskRunner* task_runner, - const base::FilePath& file_path, - int64 initial_offset, - const base::Time& expected_modification_time); + STORAGE_EXPORT static FileStreamReader* CreateForLocalFile( + base::TaskRunner* task_runner, + const base::FilePath& file_path, + int64_t initial_offset, + const base::Time& expected_modification_time); // Creates a new reader for a filesystem URL |url| form |initial_offset|. // |expected_modification_time| specifies the expected last modification if // the value is non-null, the reader will check the underlying file's actual // modification time to see if the file has been modified, and if it does any // succeeding read operations should fail with ERR_UPLOAD_FILE_CHANGED error. - STORAGE_EXPORT static FileStreamReader* - CreateForFileSystemFile(storage::FileSystemContext* context, - const storage::FileSystemURL& url, - int64 initial_offset, - const base::Time& expected_modification_time); + STORAGE_EXPORT static FileStreamReader* CreateForFileSystemFile( + storage::FileSystemContext* context, + const storage::FileSystemURL& url, + int64_t initial_offset, + const base::Time& expected_modification_time); // Verify if the underlying file has not been modified. STORAGE_EXPORT static bool VerifySnapshotTime( @@ -88,10 +89,10 @@ class FileStreamReader { // Otherwise, a negative error code is returned (rv < 0 cases). // If the stream is deleted while it has an in-flight GetLength operation // |callback| will not be called. - // Note that the return type is int64 to return a larger file's size (a file + // Note that the return type is int64_t to return a larger file's size (a file // larger than 2G) but an error code should fit in the int range (may be - // smaller than int64 range). - virtual int64 GetLength(const net::Int64CompletionCallback& callback) = 0; + // smaller than int64_t range). + virtual int64_t GetLength(const net::Int64CompletionCallback& callback) = 0; }; } // namespace storage diff --git a/storage/browser/fileapi/file_stream_writer.h b/storage/browser/fileapi/file_stream_writer.h index cc191dc..bfbdbf5 100644 --- a/storage/browser/fileapi/file_stream_writer.h +++ b/storage/browser/fileapi/file_stream_writer.h @@ -5,7 +5,8 @@ #ifndef STORAGE_BROWSER_FILEAPI_FILE_STREAM_WRITER_H_ #define STORAGE_BROWSER_FILEAPI_FILE_STREAM_WRITER_H_ -#include "base/basictypes.h" +#include <stdint.h> + #include "net/base/completion_callback.h" #include "storage/browser/storage_browser_export.h" @@ -30,7 +31,7 @@ class FileStreamWriter { STORAGE_EXPORT static FileStreamWriter* CreateForLocalFile( base::TaskRunner* task_runner, const base::FilePath& file_path, - int64 initial_offset, + int64_t initial_offset, OpenOrCreate open_or_create); // Closes the file. If there's an in-flight operation, it is canceled (i.e., diff --git a/storage/browser/fileapi/file_system_backend.h b/storage/browser/fileapi/file_system_backend.h index ad3a8f3..0c06b1c 100644 --- a/storage/browser/fileapi/file_system_backend.h +++ b/storage/browser/fileapi/file_system_backend.h @@ -5,6 +5,8 @@ #ifndef STORAGE_BROWSER_FILEAPI_FILE_SYSTEM_BACKEND_H_ #define STORAGE_BROWSER_FILEAPI_FILE_SYSTEM_BACKEND_H_ +#include <stdint.h> + #include <limits> #include <string> #include <vector> @@ -40,7 +42,7 @@ typedef base::Callback<void(const GURL& url)> URLCallback; // Maximum numer of bytes to be read by FileStreamReader classes. Used in // FileSystemBackend::CreateFileStreamReader(), when it's not known how many // bytes will be fetched in total. -const int64 kMaximumLength = INT64_MAX; +const int64_t kMaximumLength = INT64_MAX; // An interface for defining a file system backend. // @@ -119,8 +121,8 @@ class STORAGE_EXPORT FileSystemBackend { // stream reader. virtual scoped_ptr<storage::FileStreamReader> CreateFileStreamReader( const FileSystemURL& url, - int64 offset, - int64 max_bytes_to_read, + int64_t offset, + int64_t max_bytes_to_read, const base::Time& expected_modification_time, FileSystemContext* context) const = 0; @@ -130,7 +132,7 @@ class STORAGE_EXPORT FileSystemBackend { // regular file. virtual scoped_ptr<FileStreamWriter> CreateFileStreamWriter( const FileSystemURL& url, - int64 offset, + int64_t offset, FileSystemContext* context) const = 0; // Returns the specialized FileSystemQuotaUtil for this backend. diff --git a/storage/browser/fileapi/file_system_context.cc b/storage/browser/fileapi/file_system_context.cc index 8c099e7d..5ded6c3 100644 --- a/storage/browser/fileapi/file_system_context.cc +++ b/storage/browser/fileapi/file_system_context.cc @@ -4,7 +4,11 @@ #include "storage/browser/fileapi/file_system_context.h" +#include <stddef.h> +#include <stdint.h> + #include "base/bind.h" +#include "base/macros.h" #include "base/single_thread_task_runner.h" #include "base/stl_util.h" #include "base/task_runner_util.h" @@ -438,8 +442,8 @@ void FileSystemContext::DeleteFileSystem( scoped_ptr<storage::FileStreamReader> FileSystemContext::CreateFileStreamReader( const FileSystemURL& url, - int64 offset, - int64 max_bytes_to_read, + int64_t offset, + int64_t max_bytes_to_read, const base::Time& expected_modification_time) { if (!url.is_valid()) return scoped_ptr<storage::FileStreamReader>(); @@ -452,7 +456,7 @@ scoped_ptr<storage::FileStreamReader> FileSystemContext::CreateFileStreamReader( scoped_ptr<FileStreamWriter> FileSystemContext::CreateFileStreamWriter( const FileSystemURL& url, - int64 offset) { + int64_t offset) { if (!url.is_valid()) return scoped_ptr<FileStreamWriter>(); FileSystemBackend* backend = GetFileSystemBackend(url.type()); diff --git a/storage/browser/fileapi/file_system_context.h b/storage/browser/fileapi/file_system_context.h index 53fef62..c504a0f 100644 --- a/storage/browser/fileapi/file_system_context.h +++ b/storage/browser/fileapi/file_system_context.h @@ -5,12 +5,15 @@ #ifndef STORAGE_BROWSER_FILEAPI_FILE_SYSTEM_CONTEXT_H_ #define STORAGE_BROWSER_FILEAPI_FILE_SYSTEM_CONTEXT_H_ +#include <stdint.h> + #include <map> #include <string> #include <vector> #include "base/callback.h" #include "base/files/file.h" +#include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" #include "base/memory/scoped_vector.h" @@ -255,15 +258,14 @@ class STORAGE_EXPORT FileSystemContext // At most |max_bytes_to_read| can be fetched from the file stream reader. scoped_ptr<storage::FileStreamReader> CreateFileStreamReader( const FileSystemURL& url, - int64 offset, - int64 max_bytes_to_read, + int64_t offset, + int64_t max_bytes_to_read, const base::Time& expected_modification_time); // Creates new FileStreamWriter instance to write into a file pointed by // |url| from |offset|. - scoped_ptr<FileStreamWriter> CreateFileStreamWriter( - const FileSystemURL& url, - int64 offset); + scoped_ptr<FileStreamWriter> CreateFileStreamWriter(const FileSystemURL& url, + int64_t offset); // Creates a new FileSystemOperationRunner. scoped_ptr<FileSystemOperationRunner> CreateFileSystemOperationRunner(); diff --git a/storage/browser/fileapi/file_system_dir_url_request_job.cc b/storage/browser/fileapi/file_system_dir_url_request_job.cc index c99454d..0c3ef36 100644 --- a/storage/browser/fileapi/file_system_dir_url_request_job.cc +++ b/storage/browser/fileapi/file_system_dir_url_request_job.cc @@ -4,6 +4,8 @@ #include "storage/browser/fileapi/file_system_dir_url_request_job.h" +#include <stddef.h> + #include <algorithm> #include "base/bind.h" diff --git a/storage/browser/fileapi/file_system_dir_url_request_job.h b/storage/browser/fileapi/file_system_dir_url_request_job.h index 57b6904..65bcf79 100644 --- a/storage/browser/fileapi/file_system_dir_url_request_job.h +++ b/storage/browser/fileapi/file_system_dir_url_request_job.h @@ -5,11 +5,14 @@ #ifndef STORAGE_BROWSER_FILEAPI_FILE_SYSTEM_DIR_URL_REQUEST_JOB_H_ #define STORAGE_BROWSER_FILEAPI_FILE_SYSTEM_DIR_URL_REQUEST_JOB_H_ +#include <stddef.h> + #include <string> #include <vector> #include "base/files/file.h" #include "base/files/file_path.h" +#include "base/macros.h" #include "base/memory/weak_ptr.h" #include "net/url_request/url_request_job.h" #include "storage/browser/fileapi/file_system_url.h" diff --git a/storage/browser/fileapi/file_system_file_stream_reader.cc b/storage/browser/fileapi/file_system_file_stream_reader.cc index dc1dcce5..0f30eb3 100644 --- a/storage/browser/fileapi/file_system_file_stream_reader.cc +++ b/storage/browser/fileapi/file_system_file_stream_reader.cc @@ -4,6 +4,8 @@ #include "storage/browser/fileapi/file_system_file_stream_reader.h" +#include <stdint.h> + #include "base/files/file_util_proxy.h" #include "base/single_thread_task_runner.h" #include "net/base/file_stream.h" @@ -21,7 +23,7 @@ namespace storage { FileStreamReader* FileStreamReader::CreateForFileSystemFile( storage::FileSystemContext* file_system_context, const storage::FileSystemURL& url, - int64 initial_offset, + int64_t initial_offset, const base::Time& expected_modification_time) { return new storage::FileSystemFileStreamReader( file_system_context, url, initial_offset, expected_modification_time); @@ -73,7 +75,7 @@ int FileSystemFileStreamReader::Read( callback); } -int64 FileSystemFileStreamReader::GetLength( +int64_t FileSystemFileStreamReader::GetLength( const net::Int64CompletionCallback& callback) { if (local_file_reader_) return local_file_reader_->GetLength(callback); @@ -85,15 +87,14 @@ int64 FileSystemFileStreamReader::GetLength( FileSystemFileStreamReader::FileSystemFileStreamReader( FileSystemContext* file_system_context, const FileSystemURL& url, - int64 initial_offset, + int64_t initial_offset, const base::Time& expected_modification_time) : file_system_context_(file_system_context), url_(url), initial_offset_(initial_offset), expected_modification_time_(expected_modification_time), has_pending_create_snapshot_(false), - weak_factory_(this) { -} + weak_factory_(this) {} int FileSystemFileStreamReader::CreateSnapshot( const base::Closure& callback, diff --git a/storage/browser/fileapi/file_system_file_stream_reader.h b/storage/browser/fileapi/file_system_file_stream_reader.h index b4095b0..91c3c88 100644 --- a/storage/browser/fileapi/file_system_file_stream_reader.h +++ b/storage/browser/fileapi/file_system_file_stream_reader.h @@ -5,8 +5,11 @@ #ifndef STORAGE_BROWSER_FILEAPI_FILE_SYSTEM_FILE_STREAM_READER_H_ #define STORAGE_BROWSER_FILEAPI_FILE_SYSTEM_FILE_STREAM_READER_H_ +#include <stdint.h> + #include "base/bind.h" #include "base/files/file.h" +#include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/time/time.h" #include "storage/browser/blob/shareable_file_reference.h" @@ -41,7 +44,7 @@ class STORAGE_EXPORT FileSystemFileStreamReader int Read(net::IOBuffer* buf, int buf_len, const net::CompletionCallback& callback) override; - int64 GetLength(const net::Int64CompletionCallback& callback) override; + int64_t GetLength(const net::Int64CompletionCallback& callback) override; private: friend class storage::FileStreamReader; @@ -49,7 +52,7 @@ class STORAGE_EXPORT FileSystemFileStreamReader FileSystemFileStreamReader(FileSystemContext* file_system_context, const FileSystemURL& url, - int64 initial_offset, + int64_t initial_offset, const base::Time& expected_modification_time); int CreateSnapshot(const base::Closure& callback, @@ -64,7 +67,7 @@ class STORAGE_EXPORT FileSystemFileStreamReader scoped_refptr<FileSystemContext> file_system_context_; FileSystemURL url_; - const int64 initial_offset_; + const int64_t initial_offset_; const base::Time expected_modification_time_; scoped_ptr<storage::FileStreamReader> local_file_reader_; scoped_refptr<storage::ShareableFileReference> snapshot_ref_; diff --git a/storage/browser/fileapi/file_system_file_util.cc b/storage/browser/fileapi/file_system_file_util.cc index f356109..c08695b 100644 --- a/storage/browser/fileapi/file_system_file_util.cc +++ b/storage/browser/fileapi/file_system_file_util.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 "storage/browser/fileapi/file_system_file_util.h" namespace storage { @@ -10,7 +12,7 @@ base::FilePath FileSystemFileUtil::EmptyFileEnumerator::Next() { return base::FilePath(); } -int64 FileSystemFileUtil::EmptyFileEnumerator::Size() { +int64_t FileSystemFileUtil::EmptyFileEnumerator::Size() { return 0; } diff --git a/storage/browser/fileapi/file_system_file_util.h b/storage/browser/fileapi/file_system_file_util.h index 48a127a..5336277 100644 --- a/storage/browser/fileapi/file_system_file_util.h +++ b/storage/browser/fileapi/file_system_file_util.h @@ -5,8 +5,11 @@ #ifndef STORAGE_BROWSER_FILEAPI_FILE_SYSTEM_FILE_UTIL_H_ #define STORAGE_BROWSER_FILEAPI_FILE_SYSTEM_FILE_UTIL_H_ +#include <stdint.h> + #include "base/files/file.h" #include "base/files/file_path.h" +#include "base/macros.h" #include "base/memory/scoped_ptr.h" #include "storage/browser/blob/scoped_file.h" #include "storage/browser/fileapi/file_system_operation.h" @@ -42,7 +45,7 @@ class STORAGE_EXPORT FileSystemFileUtil { // Next(). If Next() has never been called, or if Next() most recently // returned an empty string, then return the default values of 0, // "null time", and false, respectively. - virtual int64 Size() = 0; + virtual int64_t Size() = 0; virtual base::Time LastModifiedTime() = 0; virtual bool IsDirectory() = 0; }; @@ -50,7 +53,7 @@ class STORAGE_EXPORT FileSystemFileUtil { class STORAGE_EXPORT EmptyFileEnumerator : public AbstractFileEnumerator { base::FilePath Next() override; - int64 Size() override; + int64_t Size() override; base::Time LastModifiedTime() override; bool IsDirectory() override; }; @@ -117,10 +120,9 @@ class STORAGE_EXPORT FileSystemFileUtil { // Truncates a file to the given length. // See header comments for AsyncFileUtil::Truncate() for more details. - virtual base::File::Error Truncate( - FileSystemOperationContext* context, - const FileSystemURL& url, - int64 length) = 0; + virtual base::File::Error Truncate(FileSystemOperationContext* context, + const FileSystemURL& url, + int64_t length) = 0; // Copies or moves a single file from |src_url| to |dest_url|. // The filesystem type of |src_url| and |dest_url| MUST be same. diff --git a/storage/browser/fileapi/file_system_operation.h b/storage/browser/fileapi/file_system_operation.h index 8580b35..2ef9c99 100644 --- a/storage/browser/fileapi/file_system_operation.h +++ b/storage/browser/fileapi/file_system_operation.h @@ -5,6 +5,8 @@ #ifndef STORAGE_BROWSER_FILEAPI_FILE_SYSTEM_OPERATION_H_ #define STORAGE_BROWSER_FILEAPI_FILE_SYSTEM_OPERATION_H_ +#include <stdint.h> + #include <vector> #include "base/callback.h" @@ -205,15 +207,14 @@ class FileSystemOperation { typedef base::Callback<void(CopyProgressType type, const FileSystemURL& source_url, const FileSystemURL& destination_url, - int64 size)> - CopyProgressCallback; + int64_t size)> CopyProgressCallback; // Used for CopyFileLocal() to report progress update. // |size| is the cumulative copied bytes for the copy. // At the beginning the progress callback should be called with |size| = 0, // and also at the ending the progress callback should be called with |size| // set to the copied file size. - typedef base::Callback<void(int64 size)> CopyFileProgressCallback; + typedef base::Callback<void(int64_t size)> CopyFileProgressCallback; // The option for copy or move operation. enum CopyOrMoveOption { @@ -237,7 +238,7 @@ class FileSystemOperation { // Used for Write(). typedef base::Callback<void(base::File::Error result, - int64 bytes, + int64_t bytes, bool complete)> WriteCallback; // Creates a file at |path|. If |exclusive| is true, an error is raised @@ -332,7 +333,8 @@ class FileSystemOperation { // Truncates a file at |path| to |length|. If |length| is larger than // the original file size, the file will be extended, and the extended // part is filled with null bytes. - virtual void Truncate(const FileSystemURL& path, int64 length, + virtual void Truncate(const FileSystemURL& path, + int64_t length, const StatusCallback& callback) = 0; // Tries to cancel the current operation [we support cancelling write or diff --git a/storage/browser/fileapi/file_system_operation_context.h b/storage/browser/fileapi/file_system_operation_context.h index 25fd5cf..ba4aa97 100644 --- a/storage/browser/fileapi/file_system_operation_context.h +++ b/storage/browser/fileapi/file_system_operation_context.h @@ -5,7 +5,10 @@ #ifndef STORAGE_BROWSER_FILEAPI_FILE_SYSTEM_OPERATION_CONTEXT_H_ #define STORAGE_BROWSER_FILEAPI_FILE_SYSTEM_OPERATION_CONTEXT_H_ +#include <stdint.h> + #include "base/files/file_path.h" +#include "base/macros.h" #include "base/supports_user_data.h" #include "base/threading/thread_checker.h" #include "storage/browser/fileapi/task_runner_bound_observer_list.h" @@ -44,12 +47,12 @@ class STORAGE_EXPORT FileSystemOperationContext // Updates the current remaining quota. // This can be called to update the remaining quota during the operation. - void set_allowed_bytes_growth(const int64& allowed_bytes_growth) { + void set_allowed_bytes_growth(const int64_t& allowed_bytes_growth) { allowed_bytes_growth_ = allowed_bytes_growth; } // Returns the current remaining quota. - int64 allowed_bytes_growth() const { return allowed_bytes_growth_; } + int64_t allowed_bytes_growth() const { return allowed_bytes_growth_; } storage::QuotaLimitType quota_limit_type() const { return quota_limit_type_; } base::SequencedTaskRunner* task_runner() const { return task_runner_.get(); } @@ -77,7 +80,7 @@ class STORAGE_EXPORT FileSystemOperationContext scoped_refptr<base::SequencedTaskRunner> task_runner_; // The current remaining quota, used by ObfuscatedFileUtil. - int64 allowed_bytes_growth_; + int64_t allowed_bytes_growth_; // The current quota limit type, used by ObfuscatedFileUtil. storage::QuotaLimitType quota_limit_type_; diff --git a/storage/browser/fileapi/file_system_operation_impl.cc b/storage/browser/fileapi/file_system_operation_impl.cc index 7cc26c0..84d80f6 100644 --- a/storage/browser/fileapi/file_system_operation_impl.cc +++ b/storage/browser/fileapi/file_system_operation_impl.cc @@ -4,6 +4,8 @@ #include "storage/browser/fileapi/file_system_operation_impl.h" +#include <stdint.h> + #include <limits> #include "base/bind.h" diff --git a/storage/browser/fileapi/file_system_operation_impl.h b/storage/browser/fileapi/file_system_operation_impl.h index 5638cca..de660f4 100644 --- a/storage/browser/fileapi/file_system_operation_impl.h +++ b/storage/browser/fileapi/file_system_operation_impl.h @@ -9,6 +9,7 @@ #include <vector> +#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/storage/browser/fileapi/file_system_operation_runner.cc b/storage/browser/fileapi/file_system_operation_runner.cc index 4b5d422..0ca729b 100644 --- a/storage/browser/fileapi/file_system_operation_runner.cc +++ b/storage/browser/fileapi/file_system_operation_runner.cc @@ -4,7 +4,10 @@ #include "storage/browser/fileapi/file_system_operation_runner.h" +#include <stdint.h> + #include "base/bind.h" +#include "base/macros.h" #include "base/stl_util.h" #include "base/thread_task_runner_handle.h" #include "net/url_request/url_request_context.h" @@ -238,7 +241,7 @@ OperationID FileSystemOperationRunner::Write( const net::URLRequestContext* url_request_context, const FileSystemURL& url, scoped_ptr<storage::BlobDataHandle> blob, - int64 offset, + int64_t offset, const WriteCallback& callback) { base::File::Error error = base::File::FILE_OK; FileSystemOperation* operation = @@ -275,7 +278,8 @@ OperationID FileSystemOperationRunner::Write( } OperationID FileSystemOperationRunner::Truncate( - const FileSystemURL& url, int64 length, + const FileSystemURL& url, + int64_t length, const StatusCallback& callback) { base::File::Error error = base::File::FILE_OK; FileSystemOperation* operation = @@ -557,12 +561,11 @@ void FileSystemOperationRunner::DidReadDirectory( FinishOperation(handle.id); } -void FileSystemOperationRunner::DidWrite( - const OperationHandle& handle, - const WriteCallback& callback, - base::File::Error rv, - int64 bytes, - bool complete) { +void FileSystemOperationRunner::DidWrite(const OperationHandle& handle, + const WriteCallback& callback, + base::File::Error rv, + int64_t bytes, + bool complete) { if (handle.scope) { finished_operations_.insert(handle.id); base::ThreadTaskRunnerHandle::Get()->PostTask( @@ -617,7 +620,7 @@ void FileSystemOperationRunner::OnCopyProgress( FileSystemOperation::CopyProgressType type, const FileSystemURL& source_url, const FileSystemURL& dest_url, - int64 size) { + int64_t size) { if (handle.scope) { base::ThreadTaskRunnerHandle::Get()->PostTask( FROM_HERE, base::Bind( diff --git a/storage/browser/fileapi/file_system_operation_runner.h b/storage/browser/fileapi/file_system_operation_runner.h index 1421e1a..dabe8f1 100644 --- a/storage/browser/fileapi/file_system_operation_runner.h +++ b/storage/browser/fileapi/file_system_operation_runner.h @@ -5,12 +5,14 @@ #ifndef STORAGE_BROWSER_FILEAPI_FILE_SYSTEM_OPERATION_RUNNER_H_ #define STORAGE_BROWSER_FILEAPI_FILE_SYSTEM_OPERATION_RUNNER_H_ +#include <stdint.h> + #include <map> #include <set> #include <vector> -#include "base/basictypes.h" #include "base/id_map.h" +#include "base/macros.h" #include "base/memory/scoped_ptr.h" #include "base/memory/weak_ptr.h" #include "storage/browser/blob/blob_data_handle.h" @@ -116,13 +118,14 @@ class STORAGE_EXPORT FileSystemOperationRunner OperationID Write(const net::URLRequestContext* url_request_context, const FileSystemURL& url, scoped_ptr<storage::BlobDataHandle> blob, - int64 offset, + int64_t offset, const WriteCallback& callback); // Truncates a file at |url| to |length|. If |length| is larger than // the original file size, the file will be extended, and the extended // part is filled with null bytes. - OperationID Truncate(const FileSystemURL& url, int64 length, + OperationID Truncate(const FileSystemURL& url, + int64_t length, const StatusCallback& callback); // Tries to cancel the operation |id| [we support cancelling write or @@ -270,7 +273,7 @@ class STORAGE_EXPORT FileSystemOperationRunner void DidWrite(const OperationHandle& handle, const WriteCallback& callback, base::File::Error rv, - int64 bytes, + int64_t bytes, bool complete); void DidOpenFile( const OperationHandle& handle, @@ -285,13 +288,12 @@ class STORAGE_EXPORT FileSystemOperationRunner const base::FilePath& platform_path, const scoped_refptr<storage::ShareableFileReference>& file_ref); - void OnCopyProgress( - const OperationHandle& handle, - const CopyProgressCallback& callback, - FileSystemOperation::CopyProgressType type, - const FileSystemURL& source_url, - const FileSystemURL& dest_url, - int64 size); + void OnCopyProgress(const OperationHandle& handle, + const CopyProgressCallback& callback, + FileSystemOperation::CopyProgressType type, + const FileSystemURL& source_url, + const FileSystemURL& dest_url, + int64_t size); void PrepareForWrite(OperationID id, const FileSystemURL& url); void PrepareForRead(OperationID id, const FileSystemURL& url); diff --git a/storage/browser/fileapi/file_system_quota_client.h b/storage/browser/fileapi/file_system_quota_client.h index 51d927a..563184a 100644 --- a/storage/browser/fileapi/file_system_quota_client.h +++ b/storage/browser/fileapi/file_system_quota_client.h @@ -9,9 +9,9 @@ #include <string> #include <utility> -#include "base/basictypes.h" #include "base/compiler_specific.h" #include "base/files/file_path.h" +#include "base/macros.h" #include "base/memory/ref_counted.h" #include "storage/browser/fileapi/file_system_quota_util.h" #include "storage/browser/quota/quota_client.h" diff --git a/storage/browser/fileapi/file_system_quota_util.h b/storage/browser/fileapi/file_system_quota_util.h index 0eef0ea..14f3eb8 100644 --- a/storage/browser/fileapi/file_system_quota_util.h +++ b/storage/browser/fileapi/file_system_quota_util.h @@ -5,10 +5,11 @@ #ifndef STORAGE_BROWSER_FILEAPI_FILE_SYSTEM_QUOTA_UTIL_H_ #define STORAGE_BROWSER_FILEAPI_FILE_SYSTEM_QUOTA_UTIL_H_ +#include <stdint.h> + #include <set> #include <string> -#include "base/basictypes.h" #include "base/files/file.h" #include "storage/browser/storage_browser_export.h" #include "storage/common/fileapi/file_system_types.h" @@ -51,7 +52,7 @@ class STORAGE_EXPORT FileSystemQuotaUtil { std::set<GURL>* origins) = 0; // Returns the amount of data used for the origin for usage tracking. - virtual int64 GetOriginUsageOnFileTaskRunner( + virtual int64_t GetOriginUsageOnFileTaskRunner( storage::FileSystemContext* file_system_context, const GURL& origin_url, storage::FileSystemType type) = 0; diff --git a/storage/browser/fileapi/file_system_url_request_job.cc b/storage/browser/fileapi/file_system_url_request_job.cc index 8edcb3d..48ce68e7 100644 --- a/storage/browser/fileapi/file_system_url_request_job.cc +++ b/storage/browser/fileapi/file_system_url_request_job.cc @@ -4,12 +4,15 @@ #include "storage/browser/fileapi/file_system_url_request_job.h" +#include <stddef.h> + #include <vector> #include "base/bind.h" #include "base/compiler_specific.h" #include "base/files/file_path.h" #include "base/files/file_util_proxy.h" +#include "base/macros.h" #include "base/message_loop/message_loop.h" #include "base/threading/thread_restrictions.h" #include "base/time/time.h" diff --git a/storage/browser/fileapi/file_system_url_request_job.h b/storage/browser/fileapi/file_system_url_request_job.h index 308b66c..c06a34b 100644 --- a/storage/browser/fileapi/file_system_url_request_job.h +++ b/storage/browser/fileapi/file_system_url_request_job.h @@ -5,9 +5,12 @@ #ifndef STORAGE_BROWSER_FILEAPI_FILE_SYSTEM_URL_REQUEST_JOB_H_ #define STORAGE_BROWSER_FILEAPI_FILE_SYSTEM_URL_REQUEST_JOB_H_ +#include <stdint.h> + #include <string> #include "base/files/file.h" +#include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" #include "base/memory/weak_ptr.h" @@ -68,7 +71,7 @@ class STORAGE_EXPORT FileSystemURLRequestJob : public net::URLRequestJob { FileSystemURL url_; bool is_directory_; scoped_ptr<net::HttpResponseInfo> response_info_; - int64 remaining_bytes_; + int64_t remaining_bytes_; net::Error range_parse_result_; net::HttpByteRange byte_range_; base::WeakPtrFactory<FileSystemURLRequestJob> weak_factory_; diff --git a/storage/browser/fileapi/file_system_url_request_job_factory.cc b/storage/browser/fileapi/file_system_url_request_job_factory.cc index c61c8c0..90dd81f 100644 --- a/storage/browser/fileapi/file_system_url_request_job_factory.cc +++ b/storage/browser/fileapi/file_system_url_request_job_factory.cc @@ -4,8 +4,8 @@ #include "storage/browser/fileapi/file_system_url_request_job_factory.h" -#include "base/basictypes.h" #include "base/compiler_specific.h" +#include "base/macros.h" #include "net/url_request/url_request.h" #include "storage/browser/fileapi/file_system_dir_url_request_job.h" #include "storage/browser/fileapi/file_system_url_request_job.h" diff --git a/storage/browser/fileapi/file_system_usage_cache.cc b/storage/browser/fileapi/file_system_usage_cache.cc index 3ef195f..d9a2d00 100644 --- a/storage/browser/fileapi/file_system_usage_cache.cc +++ b/storage/browser/fileapi/file_system_usage_cache.cc @@ -4,6 +4,9 @@ #include "storage/browser/fileapi/file_system_usage_cache.h" +#include <stddef.h> +#include <stdint.h> + #include <utility> #include "base/bind.h" @@ -16,7 +19,7 @@ namespace storage { namespace { -const int64 kCloseDelaySeconds = 5; +const int64_t kCloseDelaySeconds = 5; const size_t kMaxHandleCacheSize = 2; } // namespace @@ -39,16 +42,16 @@ const int FileSystemUsageCache::kUsageFileHeaderSize = 4; // Pickle::{Read,Write}Bool treat bool as int const int FileSystemUsageCache::kUsageFileSize = sizeof(base::Pickle::Header) + FileSystemUsageCache::kUsageFileHeaderSize + - sizeof(int) + sizeof(int32) + sizeof(int64); // NOLINT + sizeof(int) + sizeof(int32_t) + sizeof(int64_t); // NOLINT bool FileSystemUsageCache::GetUsage(const base::FilePath& usage_file_path, - int64* usage_out) { + int64_t* usage_out) { TRACE_EVENT0("FileSystem", "UsageCache::GetUsage"); DCHECK(CalledOnValidThread()); DCHECK(usage_out); bool is_valid = true; - uint32 dirty = 0; - int64 usage = 0; + uint32_t dirty = 0; + int64_t usage = 0; if (!Read(usage_file_path, &is_valid, &dirty, &usage)) return false; *usage_out = usage; @@ -56,13 +59,13 @@ bool FileSystemUsageCache::GetUsage(const base::FilePath& usage_file_path, } bool FileSystemUsageCache::GetDirty(const base::FilePath& usage_file_path, - uint32* dirty_out) { + uint32_t* dirty_out) { TRACE_EVENT0("FileSystem", "UsageCache::GetDirty"); DCHECK(CalledOnValidThread()); DCHECK(dirty_out); bool is_valid = true; - uint32 dirty = 0; - int64 usage = 0; + uint32_t dirty = 0; + int64_t usage = 0; if (!Read(usage_file_path, &is_valid, &dirty, &usage)) return false; *dirty_out = dirty; @@ -74,8 +77,8 @@ bool FileSystemUsageCache::IncrementDirty( TRACE_EVENT0("FileSystem", "UsageCache::IncrementDirty"); DCHECK(CalledOnValidThread()); bool is_valid = true; - uint32 dirty = 0; - int64 usage = 0; + uint32_t dirty = 0; + int64_t usage = 0; bool new_handle = !HasCacheFileHandle(usage_file_path); if (!Read(usage_file_path, &is_valid, &dirty, &usage)) return false; @@ -91,8 +94,8 @@ bool FileSystemUsageCache::DecrementDirty( TRACE_EVENT0("FileSystem", "UsageCache::DecrementDirty"); DCHECK(CalledOnValidThread()); bool is_valid = true; - uint32 dirty = 0; - int64 usage = 0; + uint32_t dirty = 0; + int64_t usage = 0; if (!Read(usage_file_path, &is_valid, &dirty, &usage) || dirty == 0) return false; @@ -103,8 +106,8 @@ bool FileSystemUsageCache::Invalidate(const base::FilePath& usage_file_path) { TRACE_EVENT0("FileSystem", "UsageCache::Invalidate"); DCHECK(CalledOnValidThread()); bool is_valid = true; - uint32 dirty = 0; - int64 usage = 0; + uint32_t dirty = 0; + int64_t usage = 0; if (!Read(usage_file_path, &is_valid, &dirty, &usage)) return false; @@ -115,27 +118,29 @@ bool FileSystemUsageCache::IsValid(const base::FilePath& usage_file_path) { TRACE_EVENT0("FileSystem", "UsageCache::IsValid"); DCHECK(CalledOnValidThread()); bool is_valid = true; - uint32 dirty = 0; - int64 usage = 0; + uint32_t dirty = 0; + int64_t usage = 0; if (!Read(usage_file_path, &is_valid, &dirty, &usage)) return false; return is_valid; } bool FileSystemUsageCache::AtomicUpdateUsageByDelta( - const base::FilePath& usage_file_path, int64 delta) { + const base::FilePath& usage_file_path, + int64_t delta) { TRACE_EVENT0("FileSystem", "UsageCache::AtomicUpdateUsageByDelta"); DCHECK(CalledOnValidThread()); bool is_valid = true; - uint32 dirty = 0; - int64 usage = 0;; + uint32_t dirty = 0; + int64_t usage = 0; + ; if (!Read(usage_file_path, &is_valid, &dirty, &usage)) return false; return Write(usage_file_path, is_valid, dirty, usage + delta); } bool FileSystemUsageCache::UpdateUsage(const base::FilePath& usage_file_path, - int64 fs_usage) { + int64_t fs_usage) { TRACE_EVENT0("FileSystem", "UsageCache::UpdateUsage"); DCHECK(CalledOnValidThread()); return Write(usage_file_path, true, 0, fs_usage); @@ -162,9 +167,9 @@ void FileSystemUsageCache::CloseCacheFiles() { } bool FileSystemUsageCache::Read(const base::FilePath& usage_file_path, - bool* is_valid, - uint32* dirty_out, - int64* usage_out) { + bool* is_valid, + uint32_t* dirty_out, + int64_t* usage_out) { TRACE_EVENT0("FileSystem", "UsageCache::Read"); DCHECK(CalledOnValidThread()); DCHECK(is_valid); @@ -177,8 +182,8 @@ bool FileSystemUsageCache::Read(const base::FilePath& usage_file_path, return false; base::Pickle read_pickle(buffer, kUsageFileSize); base::PickleIterator iter(read_pickle); - uint32 dirty = 0; - int64 usage = 0; + uint32_t dirty = 0; + int64_t usage = 0; if (!iter.ReadBytes(&header, kUsageFileHeaderSize) || !iter.ReadBool(is_valid) || @@ -199,8 +204,8 @@ bool FileSystemUsageCache::Read(const base::FilePath& usage_file_path, bool FileSystemUsageCache::Write(const base::FilePath& usage_file_path, bool is_valid, - int32 dirty, - int64 usage) { + int32_t dirty, + int64_t usage) { TRACE_EVENT0("FileSystem", "UsageCache::Write"); DCHECK(CalledOnValidThread()); base::Pickle write_pickle; @@ -246,7 +251,7 @@ base::File* FileSystemUsageCache::GetFile(const base::FilePath& file_path) { bool FileSystemUsageCache::ReadBytes(const base::FilePath& file_path, char* buffer, - int64 buffer_size) { + int64_t buffer_size) { DCHECK(CalledOnValidThread()); base::File* file = GetFile(file_path); if (!file) @@ -256,7 +261,7 @@ bool FileSystemUsageCache::ReadBytes(const base::FilePath& file_path, bool FileSystemUsageCache::WriteBytes(const base::FilePath& file_path, const char* buffer, - int64 buffer_size) { + int64_t buffer_size) { DCHECK(CalledOnValidThread()); base::File* file = GetFile(file_path); if (!file) diff --git a/storage/browser/fileapi/file_system_usage_cache.h b/storage/browser/fileapi/file_system_usage_cache.h index 901df28..c4d5474 100644 --- a/storage/browser/fileapi/file_system_usage_cache.h +++ b/storage/browser/fileapi/file_system_usage_cache.h @@ -5,11 +5,13 @@ #ifndef STORAGE_BROWSER_FILEAPI_FILE_SYSTEM_USAGE_CACHE_H_ #define STORAGE_BROWSER_FILEAPI_FILE_SYSTEM_USAGE_CACHE_H_ +#include <stdint.h> + #include <map> -#include "base/basictypes.h" #include "base/files/file.h" #include "base/files/file_path.h" +#include "base/macros.h" #include "base/memory/scoped_ptr.h" #include "base/memory/weak_ptr.h" #include "base/sequenced_task_runner.h" @@ -26,11 +28,11 @@ class STORAGE_EXPORT FileSystemUsageCache { // Gets the size described in the .usage file even if dirty > 0 or // is_valid == false. Returns true if the .usage file is available. - bool GetUsage(const base::FilePath& usage_file_path, int64* usage); + bool GetUsage(const base::FilePath& usage_file_path, int64_t* usage); // Gets the dirty count in the .usage file. // Returns true if the .usage file is available. - bool GetDirty(const base::FilePath& usage_file_path, uint32* dirty); + bool GetDirty(const base::FilePath& usage_file_path, uint32_t* dirty); // Increments or decrements the "dirty" entry in the .usage file. // Returns false if no .usage is available. @@ -43,12 +45,12 @@ class STORAGE_EXPORT FileSystemUsageCache { bool IsValid(const base::FilePath& usage_file_path); // Updates the size described in the .usage file. - bool UpdateUsage(const base::FilePath& usage_file_path, int64 fs_usage); + bool UpdateUsage(const base::FilePath& usage_file_path, int64_t fs_usage); // Updates the size described in the .usage file by delta with keeping dirty // even if dirty > 0. bool AtomicUpdateUsageByDelta(const base::FilePath& usage_file_path, - int64 delta); + int64_t delta); bool Exists(const base::FilePath& usage_file_path); bool Delete(const base::FilePath& usage_file_path); @@ -67,22 +69,22 @@ class STORAGE_EXPORT FileSystemUsageCache { // Returns less than zero if no .usage file is available. bool Read(const base::FilePath& usage_file_path, bool* is_valid, - uint32* dirty, - int64* usage); + uint32_t* dirty, + int64_t* usage); bool Write(const base::FilePath& usage_file_path, bool is_valid, - int32 dirty, - int64 fs_usage); + int32_t dirty, + int64_t fs_usage); base::File* GetFile(const base::FilePath& file_path); bool ReadBytes(const base::FilePath& file_path, char* buffer, - int64 buffer_size); + int64_t buffer_size); bool WriteBytes(const base::FilePath& file_path, const char* buffer, - int64 buffer_size); + int64_t buffer_size); bool FlushFile(const base::FilePath& file_path); void ScheduleCloseTimer(); diff --git a/storage/browser/fileapi/file_writer_delegate.cc b/storage/browser/fileapi/file_writer_delegate.cc index b401e02..8ccf846 100644 --- a/storage/browser/fileapi/file_writer_delegate.cc +++ b/storage/browser/fileapi/file_writer_delegate.cc @@ -4,6 +4,8 @@ #include "storage/browser/fileapi/file_writer_delegate.h" +#include <stdint.h> + #include "base/bind.h" #include "base/callback.h" #include "base/files/file_util_proxy.h" @@ -133,7 +135,7 @@ void FileWriterDelegate::OnDataReceived(int bytes_read) { void FileWriterDelegate::Write() { writing_started_ = true; - int64 bytes_to_write = bytes_read_ - bytes_written_; + int64_t bytes_to_write = bytes_read_ - bytes_written_; int write_response = file_stream_writer_->Write(cursor_.get(), static_cast<int>(bytes_to_write), diff --git a/storage/browser/fileapi/file_writer_delegate.h b/storage/browser/fileapi/file_writer_delegate.h index dca4bd8..2e58e25 100644 --- a/storage/browser/fileapi/file_writer_delegate.h +++ b/storage/browser/fileapi/file_writer_delegate.h @@ -5,8 +5,11 @@ #ifndef STORAGE_BROWSER_FILEAPI_FILE_WRITER_DELEGATE_H_ #define STORAGE_BROWSER_FILEAPI_FILE_WRITER_DELEGATE_H_ +#include <stdint.h> + #include "base/files/file.h" #include "base/files/file_path.h" +#include "base/macros.h" #include "base/memory/scoped_ptr.h" #include "base/memory/weak_ptr.h" #include "base/time/time.h" @@ -30,7 +33,7 @@ class STORAGE_EXPORT FileWriterDelegate : public net::URLRequest::Delegate { }; typedef base::Callback<void(base::File::Error result, - int64 bytes, + int64_t bytes, WriteProgressStatus write_status)> DelegateWriteCallback; diff --git a/storage/browser/fileapi/isolated_context.cc b/storage/browser/fileapi/isolated_context.cc index e327c2a..6edc40d 100644 --- a/storage/browser/fileapi/isolated_context.cc +++ b/storage/browser/fileapi/isolated_context.cc @@ -4,7 +4,11 @@ #include "storage/browser/fileapi/isolated_context.h" +#include <stddef.h> +#include <stdint.h> + #include "base/logging.h" +#include "base/macros.h" #include "base/rand_util.h" #include "base/stl_util.h" #include "base/strings/string_number_conversions.h" @@ -470,7 +474,7 @@ bool IsolatedContext::UnregisterFileSystem(const std::string& filesystem_id) { std::string IsolatedContext::GetNewFileSystemId() const { // Returns an arbitrary random string which must be unique in the map. lock_.AssertAcquired(); - uint32 random_data[4]; + uint32_t random_data[4]; std::string id; do { base::RandBytes(random_data, sizeof(random_data)); diff --git a/storage/browser/fileapi/isolated_context.h b/storage/browser/fileapi/isolated_context.h index ff1f58e..b89045b 100644 --- a/storage/browser/fileapi/isolated_context.h +++ b/storage/browser/fileapi/isolated_context.h @@ -10,9 +10,9 @@ #include <string> #include <vector> -#include "base/basictypes.h" #include "base/files/file_path.h" #include "base/lazy_instance.h" +#include "base/macros.h" #include "base/memory/singleton.h" #include "base/synchronization/lock.h" #include "storage/browser/fileapi/mount_points.h" diff --git a/storage/browser/fileapi/isolated_file_system_backend.cc b/storage/browser/fileapi/isolated_file_system_backend.cc index 6ecc9e2..bd8d9bf 100644 --- a/storage/browser/fileapi/isolated_file_system_backend.cc +++ b/storage/browser/fileapi/isolated_file_system_backend.cc @@ -4,6 +4,8 @@ #include "storage/browser/fileapi/isolated_file_system_backend.h" +#include <stdint.h> + #include <string> #include "base/bind.h" @@ -124,8 +126,8 @@ bool IsolatedFileSystemBackend::HasInplaceCopyImplementation( scoped_ptr<storage::FileStreamReader> IsolatedFileSystemBackend::CreateFileStreamReader( const FileSystemURL& url, - int64 offset, - int64 max_bytes_to_read, + int64_t offset, + int64_t max_bytes_to_read, const base::Time& expected_modification_time, FileSystemContext* context) const { return scoped_ptr<storage::FileStreamReader>( @@ -138,7 +140,7 @@ IsolatedFileSystemBackend::CreateFileStreamReader( scoped_ptr<FileStreamWriter> IsolatedFileSystemBackend::CreateFileStreamWriter( const FileSystemURL& url, - int64 offset, + int64_t offset, FileSystemContext* context) const { return scoped_ptr<FileStreamWriter>( FileStreamWriter::CreateForLocalFile( diff --git a/storage/browser/fileapi/isolated_file_system_backend.h b/storage/browser/fileapi/isolated_file_system_backend.h index bd13db4..2e00818 100644 --- a/storage/browser/fileapi/isolated_file_system_backend.h +++ b/storage/browser/fileapi/isolated_file_system_backend.h @@ -5,6 +5,8 @@ #ifndef STORAGE_BROWSER_FILEAPI_ISOLATED_FILE_SYSTEM_BACKEND_H_ #define STORAGE_BROWSER_FILEAPI_ISOLATED_FILE_SYSTEM_BACKEND_H_ +#include <stdint.h> + #include "base/memory/scoped_ptr.h" #include "storage/browser/fileapi/file_system_backend.h" #include "storage/browser/fileapi/task_runner_bound_observer_list.h" @@ -39,13 +41,13 @@ class IsolatedFileSystemBackend : public FileSystemBackend { storage::FileSystemType type) const override; scoped_ptr<storage::FileStreamReader> CreateFileStreamReader( const FileSystemURL& url, - int64 offset, - int64 max_bytes_to_read, + int64_t offset, + int64_t max_bytes_to_read, const base::Time& expected_modification_time, FileSystemContext* context) const override; scoped_ptr<FileStreamWriter> CreateFileStreamWriter( const FileSystemURL& url, - int64 offset, + int64_t offset, FileSystemContext* context) const override; FileSystemQuotaUtil* GetQuotaUtil() override; const UpdateObserverList* GetUpdateObservers( diff --git a/storage/browser/fileapi/local_file_stream_reader.cc b/storage/browser/fileapi/local_file_stream_reader.cc index e8473eb..c6bfbbd 100644 --- a/storage/browser/fileapi/local_file_stream_reader.cc +++ b/storage/browser/fileapi/local_file_stream_reader.cc @@ -4,6 +4,8 @@ #include "storage/browser/fileapi/local_file_stream_reader.h" +#include <stdint.h> + #include "base/files/file_util.h" #include "base/files/file_util_proxy.h" #include "base/location.h" @@ -26,7 +28,7 @@ const int kOpenFlagsForRead = base::File::FLAG_OPEN | FileStreamReader* FileStreamReader::CreateForLocalFile( base::TaskRunner* task_runner, const base::FilePath& file_path, - int64 initial_offset, + int64_t initial_offset, const base::Time& expected_modification_time) { return new LocalFileStreamReader(task_runner, file_path, initial_offset, expected_modification_time); @@ -45,7 +47,7 @@ int LocalFileStreamReader::Read(net::IOBuffer* buf, int buf_len, make_scoped_refptr(buf), buf_len, callback)); } -int64 LocalFileStreamReader::GetLength( +int64_t LocalFileStreamReader::GetLength( const net::Int64CompletionCallback& callback) { const bool posted = base::FileUtilProxy::GetFileInfo( task_runner_.get(), @@ -60,7 +62,7 @@ int64 LocalFileStreamReader::GetLength( LocalFileStreamReader::LocalFileStreamReader( base::TaskRunner* task_runner, const base::FilePath& file_path, - int64 initial_offset, + int64_t initial_offset, const base::Time& expected_modification_time) : task_runner_(task_runner), file_path_(file_path), @@ -82,7 +84,7 @@ int LocalFileStreamReader::Open(const net::CompletionCallback& callback) { void LocalFileStreamReader::DidVerifyForOpen( const net::CompletionCallback& callback, - int64 get_length_result) { + int64_t get_length_result) { if (get_length_result < 0) { callback.Run(static_cast<int>(get_length_result)); return; @@ -115,7 +117,7 @@ void LocalFileStreamReader::DidOpenFileStream( void LocalFileStreamReader::DidSeekFileStream( const net::CompletionCallback& callback, - int64 seek_result) { + int64_t seek_result) { if (seek_result < 0) { callback.Run(static_cast<int>(seek_result)); return; diff --git a/storage/browser/fileapi/local_file_stream_reader.h b/storage/browser/fileapi/local_file_stream_reader.h index dfc75e2..0f511bd 100644 --- a/storage/browser/fileapi/local_file_stream_reader.h +++ b/storage/browser/fileapi/local_file_stream_reader.h @@ -5,7 +5,8 @@ #ifndef STORAGE_BROWSER_BLOB_LOCAL_FILE_STREAM_READER_H_ #define STORAGE_BROWSER_BLOB_LOCAL_FILE_STREAM_READER_H_ -#include "base/basictypes.h" +#include <stdint.h> + #include "base/compiler_specific.h" #include "base/files/file.h" #include "base/files/file_path.h" @@ -39,7 +40,7 @@ class STORAGE_EXPORT LocalFileStreamReader int Read(net::IOBuffer* buf, int buf_len, const net::CompletionCallback& callback) override; - int64 GetLength(const net::Int64CompletionCallback& callback) override; + int64_t GetLength(const net::Int64CompletionCallback& callback) override; private: friend class FileStreamReader; @@ -47,17 +48,17 @@ class STORAGE_EXPORT LocalFileStreamReader LocalFileStreamReader(base::TaskRunner* task_runner, const base::FilePath& file_path, - int64 initial_offset, + int64_t initial_offset, const base::Time& expected_modification_time); int Open(const net::CompletionCallback& callback); // Callbacks that are chained from Open for Read. void DidVerifyForOpen(const net::CompletionCallback& callback, - int64 get_length_result); + int64_t get_length_result); void DidOpenFileStream(const net::CompletionCallback& callback, int result); void DidSeekFileStream(const net::CompletionCallback& callback, - int64 seek_result); + int64_t seek_result); void DidOpenForRead(net::IOBuffer* buf, int buf_len, const net::CompletionCallback& callback, @@ -70,7 +71,7 @@ class STORAGE_EXPORT LocalFileStreamReader scoped_refptr<base::TaskRunner> task_runner_; scoped_ptr<net::FileStream> stream_impl_; const base::FilePath file_path_; - const int64 initial_offset_; + const int64_t initial_offset_; const base::Time expected_modification_time_; bool has_pending_open_; base::WeakPtrFactory<LocalFileStreamReader> weak_factory_; diff --git a/storage/browser/fileapi/local_file_stream_writer.cc b/storage/browser/fileapi/local_file_stream_writer.cc index 72eb6cd..e586fd1 100644 --- a/storage/browser/fileapi/local_file_stream_writer.cc +++ b/storage/browser/fileapi/local_file_stream_writer.cc @@ -4,6 +4,8 @@ #include "storage/browser/fileapi/local_file_stream_writer.h" +#include <stdint.h> + #include "base/message_loop/message_loop.h" #include "net/base/file_stream.h" #include "net/base/io_buffer.h" @@ -25,7 +27,7 @@ const int kCreateFlagsForWrite = base::File::FLAG_CREATE | FileStreamWriter* FileStreamWriter::CreateForLocalFile( base::TaskRunner* task_runner, const base::FilePath& file_path, - int64 initial_offset, + int64_t initial_offset, OpenOrCreate open_or_create) { return new LocalFileStreamWriter( task_runner, file_path, initial_offset, open_or_create); @@ -85,7 +87,7 @@ int LocalFileStreamWriter::Flush(const net::CompletionCallback& callback) { LocalFileStreamWriter::LocalFileStreamWriter(base::TaskRunner* task_runner, const base::FilePath& file_path, - int64 initial_offset, + int64_t initial_offset, OpenOrCreate open_or_create) : file_path_(file_path), open_or_create_(open_or_create), @@ -165,7 +167,7 @@ void LocalFileStreamWriter::InitiateSeek( void LocalFileStreamWriter::DidSeek( const net::CompletionCallback& error_callback, const base::Closure& main_operation, - int64 result) { + int64_t result) { DCHECK(has_pending_operation_); if (CancelIfRequested()) diff --git a/storage/browser/fileapi/local_file_stream_writer.h b/storage/browser/fileapi/local_file_stream_writer.h index d5aea94..43375e6 100644 --- a/storage/browser/fileapi/local_file_stream_writer.h +++ b/storage/browser/fileapi/local_file_stream_writer.h @@ -5,11 +5,14 @@ #ifndef STORAGE_BROWSER_FILEAPI_LOCAL_FILE_STREAM_WRITER_H_ #define STORAGE_BROWSER_FILEAPI_LOCAL_FILE_STREAM_WRITER_H_ +#include <stdint.h> + #include <utility> #include "base/callback.h" #include "base/compiler_specific.h" #include "base/files/file_path.h" +#include "base/macros.h" #include "base/memory/scoped_ptr.h" #include "base/memory/weak_ptr.h" #include "base/task_runner.h" @@ -44,7 +47,7 @@ class STORAGE_EXPORT LocalFileStreamWriter friend class FileStreamWriter; LocalFileStreamWriter(base::TaskRunner* task_runner, const base::FilePath& file_path, - int64 initial_offset, + int64_t initial_offset, OpenOrCreate open_or_create); // Opens |file_path_| and if it succeeds, proceeds to InitiateSeek(). @@ -61,7 +64,7 @@ class STORAGE_EXPORT LocalFileStreamWriter const base::Closure& main_operation); void DidSeek(const net::CompletionCallback& error_callback, const base::Closure& main_operation, - int64 result); + int64_t result); // Passed as the |main_operation| of InitiateOpen() function. void ReadyToWrite(net::IOBuffer* buf, int buf_len, @@ -83,7 +86,7 @@ class STORAGE_EXPORT LocalFileStreamWriter // Initialization parameters. const base::FilePath file_path_; OpenOrCreate open_or_create_; - const int64 initial_offset_; + const int64_t initial_offset_; scoped_refptr<base::TaskRunner> task_runner_; // Current states of the operation. diff --git a/storage/browser/fileapi/local_file_util.cc b/storage/browser/fileapi/local_file_util.cc index 27a1308..b63b44f 100644 --- a/storage/browser/fileapi/local_file_util.cc +++ b/storage/browser/fileapi/local_file_util.cc @@ -4,6 +4,8 @@ #include "storage/browser/fileapi/local_file_util.h" +#include <stdint.h> + #include "base/files/file_enumerator.h" #include "base/files/file_util.h" #include "base/files/file_util_proxy.h" @@ -35,7 +37,7 @@ class LocalFileEnumerator : public FileSystemFileUtil::AbstractFileEnumerator { ~LocalFileEnumerator() override {} base::FilePath Next() override; - int64 Size() override; + int64_t Size() override; base::Time LastModifiedTime() override; bool IsDirectory() override; @@ -60,7 +62,7 @@ base::FilePath LocalFileEnumerator::Next() { return virtual_root_path_.Append(path); } -int64 LocalFileEnumerator::Size() { +int64_t LocalFileEnumerator::Size() { return file_util_info_.GetSize(); } @@ -173,10 +175,9 @@ base::File::Error LocalFileUtil::Touch( return NativeFileUtil::Touch(file_path, last_access_time, last_modified_time); } -base::File::Error LocalFileUtil::Truncate( - FileSystemOperationContext* context, - const FileSystemURL& url, - int64 length) { +base::File::Error LocalFileUtil::Truncate(FileSystemOperationContext* context, + const FileSystemURL& url, + int64_t length) { base::FilePath file_path; base::File::Error error = GetLocalFilePath(context, url, &file_path); if (error != base::File::FILE_OK) diff --git a/storage/browser/fileapi/local_file_util.h b/storage/browser/fileapi/local_file_util.h index 44dddb6..c1ae05f 100644 --- a/storage/browser/fileapi/local_file_util.h +++ b/storage/browser/fileapi/local_file_util.h @@ -5,8 +5,11 @@ #ifndef STORAGE_BROWSER_FILEAPI_LOCAL_FILE_UTIL_H_ #define STORAGE_BROWSER_FILEAPI_LOCAL_FILE_UTIL_H_ +#include <stdint.h> + #include "base/compiler_specific.h" #include "base/files/file_path.h" +#include "base/macros.h" #include "base/memory/scoped_ptr.h" #include "storage/browser/fileapi/file_system_file_util.h" #include "storage/browser/storage_browser_export.h" @@ -55,7 +58,7 @@ class STORAGE_EXPORT LocalFileUtil const base::Time& last_modified_time) override; base::File::Error Truncate(FileSystemOperationContext* context, const FileSystemURL& url, - int64 length) override; + int64_t length) override; base::File::Error CopyOrMoveFile(FileSystemOperationContext* context, const FileSystemURL& src_url, const FileSystemURL& dest_url, diff --git a/storage/browser/fileapi/mount_points.h b/storage/browser/fileapi/mount_points.h index 61da5fa..10cf47d 100644 --- a/storage/browser/fileapi/mount_points.h +++ b/storage/browser/fileapi/mount_points.h @@ -8,8 +8,8 @@ #include <string> #include <vector> -#include "base/basictypes.h" #include "base/files/file_path.h" +#include "base/macros.h" #include "storage/browser/storage_browser_export.h" #include "storage/common/fileapi/file_system_util.h" diff --git a/storage/browser/fileapi/native_file_util.cc b/storage/browser/fileapi/native_file_util.cc index 692fc87..852a02e 100644 --- a/storage/browser/fileapi/native_file_util.cc +++ b/storage/browser/fileapi/native_file_util.cc @@ -4,6 +4,8 @@ #include "storage/browser/fileapi/native_file_util.h" +#include <stdint.h> + #include "base/files/file_enumerator.h" #include "base/files/file_util.h" #include "storage/browser/fileapi/file_system_operation_context.h" @@ -83,7 +85,7 @@ class NativeFileEnumerator : public FileSystemFileUtil::AbstractFileEnumerator { ~NativeFileEnumerator() override {} base::FilePath Next() override; - int64 Size() override; + int64_t Size() override; base::Time LastModifiedTime() override; bool IsDirectory() override; @@ -99,7 +101,7 @@ base::FilePath NativeFileEnumerator::Next() { return rv; } -int64 NativeFileEnumerator::Size() { +int64_t NativeFileEnumerator::Size() { return file_util_info_.GetSize(); } @@ -222,7 +224,7 @@ base::File::Error NativeFileUtil::Touch( } base::File::Error NativeFileUtil::Truncate(const base::FilePath& path, - int64 length) { + int64_t length) { base::File file(path, base::File::FLAG_OPEN | base::File::FLAG_WRITE); if (!file.IsValid()) return file.error_details(); diff --git a/storage/browser/fileapi/native_file_util.h b/storage/browser/fileapi/native_file_util.h index 39b865c..c1fea3f 100644 --- a/storage/browser/fileapi/native_file_util.h +++ b/storage/browser/fileapi/native_file_util.h @@ -5,9 +5,12 @@ #ifndef STORAGE_BROWSER_FILEAPI_NATIVE_FILE_UTIL_H_ #define STORAGE_BROWSER_FILEAPI_NATIVE_FILE_UTIL_H_ +#include <stdint.h> + #include "base/files/file.h" #include "base/files/file_path.h" #include "base/files/file_util_proxy.h" +#include "base/macros.h" #include "base/memory/scoped_ptr.h" #include "storage/browser/fileapi/file_system_file_util.h" #include "storage/browser/storage_browser_export.h" @@ -53,8 +56,7 @@ class STORAGE_EXPORT NativeFileUtil { static base::File::Error Touch(const base::FilePath& path, const base::Time& last_access_time, const base::Time& last_modified_time); - static base::File::Error Truncate(const base::FilePath& path, - int64 length); + static base::File::Error Truncate(const base::FilePath& path, int64_t length); static bool PathExists(const base::FilePath& path); static bool DirectoryExists(const base::FilePath& path); static base::File::Error CopyOrMoveFile( diff --git a/storage/browser/fileapi/obfuscated_file_util.cc b/storage/browser/fileapi/obfuscated_file_util.cc index a9fdb8c..cbe2739 100644 --- a/storage/browser/fileapi/obfuscated_file_util.cc +++ b/storage/browser/fileapi/obfuscated_file_util.cc @@ -4,6 +4,9 @@ #include "storage/browser/fileapi/obfuscated_file_util.h" +#include <stddef.h> +#include <stdint.h> + #include <queue> #include "base/files/file_util.h" @@ -62,31 +65,31 @@ void InitFileInfo( // which base::FilePath uses wide chars [since they're converted to UTF-8 for // storage anyway], but as long as the cost is high enough that one can't cheat // on quota by storing data in paths, it doesn't need to be all that accurate. -const int64 kPathCreationQuotaCost = 146; // Bytes per inode, basically. -const int64 kPathByteQuotaCost = 2; // Bytes per byte of path length in UTF-8. +const int64_t kPathCreationQuotaCost = 146; // Bytes per inode, basically. +const int64_t kPathByteQuotaCost = + 2; // Bytes per byte of path length in UTF-8. const char kDirectoryDatabaseKeySeparator = ' '; -int64 UsageForPath(size_t length) { +int64_t UsageForPath(size_t length) { return kPathCreationQuotaCost + - static_cast<int64>(length) * kPathByteQuotaCost; + static_cast<int64_t>(length) * kPathByteQuotaCost; } -bool AllocateQuota(FileSystemOperationContext* context, int64 growth) { +bool AllocateQuota(FileSystemOperationContext* context, int64_t growth) { if (context->allowed_bytes_growth() == storage::QuotaManager::kNoLimit) return true; - int64 new_quota = context->allowed_bytes_growth() - growth; + int64_t new_quota = context->allowed_bytes_growth() - growth; if (growth > 0 && new_quota < 0) return false; context->set_allowed_bytes_growth(new_quota); return true; } -void UpdateUsage( - FileSystemOperationContext* context, - const FileSystemURL& url, - int64 growth) { +void UpdateUsage(FileSystemOperationContext* context, + const FileSystemURL& url, + int64_t growth) { context->update_observers()->Notify( &FileUpdateObserver::OnUpdate, base::MakeTuple(url, growth)); } @@ -158,7 +161,7 @@ class ObfuscatedFileEnumerator return virtual_path; } - int64 Size() override { return current_platform_file_info_.size; } + int64_t Size() override { return current_platform_file_info_.size; } base::Time LastModifiedTime() override { return current_platform_file_info_.last_modified; @@ -310,7 +313,7 @@ base::File::Error ObfuscatedFileUtil::EnsureFileExists( InitFileInfo(&file_info, parent_id, VirtualPath::BaseName(url.path()).value()); - int64 growth = UsageForPath(file_info.name.size()); + int64_t growth = UsageForPath(file_info.name.size()); if (!AllocateQuota(context, growth)) return base::File::FILE_ERROR_NO_SPACE; base::File::Error error = CreateFile(context, base::FilePath(), url, @@ -370,7 +373,7 @@ base::File::Error ObfuscatedFileUtil::CreateDirectory( continue; file_info.modification_time = base::Time::Now(); file_info.parent_id = parent_id; - int64 growth = UsageForPath(file_info.name.size()); + int64_t growth = UsageForPath(file_info.name.size()); if (!AllocateQuota(context, growth)) return base::File::FILE_ERROR_NO_SPACE; base::File::Error error = db->AddFileInfo(file_info, &parent_id); @@ -464,7 +467,7 @@ base::File::Error ObfuscatedFileUtil::Touch( base::File::Error ObfuscatedFileUtil::Truncate( FileSystemOperationContext* context, const FileSystemURL& url, - int64 length) { + int64_t length) { base::File::Info file_info; base::FilePath local_path; base::File::Error error = @@ -472,7 +475,7 @@ base::File::Error ObfuscatedFileUtil::Truncate( if (error != base::File::FILE_OK) return error; - int64 growth = length - file_info.size; + int64_t growth = length - file_info.size; if (!AllocateQuota(context, growth)) return base::File::FILE_ERROR_NO_SPACE; error = NativeFileUtil::Truncate(local_path, length); @@ -544,7 +547,7 @@ base::File::Error ObfuscatedFileUtil::CopyOrMoveFile( VirtualPath::BaseName(dest_url.path()).value(); } - int64 growth = 0; + int64_t growth = 0; if (copy) growth += src_platform_file_info.size; else @@ -667,7 +670,7 @@ base::File::Error ObfuscatedFileUtil::CopyInForeignFile( VirtualPath::BaseName(dest_url.path()).value()); } - int64 growth = src_platform_file_info.size; + int64_t growth = src_platform_file_info.size; if (overwrite) growth -= dest_platform_file_info.size; else @@ -727,7 +730,8 @@ base::File::Error ObfuscatedFileUtil::DeleteFile( if (file_info.is_directory()) return base::File::FILE_ERROR_NOT_A_FILE; - int64 growth = -UsageForPath(file_info.name.size()) - platform_file_info.size; + int64_t growth = + -UsageForPath(file_info.name.size()) - platform_file_info.size; AllocateQuota(context, growth); if (!db->RemoveFileInfo(file_id)) { NOTREACHED(); @@ -767,7 +771,7 @@ base::File::Error ObfuscatedFileUtil::DeleteDirectory( return base::File::FILE_ERROR_NOT_A_DIRECTORY; if (!db->RemoveFileInfo(file_id)) return base::File::FILE_ERROR_NOT_EMPTY; - int64 growth = -UsageForPath(file_info.name.size()); + int64_t growth = -UsageForPath(file_info.name.size()); AllocateQuota(context, growth); UpdateUsage(context, url, growth); TouchDirectory(db, file_info.parent_id); @@ -940,7 +944,7 @@ void ObfuscatedFileUtil::DestroyDirectoryDatabase( } // static -int64 ObfuscatedFileUtil::ComputeFilePathCost(const base::FilePath& path) { +int64_t ObfuscatedFileUtil::ComputeFilePathCost(const base::FilePath& path) { return UsageForPath(VirtualPath::BaseName(path).value().size()); } @@ -1314,7 +1318,7 @@ base::File::Error ObfuscatedFileUtil::GenerateNewLocalPath( base::FilePath* root, base::FilePath* local_path) { DCHECK(local_path); - int64 number; + int64_t number; if (!db || !db->GetNextInteger(&number)) return base::File::FILE_ERROR_FAILED; @@ -1324,7 +1328,7 @@ base::File::Error ObfuscatedFileUtil::GenerateNewLocalPath( return error; // We use the third- and fourth-to-last digits as the directory. - int64 directory_number = number % 10000 / 100; + int64_t directory_number = number % 10000 / 100; base::FilePath new_local_path = root->AppendASCII( base::StringPrintf("%02" PRId64, directory_number)); @@ -1361,7 +1365,7 @@ base::File ObfuscatedFileUtil::CreateOrOpenInternal( InitFileInfo(&file_info, parent_id, VirtualPath::BaseName(url.path()).value()); - int64 growth = UsageForPath(file_info.name.size()); + int64_t growth = UsageForPath(file_info.name.size()); if (!AllocateQuota(context, growth)) return base::File(base::File::FILE_ERROR_NO_SPACE); base::File file = CreateAndOpenFile(context, url, &file_info, file_flags); @@ -1386,7 +1390,7 @@ base::File ObfuscatedFileUtil::CreateOrOpenInternal( if (file_info.is_directory()) return base::File(base::File::FILE_ERROR_NOT_A_FILE); - int64 delta = 0; + int64_t delta = 0; if (file_flags & (base::File::FLAG_CREATE_ALWAYS | base::File::FLAG_OPEN_TRUNCATED)) { // The file exists and we're truncating. diff --git a/storage/browser/fileapi/obfuscated_file_util.h b/storage/browser/fileapi/obfuscated_file_util.h index 5b71e2d..e530ddb 100644 --- a/storage/browser/fileapi/obfuscated_file_util.h +++ b/storage/browser/fileapi/obfuscated_file_util.h @@ -5,6 +5,8 @@ #ifndef STORAGE_BROWSER_FILEAPI_OBFUSCATED_FILE_UTIL_H_ #define STORAGE_BROWSER_FILEAPI_OBFUSCATED_FILE_UTIL_H_ +#include <stdint.h> + #include <map> #include <set> #include <string> @@ -14,6 +16,7 @@ #include "base/files/file.h" #include "base/files/file_path.h" #include "base/files/file_util_proxy.h" +#include "base/macros.h" #include "base/memory/scoped_ptr.h" #include "storage/browser/blob/shareable_file_reference.h" #include "storage/browser/fileapi/file_system_file_util.h" @@ -135,7 +138,7 @@ class STORAGE_EXPORT ObfuscatedFileUtil : public FileSystemFileUtil { const base::Time& last_modified_time) override; base::File::Error Truncate(FileSystemOperationContext* context, const FileSystemURL& url, - int64 length) override; + int64_t length) override; base::File::Error CopyOrMoveFile(FileSystemOperationContext* context, const FileSystemURL& src_url, const FileSystemURL& dest_url, @@ -207,7 +210,7 @@ class STORAGE_EXPORT ObfuscatedFileUtil : public FileSystemFileUtil { // this ignores all but the BaseName of the supplied path. In order to // compute the cost of adding a multi-segment directory recursively, call this // on each path segment and add the results. - static int64 ComputeFilePathCost(const base::FilePath& path); + static int64_t ComputeFilePathCost(const base::FilePath& path); // Tries to prepopulate directory database for the given type strings. // This tries from the first one in the given type_strings and stops @@ -332,7 +335,7 @@ class STORAGE_EXPORT ObfuscatedFileUtil : public FileSystemFileUtil { leveldb::Env* env_override_; // Used to delete database after a certain period of inactivity. - int64 db_flush_delay_seconds_; + int64_t db_flush_delay_seconds_; scoped_refptr<base::SequencedTaskRunner> file_task_runner_; scoped_ptr<TimedTaskHelper> timer_; diff --git a/storage/browser/fileapi/plugin_private_file_system_backend.cc b/storage/browser/fileapi/plugin_private_file_system_backend.cc index d298f04..f1a1beb 100644 --- a/storage/browser/fileapi/plugin_private_file_system_backend.cc +++ b/storage/browser/fileapi/plugin_private_file_system_backend.cc @@ -4,6 +4,8 @@ #include "storage/browser/fileapi/plugin_private_file_system_backend.h" +#include <stdint.h> + #include <map> #include "base/stl_util.h" @@ -196,8 +198,8 @@ bool PluginPrivateFileSystemBackend::HasInplaceCopyImplementation( scoped_ptr<storage::FileStreamReader> PluginPrivateFileSystemBackend::CreateFileStreamReader( const FileSystemURL& url, - int64 offset, - int64 max_bytes_to_read, + int64_t offset, + int64_t max_bytes_to_read, const base::Time& expected_modification_time, FileSystemContext* context) const { return scoped_ptr<storage::FileStreamReader>(); @@ -206,7 +208,7 @@ PluginPrivateFileSystemBackend::CreateFileStreamReader( scoped_ptr<FileStreamWriter> PluginPrivateFileSystemBackend::CreateFileStreamWriter( const FileSystemURL& url, - int64 offset, + int64_t offset, FileSystemContext* context) const { return scoped_ptr<FileStreamWriter>(); } @@ -257,7 +259,7 @@ void PluginPrivateFileSystemBackend::GetOriginsForHostOnFileTaskRunner( } } -int64 PluginPrivateFileSystemBackend::GetOriginUsageOnFileTaskRunner( +int64_t PluginPrivateFileSystemBackend::GetOriginUsageOnFileTaskRunner( FileSystemContext* context, const GURL& origin_url, FileSystemType type) { diff --git a/storage/browser/fileapi/plugin_private_file_system_backend.h b/storage/browser/fileapi/plugin_private_file_system_backend.h index 72599fa..d2b17fd 100644 --- a/storage/browser/fileapi/plugin_private_file_system_backend.h +++ b/storage/browser/fileapi/plugin_private_file_system_backend.h @@ -5,9 +5,12 @@ #ifndef STORAGE_BROWSER_FILEAPI_PLUGIN_PRIVATE_FILE_SYSTEM_BACKEND_H_ #define STORAGE_BROWSER_FILEAPI_PLUGIN_PRIVATE_FILE_SYSTEM_BACKEND_H_ +#include <stdint.h> + #include <set> #include <string> +#include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/memory/weak_ptr.h" #include "storage/browser/fileapi/file_system_backend.h" @@ -80,13 +83,13 @@ class STORAGE_EXPORT PluginPrivateFileSystemBackend storage::FileSystemType type) const override; scoped_ptr<storage::FileStreamReader> CreateFileStreamReader( const FileSystemURL& url, - int64 offset, - int64 max_bytes_to_read, + int64_t offset, + int64_t max_bytes_to_read, const base::Time& expected_modification_time, FileSystemContext* context) const override; scoped_ptr<FileStreamWriter> CreateFileStreamWriter( const FileSystemURL& url, - int64 offset, + int64_t offset, FileSystemContext* context) const override; FileSystemQuotaUtil* GetQuotaUtil() override; const UpdateObserverList* GetUpdateObservers( @@ -107,9 +110,9 @@ class STORAGE_EXPORT PluginPrivateFileSystemBackend void GetOriginsForHostOnFileTaskRunner(FileSystemType type, const std::string& host, std::set<GURL>* origins) override; - int64 GetOriginUsageOnFileTaskRunner(FileSystemContext* context, - const GURL& origin_url, - FileSystemType type) override; + int64_t GetOriginUsageOnFileTaskRunner(FileSystemContext* context, + const GURL& origin_url, + FileSystemType type) override; scoped_refptr<QuotaReservation> CreateQuotaReservationOnFileTaskRunner( const GURL& origin_url, FileSystemType type) override; diff --git a/storage/browser/fileapi/quota/open_file_handle.cc b/storage/browser/fileapi/quota/open_file_handle.cc index 8842438..3c4f01d 100644 --- a/storage/browser/fileapi/quota/open_file_handle.cc +++ b/storage/browser/fileapi/quota/open_file_handle.cc @@ -4,6 +4,8 @@ #include "storage/browser/fileapi/quota/open_file_handle.h" +#include <stdint.h> + #include "storage/browser/fileapi/quota/open_file_handle_context.h" #include "storage/browser/fileapi/quota/quota_reservation.h" @@ -13,15 +15,15 @@ OpenFileHandle::~OpenFileHandle() { DCHECK(sequence_checker_.CalledOnValidSequencedThread()); } -void OpenFileHandle::UpdateMaxWrittenOffset(int64 offset) { +void OpenFileHandle::UpdateMaxWrittenOffset(int64_t offset) { DCHECK(sequence_checker_.CalledOnValidSequencedThread()); - int64 growth = context_->UpdateMaxWrittenOffset(offset); + int64_t growth = context_->UpdateMaxWrittenOffset(offset); if (growth > 0) reservation_->ConsumeReservation(growth); } -void OpenFileHandle::AddAppendModeWriteAmount(int64 amount) { +void OpenFileHandle::AddAppendModeWriteAmount(int64_t amount) { DCHECK(sequence_checker_.CalledOnValidSequencedThread()); if (amount <= 0) return; @@ -30,12 +32,12 @@ void OpenFileHandle::AddAppendModeWriteAmount(int64 amount) { reservation_->ConsumeReservation(amount); } -int64 OpenFileHandle::GetEstimatedFileSize() const { +int64_t OpenFileHandle::GetEstimatedFileSize() const { DCHECK(sequence_checker_.CalledOnValidSequencedThread()); return context_->GetEstimatedFileSize(); } -int64 OpenFileHandle::GetMaxWrittenOffset() const { +int64_t OpenFileHandle::GetMaxWrittenOffset() const { DCHECK(sequence_checker_.CalledOnValidSequencedThread()); return context_->GetMaxWrittenOffset(); } diff --git a/storage/browser/fileapi/quota/open_file_handle.h b/storage/browser/fileapi/quota/open_file_handle.h index 8954b1d..a48d29b 100644 --- a/storage/browser/fileapi/quota/open_file_handle.h +++ b/storage/browser/fileapi/quota/open_file_handle.h @@ -5,7 +5,9 @@ #ifndef STORAGE_BROWSER_FILEAPI_QUOTA_OPEN_FILE_HANDLE_H_ #define STORAGE_BROWSER_FILEAPI_QUOTA_OPEN_FILE_HANDLE_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 "storage/browser/storage_browser_export.h" @@ -31,14 +33,14 @@ class STORAGE_EXPORT OpenFileHandle { // Both this and AddAppendModeWriteAmount should be called for each modified // file before calling QuotaReservation::RefreshQuota and before closing the // file. - void UpdateMaxWrittenOffset(int64 offset); + void UpdateMaxWrittenOffset(int64_t offset); // Notifies that |amount| of data is written to the file in append mode, and // consumes quota for that. // Both this and UpdateMaxWrittenOffset should be called for each modified // file before calling QuotaReservation::RefreshQuota and before closing the // file. - void AddAppendModeWriteAmount(int64 amount); + void AddAppendModeWriteAmount(int64_t amount); // Returns the estimated file size for the quota consumption calculation. // The client must consume its reserved quota when it writes data to the file @@ -46,9 +48,9 @@ class STORAGE_EXPORT OpenFileHandle { // The estimated file size is greater than or equal to actual file size after // all clients report their file usage, and is monotonically increasing over // OpenFileHandle object life cycle, so that client may cache the value. - int64 GetEstimatedFileSize() const; + int64_t GetEstimatedFileSize() const; - int64 GetMaxWrittenOffset() const; + int64_t GetMaxWrittenOffset() const; const base::FilePath& platform_path() const; private: diff --git a/storage/browser/fileapi/quota/open_file_handle_context.cc b/storage/browser/fileapi/quota/open_file_handle_context.cc index a775865..1feabce 100644 --- a/storage/browser/fileapi/quota/open_file_handle_context.cc +++ b/storage/browser/fileapi/quota/open_file_handle_context.cc @@ -4,6 +4,8 @@ #include "storage/browser/fileapi/quota/open_file_handle_context.h" +#include <stdint.h> + #include "base/files/file_util.h" #include "storage/browser/fileapi/quota/quota_reservation_buffer.h" @@ -23,27 +25,27 @@ OpenFileHandleContext::OpenFileHandleContext( maximum_written_offset_ = initial_file_size_; } -int64 OpenFileHandleContext::UpdateMaxWrittenOffset(int64 offset) { +int64_t OpenFileHandleContext::UpdateMaxWrittenOffset(int64_t offset) { DCHECK(sequence_checker_.CalledOnValidSequencedThread()); if (offset <= maximum_written_offset_) return 0; - int64 growth = offset - maximum_written_offset_; + int64_t growth = offset - maximum_written_offset_; maximum_written_offset_ = offset; return growth; } -void OpenFileHandleContext::AddAppendModeWriteAmount(int64 amount) { +void OpenFileHandleContext::AddAppendModeWriteAmount(int64_t amount) { DCHECK(sequence_checker_.CalledOnValidSequencedThread()); append_mode_write_amount_ += amount; } -int64 OpenFileHandleContext::GetEstimatedFileSize() const { +int64_t OpenFileHandleContext::GetEstimatedFileSize() const { DCHECK(sequence_checker_.CalledOnValidSequencedThread()); return maximum_written_offset_ + append_mode_write_amount_; } -int64 OpenFileHandleContext::GetMaxWrittenOffset() const { +int64_t OpenFileHandleContext::GetMaxWrittenOffset() const { DCHECK(sequence_checker_.CalledOnValidSequencedThread()); return maximum_written_offset_; } @@ -53,15 +55,15 @@ OpenFileHandleContext::~OpenFileHandleContext() { // TODO(tzik): Optimize this for single operation. - int64 file_size = 0; + int64_t file_size = 0; base::GetFileSize(platform_path_, &file_size); - int64 usage_delta = file_size - initial_file_size_; + int64_t usage_delta = file_size - initial_file_size_; // |reserved_quota_consumption| may be greater than the recorded file growth // when a plugin crashed before reporting its consumption. // In this case, the reserved quota for the plugin should be handled as // consumed quota. - int64 reserved_quota_consumption = + int64_t reserved_quota_consumption = std::max(GetEstimatedFileSize(), file_size) - initial_file_size_; reservation_buffer_->CommitFileGrowth( diff --git a/storage/browser/fileapi/quota/open_file_handle_context.h b/storage/browser/fileapi/quota/open_file_handle_context.h index cb37064..ca1570c 100644 --- a/storage/browser/fileapi/quota/open_file_handle_context.h +++ b/storage/browser/fileapi/quota/open_file_handle_context.h @@ -5,10 +5,12 @@ #ifndef STORAGE_BROWSER_FILEAPI_OPEN_FILE_HANDLE_CONTEXT_H_ #define STORAGE_BROWSER_FILEAPI_OPEN_FILE_HANDLE_CONTEXT_H_ +#include <stdint.h> + #include <map> -#include "base/basictypes.h" #include "base/files/file_path.h" +#include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/memory/weak_ptr.h" #include "storage/browser/storage_browser_export.h" @@ -29,24 +31,24 @@ class OpenFileHandleContext : public base::RefCounted<OpenFileHandleContext> { QuotaReservationBuffer* reservation_buffer); // Updates the max written offset and returns the amount of growth. - int64 UpdateMaxWrittenOffset(int64 offset); + int64_t UpdateMaxWrittenOffset(int64_t offset); - void AddAppendModeWriteAmount(int64 amount); + void AddAppendModeWriteAmount(int64_t amount); const base::FilePath& platform_path() const { return platform_path_; } - int64 GetEstimatedFileSize() const; - int64 GetMaxWrittenOffset() const; + int64_t GetEstimatedFileSize() const; + int64_t GetMaxWrittenOffset() const; private: friend class base::RefCounted<OpenFileHandleContext>; virtual ~OpenFileHandleContext(); - int64 initial_file_size_; - int64 maximum_written_offset_; - int64 append_mode_write_amount_; + int64_t initial_file_size_; + int64_t maximum_written_offset_; + int64_t append_mode_write_amount_; base::FilePath platform_path_; scoped_refptr<QuotaReservationBuffer> reservation_buffer_; diff --git a/storage/browser/fileapi/quota/quota_backend_impl.cc b/storage/browser/fileapi/quota/quota_backend_impl.cc index 6969f7f..4ec600f 100644 --- a/storage/browser/fileapi/quota/quota_backend_impl.cc +++ b/storage/browser/fileapi/quota/quota_backend_impl.cc @@ -4,6 +4,8 @@ #include "storage/browser/fileapi/quota/quota_backend_impl.h" +#include <stdint.h> + #include <string> #include "base/bind.h" @@ -35,7 +37,7 @@ QuotaBackendImpl::~QuotaBackendImpl() { void QuotaBackendImpl::ReserveQuota(const GURL& origin, FileSystemType type, - int64 delta, + int64_t delta, const ReserveQuotaCallback& callback) { DCHECK(file_task_runner_->RunsTasksOnCurrentThread()); DCHECK(origin.is_valid()); @@ -56,7 +58,7 @@ void QuotaBackendImpl::ReserveQuota(const GURL& origin, void QuotaBackendImpl::ReleaseReservedQuota(const GURL& origin, FileSystemType type, - int64 size) { + int64_t size) { DCHECK(file_task_runner_->RunsTasksOnCurrentThread()); DCHECK(origin.is_valid()); DCHECK_LE(0, size); @@ -67,7 +69,7 @@ void QuotaBackendImpl::ReleaseReservedQuota(const GURL& origin, void QuotaBackendImpl::CommitQuotaUsage(const GURL& origin, FileSystemType type, - int64 delta) { + int64_t delta) { DCHECK(file_task_runner_->RunsTasksOnCurrentThread()); DCHECK(origin.is_valid()); if (!delta) @@ -106,8 +108,8 @@ void QuotaBackendImpl::DidGetUsageAndQuotaForReserveQuota( const QuotaReservationInfo& info, const ReserveQuotaCallback& callback, storage::QuotaStatusCode status, - int64 usage, - int64 quota) { + int64_t usage, + int64_t quota) { DCHECK(file_task_runner_->RunsTasksOnCurrentThread()); DCHECK(info.origin.is_valid()); DCHECK_LE(0, usage); @@ -119,11 +121,12 @@ void QuotaBackendImpl::DidGetUsageAndQuotaForReserveQuota( QuotaReservationInfo normalized_info = info; if (info.delta > 0) { - int64 new_usage = - base::saturated_cast<int64>(usage + static_cast<uint64>(info.delta)); + int64_t new_usage = base::saturated_cast<int64_t>( + usage + static_cast<uint64_t>(info.delta)); if (quota < new_usage) new_usage = quota; - normalized_info.delta = std::max(static_cast<int64>(0), new_usage - usage); + normalized_info.delta = + std::max(static_cast<int64_t>(0), new_usage - usage); } ReserveQuotaInternal(normalized_info); @@ -162,9 +165,10 @@ base::File::Error QuotaBackendImpl::GetUsageCachePath( } QuotaBackendImpl::QuotaReservationInfo::QuotaReservationInfo( - const GURL& origin, FileSystemType type, int64 delta) - : origin(origin), type(type), delta(delta) { -} + const GURL& origin, + FileSystemType type, + int64_t delta) + : origin(origin), type(type), delta(delta) {} QuotaBackendImpl::QuotaReservationInfo::~QuotaReservationInfo() { } diff --git a/storage/browser/fileapi/quota/quota_backend_impl.h b/storage/browser/fileapi/quota/quota_backend_impl.h index 7e4092d..66c6974 100644 --- a/storage/browser/fileapi/quota/quota_backend_impl.h +++ b/storage/browser/fileapi/quota/quota_backend_impl.h @@ -5,6 +5,9 @@ #ifndef STORAGE_BROWSER_FILEAPI_QUOTA_QUOTA_BACKEND_IMPL_H_ #define STORAGE_BROWSER_FILEAPI_QUOTA_QUOTA_BACKEND_IMPL_H_ +#include <stdint.h> + +#include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/memory/weak_ptr.h" #include "storage/browser/fileapi/quota/quota_reservation_manager.h" @@ -45,14 +48,14 @@ class STORAGE_EXPORT QuotaBackendImpl // QuotaReservationManager::QuotaBackend overrides. void ReserveQuota(const GURL& origin, FileSystemType type, - int64 delta, + int64_t delta, const ReserveQuotaCallback& callback) override; void ReleaseReservedQuota(const GURL& origin, FileSystemType type, - int64 size) override; + int64_t size) override; void CommitQuotaUsage(const GURL& origin, FileSystemType type, - int64 delta) override; + int64_t delta) override; void IncrementDirtyCount(const GURL& origin, FileSystemType type) override; void DecrementDirtyCount(const GURL& origin, FileSystemType type) override; @@ -60,19 +63,21 @@ class STORAGE_EXPORT QuotaBackendImpl friend class content::QuotaBackendImplTest; struct QuotaReservationInfo { - QuotaReservationInfo(const GURL& origin, FileSystemType type, int64 delta); + QuotaReservationInfo(const GURL& origin, + FileSystemType type, + int64_t delta); ~QuotaReservationInfo(); GURL origin; FileSystemType type; - int64 delta; + int64_t delta; }; void DidGetUsageAndQuotaForReserveQuota(const QuotaReservationInfo& info, const ReserveQuotaCallback& callback, storage::QuotaStatusCode status, - int64 usage, - int64 quota); + int64_t usage, + int64_t quota); void ReserveQuotaInternal( const QuotaReservationInfo& info); diff --git a/storage/browser/fileapi/quota/quota_reservation.cc b/storage/browser/fileapi/quota/quota_reservation.cc index fff7f16..f15e35e8 100644 --- a/storage/browser/fileapi/quota/quota_reservation.cc +++ b/storage/browser/fileapi/quota/quota_reservation.cc @@ -4,15 +4,16 @@ #include "storage/browser/fileapi/quota/quota_reservation.h" +#include <stdint.h> + #include "base/bind.h" #include "storage/browser/fileapi/quota/open_file_handle.h" #include "storage/browser/fileapi/quota/quota_reservation_buffer.h" namespace storage { -void QuotaReservation::RefreshReservation( - int64 size, - const StatusCallback& callback) { +void QuotaReservation::RefreshReservation(int64_t size, + const StatusCallback& callback) { DCHECK(sequence_checker_.CalledOnValidSequencedThread()); DCHECK(!running_refresh_request_); DCHECK(!client_crashed_); @@ -48,7 +49,7 @@ void QuotaReservation::OnClientCrash() { } } -void QuotaReservation::ConsumeReservation(int64 size) { +void QuotaReservation::ConsumeReservation(int64_t size) { DCHECK(sequence_checker_.CalledOnValidSequencedThread()); DCHECK_LT(0, size); DCHECK_LE(size, remaining_quota_); @@ -93,10 +94,10 @@ QuotaReservation::~QuotaReservation() { // static bool QuotaReservation::AdaptDidUpdateReservedQuota( const base::WeakPtr<QuotaReservation>& reservation, - int64 previous_size, + int64_t previous_size, const StatusCallback& callback, base::File::Error error, - int64 delta) { + int64_t delta) { if (!reservation) return false; @@ -104,11 +105,10 @@ bool QuotaReservation::AdaptDidUpdateReservedQuota( previous_size, callback, error, delta); } -bool QuotaReservation::DidUpdateReservedQuota( - int64 previous_size, - const StatusCallback& callback, - base::File::Error error, - int64 delta) { +bool QuotaReservation::DidUpdateReservedQuota(int64_t previous_size, + const StatusCallback& callback, + base::File::Error error, + int64_t delta) { DCHECK(sequence_checker_.CalledOnValidSequencedThread()); DCHECK(running_refresh_request_); running_refresh_request_ = false; diff --git a/storage/browser/fileapi/quota/quota_reservation.h b/storage/browser/fileapi/quota/quota_reservation.h index be35b9e..0915114 100644 --- a/storage/browser/fileapi/quota/quota_reservation.h +++ b/storage/browser/fileapi/quota/quota_reservation.h @@ -5,9 +5,11 @@ #ifndef STORAGE_BROWSER_FILEAPI_QUOTA_QUOTA_RESERVATION_H_ #define STORAGE_BROWSER_FILEAPI_QUOTA_QUOTA_RESERVATION_H_ -#include "base/basictypes.h" +#include <stdint.h> + #include "base/files/file.h" #include "base/files/file_path.h" +#include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/memory/weak_ptr.h" #include "storage/browser/fileapi/quota/quota_reservation_manager.h" @@ -32,7 +34,7 @@ class STORAGE_EXPORT QuotaReservation // space is enough. |remaining_quota_| may be less than |size| if there is // not enough space available. // Invokes |callback| upon completion. - void RefreshReservation(int64 size, const StatusCallback& callback); + void RefreshReservation(int64_t size, const StatusCallback& callback); // Associates |platform_path| to the QuotaReservation instance. // Returns an OpenFileHandle instance that represents a quota managed file. @@ -49,10 +51,10 @@ class STORAGE_EXPORT QuotaReservation // Consumes |size| of reserved quota for a associated file. // Consumed quota is sent to associated QuotaReservationBuffer for staging. - void ConsumeReservation(int64 size); + void ConsumeReservation(int64_t size); // Returns amount of unused reserved quota. - int64 remaining_quota() const { return remaining_quota_; } + int64_t remaining_quota() const { return remaining_quota_; } QuotaReservationManager* reservation_manager(); const GURL& origin() const; @@ -69,18 +71,18 @@ class STORAGE_EXPORT QuotaReservation static bool AdaptDidUpdateReservedQuota( const base::WeakPtr<QuotaReservation>& reservation, - int64 previous_size, + int64_t previous_size, const StatusCallback& callback, base::File::Error error, - int64 delta); - bool DidUpdateReservedQuota(int64 previous_size, + int64_t delta); + bool DidUpdateReservedQuota(int64_t previous_size, const StatusCallback& callback, base::File::Error error, - int64 delta); + int64_t delta); bool client_crashed_; bool running_refresh_request_; - int64 remaining_quota_; + int64_t remaining_quota_; scoped_refptr<QuotaReservationBuffer> reservation_buffer_; diff --git a/storage/browser/fileapi/quota/quota_reservation_buffer.cc b/storage/browser/fileapi/quota/quota_reservation_buffer.cc index faa70eb..38b5a2a 100644 --- a/storage/browser/fileapi/quota/quota_reservation_buffer.cc +++ b/storage/browser/fileapi/quota/quota_reservation_buffer.cc @@ -4,6 +4,8 @@ #include "storage/browser/fileapi/quota/quota_reservation_buffer.h" +#include <stdint.h> + #include "base/bind.h" #include "storage/browser/fileapi/quota/open_file_handle.h" #include "storage/browser/fileapi/quota/open_file_handle_context.h" @@ -39,8 +41,9 @@ scoped_ptr<OpenFileHandle> QuotaReservationBuffer::GetOpenFileHandle( return make_scoped_ptr(new OpenFileHandle(reservation, *open_file)); } -void QuotaReservationBuffer::CommitFileGrowth(int64 reserved_quota_consumption, - int64 usage_delta) { +void QuotaReservationBuffer::CommitFileGrowth( + int64_t reserved_quota_consumption, + int64_t usage_delta) { DCHECK(sequence_checker_.CalledOnValidSequencedThread()); if (!reservation_manager_) return; @@ -66,7 +69,7 @@ void QuotaReservationBuffer::DetachOpenFileHandleContext( open_files_.erase(open_file->platform_path()); } -void QuotaReservationBuffer::PutReservationToBuffer(int64 reservation) { +void QuotaReservationBuffer::PutReservationToBuffer(int64_t reservation) { DCHECK(sequence_checker_.CalledOnValidSequencedThread()); DCHECK_LE(0, reservation); reserved_quota_ += reservation; @@ -93,7 +96,7 @@ bool QuotaReservationBuffer::DecrementDirtyCount( const GURL& origin, FileSystemType type, base::File::Error error, - int64 delta_unused) { + int64_t delta_unused) { DCHECK(origin.is_valid()); if (error == base::File::FILE_OK && reservation_manager) { reservation_manager->DecrementDirtyCount(origin, type); diff --git a/storage/browser/fileapi/quota/quota_reservation_buffer.h b/storage/browser/fileapi/quota/quota_reservation_buffer.h index 0e893b6..08031ca 100644 --- a/storage/browser/fileapi/quota/quota_reservation_buffer.h +++ b/storage/browser/fileapi/quota/quota_reservation_buffer.h @@ -5,11 +5,13 @@ #ifndef STORAGE_BROWSER_FILEAPI_QUOTA_QUOTA_RESERVATION_BUFFER_H_ #define STORAGE_BROWSER_FILEAPI_QUOTA_QUOTA_RESERVATION_BUFFER_H_ +#include <stdint.h> + #include <map> -#include "base/basictypes.h" #include "base/files/file.h" #include "base/files/file_path.h" +#include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/memory/weak_ptr.h" #include "storage/browser/storage_browser_export.h" @@ -41,9 +43,9 @@ class QuotaReservationBuffer : public base::RefCounted<QuotaReservationBuffer> { scoped_ptr<OpenFileHandle> GetOpenFileHandle( QuotaReservation* reservation, const base::FilePath& platform_path); - void CommitFileGrowth(int64 quota_consumption, int64 usage_delta); + void CommitFileGrowth(int64_t quota_consumption, int64_t usage_delta); void DetachOpenFileHandleContext(OpenFileHandleContext* context); - void PutReservationToBuffer(int64 size); + void PutReservationToBuffer(int64_t size); QuotaReservationManager* reservation_manager() { return reservation_manager_.get(); @@ -61,7 +63,7 @@ class QuotaReservationBuffer : public base::RefCounted<QuotaReservationBuffer> { const GURL& origin, FileSystemType type, base::File::Error error, - int64 delta); + int64_t delta); typedef std::map<base::FilePath, OpenFileHandleContext*> OpenFileHandleContextByPath; @@ -75,7 +77,7 @@ class QuotaReservationBuffer : public base::RefCounted<QuotaReservationBuffer> { GURL origin_; storage::FileSystemType type_; - int64 reserved_quota_; + int64_t reserved_quota_; base::SequenceChecker sequence_checker_; diff --git a/storage/browser/fileapi/quota/quota_reservation_manager.cc b/storage/browser/fileapi/quota/quota_reservation_manager.cc index b5ee5d8..6b69191 100644 --- a/storage/browser/fileapi/quota/quota_reservation_manager.cc +++ b/storage/browser/fileapi/quota/quota_reservation_manager.cc @@ -4,6 +4,8 @@ #include "storage/browser/fileapi/quota/quota_reservation_manager.h" +#include <stdint.h> + #include "storage/browser/fileapi/quota/quota_reservation.h" #include "storage/browser/fileapi/quota/quota_reservation_buffer.h" @@ -23,24 +25,22 @@ QuotaReservationManager::~QuotaReservationManager() { void QuotaReservationManager::ReserveQuota( const GURL& origin, FileSystemType type, - int64 size, + int64_t size, const ReserveQuotaCallback& callback) { DCHECK(origin.is_valid()); backend_->ReserveQuota(origin, type, size, callback); } -void QuotaReservationManager::ReleaseReservedQuota( - const GURL& origin, - FileSystemType type, - int64 size) { +void QuotaReservationManager::ReleaseReservedQuota(const GURL& origin, + FileSystemType type, + int64_t size) { DCHECK(origin.is_valid()); backend_->ReleaseReservedQuota(origin, type, size); } -void QuotaReservationManager::CommitQuotaUsage( - const GURL& origin, - FileSystemType type, - int64 delta) { +void QuotaReservationManager::CommitQuotaUsage(const GURL& origin, + FileSystemType type, + int64_t delta) { DCHECK(origin.is_valid()); backend_->CommitQuotaUsage(origin, type, delta); } diff --git a/storage/browser/fileapi/quota/quota_reservation_manager.h b/storage/browser/fileapi/quota/quota_reservation_manager.h index ec04245..3a32ec7 100644 --- a/storage/browser/fileapi/quota/quota_reservation_manager.h +++ b/storage/browser/fileapi/quota/quota_reservation_manager.h @@ -5,12 +5,14 @@ #ifndef STORAGE_BROWSER_FILEAPI_QUOTA_QUOTA_RESERVATION_MANAGER_H_ #define STORAGE_BROWSER_FILEAPI_QUOTA_QUOTA_RESERVATION_MANAGER_H_ +#include <stdint.h> + #include <map> #include <utility> -#include "base/basictypes.h" #include "base/callback_forward.h" #include "base/files/file.h" +#include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/memory/weak_ptr.h" #include "storage/browser/storage_browser_export.h" @@ -32,7 +34,7 @@ class STORAGE_EXPORT QuotaReservationManager { public: // Callback for ReserveQuota. When this callback returns false, ReserveQuota // operation should be reverted. - typedef base::Callback<bool(base::File::Error error, int64 delta)> + typedef base::Callback<bool(base::File::Error error, int64_t delta)> ReserveQuotaCallback; // An abstraction of backing quota system. @@ -49,19 +51,19 @@ class STORAGE_EXPORT QuotaReservationManager { // that case, the backend should roll back the reservation. virtual void ReserveQuota(const GURL& origin, FileSystemType type, - int64 delta, + int64_t delta, const ReserveQuotaCallback& callback) = 0; // Reclaims |size| of quota for |origin| and |type|. virtual void ReleaseReservedQuota(const GURL& origin, FileSystemType type, - int64 size) = 0; + int64_t size) = 0; // Updates disk usage of |origin| and |type|. // Invokes |callback| upon completion with an error code. virtual void CommitQuotaUsage(const GURL& origin, FileSystemType type, - int64 delta) = 0; + int64_t delta) = 0; virtual void IncrementDirtyCount(const GURL& origin, FileSystemType type) = 0; @@ -91,16 +93,14 @@ class STORAGE_EXPORT QuotaReservationManager { void ReserveQuota(const GURL& origin, FileSystemType type, - int64 delta, + int64_t delta, const ReserveQuotaCallback& callback); void ReleaseReservedQuota(const GURL& origin, FileSystemType type, - int64 size); + int64_t size); - void CommitQuotaUsage(const GURL& origin, - FileSystemType type, - int64 delta); + void CommitQuotaUsage(const GURL& origin, FileSystemType type, int64_t delta); void IncrementDirtyCount(const GURL& origin, FileSystemType type); void DecrementDirtyCount(const GURL& origin, FileSystemType type); diff --git a/storage/browser/fileapi/recursive_operation_delegate.cc b/storage/browser/fileapi/recursive_operation_delegate.cc index 10a4970..a1e13fe 100644 --- a/storage/browser/fileapi/recursive_operation_delegate.cc +++ b/storage/browser/fileapi/recursive_operation_delegate.cc @@ -4,6 +4,8 @@ #include "storage/browser/fileapi/recursive_operation_delegate.h" +#include <stddef.h> + #include "base/bind.h" #include "base/single_thread_task_runner.h" #include "base/thread_task_runner_handle.h" diff --git a/storage/browser/fileapi/recursive_operation_delegate.h b/storage/browser/fileapi/recursive_operation_delegate.h index 2ea09c3..0a3efbf 100644 --- a/storage/browser/fileapi/recursive_operation_delegate.h +++ b/storage/browser/fileapi/recursive_operation_delegate.h @@ -8,8 +8,8 @@ #include <queue> #include <stack> -#include "base/basictypes.h" #include "base/callback.h" +#include "base/macros.h" #include "base/memory/weak_ptr.h" #include "storage/browser/fileapi/file_system_operation.h" #include "storage/browser/fileapi/file_system_url.h" diff --git a/storage/browser/fileapi/remove_operation_delegate.h b/storage/browser/fileapi/remove_operation_delegate.h index 9625059..bf4733d 100644 --- a/storage/browser/fileapi/remove_operation_delegate.h +++ b/storage/browser/fileapi/remove_operation_delegate.h @@ -7,6 +7,7 @@ #include <stack> +#include "base/macros.h" #include "storage/browser/fileapi/recursive_operation_delegate.h" namespace storage { diff --git a/storage/browser/fileapi/sandbox_directory_database.cc b/storage/browser/fileapi/sandbox_directory_database.cc index 39f1d53..343f09f 100644 --- a/storage/browser/fileapi/sandbox_directory_database.cc +++ b/storage/browser/fileapi/sandbox_directory_database.cc @@ -5,6 +5,8 @@ #include "storage/browser/fileapi/sandbox_directory_database.h" #include <math.h> +#include <stddef.h> +#include <stdint.h> #include <algorithm> #include <set> #include <stack> @@ -12,6 +14,7 @@ #include "base/files/file_enumerator.h" #include "base/files/file_util.h" #include "base/location.h" +#include "base/macros.h" #include "base/metrics/histogram.h" #include "base/pickle.h" #include "base/strings/string_number_conversions.h" @@ -51,7 +54,7 @@ bool FileInfoFromPickle(const base::Pickle& pickle, base::PickleIterator iter(pickle); std::string data_path; std::string name; - int64 internal_time; + int64_t internal_time; if (iter.ReadInt64(&info->parent_id) && iter.ReadString(&data_path) && @@ -72,7 +75,7 @@ const char kChildLookupPrefix[] = "CHILD_OF:"; const char kChildLookupSeparator[] = ":"; const char kLastFileIdKey[] = "LAST_FILE_ID"; const char kLastIntegerKey[] = "LAST_INTEGER"; -const int64 kMinimumReportIntervalHours = 1; +const int64_t kMinimumReportIntervalHours = 1; const char kInitStatusHistogramLabel[] = "FileSystem.DirectoryDatabaseInit"; const char kDatabaseRepairHistogramLabel[] = "FileSystem.DirectoryDatabaseRepair"; @@ -198,7 +201,7 @@ bool DatabaseCheckHelper::IsDatabaseEmpty() { bool DatabaseCheckHelper::ScanDatabase() { // Scans all database entries sequentially to verify each of them has unique // backing file. - int64 max_file_id = -1; + int64_t max_file_id = -1; std::set<FileId> file_ids; scoped_ptr<leveldb::Iterator> itr(db_->NewIterator(leveldb::ReadOptions())); @@ -675,7 +678,7 @@ bool SandboxDirectoryDatabase::OverwritingMoveFile( return true; } -bool SandboxDirectoryDatabase::GetNextInteger(int64* next) { +bool SandboxDirectoryDatabase::GetNextInteger(int64_t* next) { if (!Init(REPAIR_ON_CORRUPTION)) return false; DCHECK(next); @@ -683,7 +686,7 @@ bool SandboxDirectoryDatabase::GetNextInteger(int64* next) { leveldb::Status status = db_->Get(leveldb::ReadOptions(), LastIntegerKey(), &int_string); if (status.ok()) { - int64 temp; + int64_t temp; if (!base::StringToInt64(int_string, &temp)) { LOG(ERROR) << "Hit database corruption!"; return false; diff --git a/storage/browser/fileapi/sandbox_directory_database.h b/storage/browser/fileapi/sandbox_directory_database.h index e765c5b..f63b684 100644 --- a/storage/browser/fileapi/sandbox_directory_database.h +++ b/storage/browser/fileapi/sandbox_directory_database.h @@ -5,11 +5,14 @@ #ifndef STORAGE_BROWSER_FILEAPI_SANDBOX_DIRECTORY_DATABASE_H_ #define STORAGE_BROWSER_FILEAPI_SANDBOX_DIRECTORY_DATABASE_H_ +#include <stdint.h> + #include <string> #include <vector> #include "base/files/file.h" #include "base/files/file_path.h" +#include "base/macros.h" #include "base/memory/scoped_ptr.h" #include "base/time/time.h" #include "storage/browser/storage_browser_export.h" @@ -42,7 +45,7 @@ namespace storage { // TODO(ericu): Add a method that will give a unique filename for a data file. class STORAGE_EXPORT SandboxDirectoryDatabase { public: - typedef int64 FileId; + typedef int64_t FileId; struct STORAGE_EXPORT FileInfo { FileInfo(); @@ -92,7 +95,7 @@ class STORAGE_EXPORT SandboxDirectoryDatabase { // This produces the series 0, 1, 2..., starting at 0 when the underlying // filesystem is first created, and maintaining state across // creation/destruction of SandboxDirectoryDatabase objects. - bool GetNextInteger(int64* next); + bool GetNextInteger(int64_t* next); bool IsDirectory(FileId file_id); diff --git a/storage/browser/fileapi/sandbox_file_stream_writer.cc b/storage/browser/fileapi/sandbox_file_stream_writer.cc index de950fe..09384ff 100644 --- a/storage/browser/fileapi/sandbox_file_stream_writer.cc +++ b/storage/browser/fileapi/sandbox_file_stream_writer.cc @@ -4,6 +4,8 @@ #include "storage/browser/fileapi/sandbox_file_stream_writer.h" +#include <stdint.h> + #include <limits> #include "base/files/file_util_proxy.h" diff --git a/storage/browser/fileapi/sandbox_file_system_backend.cc b/storage/browser/fileapi/sandbox_file_system_backend.cc index 7247b8e..c8b7f37 100644 --- a/storage/browser/fileapi/sandbox_file_system_backend.cc +++ b/storage/browser/fileapi/sandbox_file_system_backend.cc @@ -4,6 +4,8 @@ #include "storage/browser/fileapi/sandbox_file_system_backend.h" +#include <stdint.h> + #include "base/bind.h" #include "base/files/file_util.h" #include "base/logging.h" @@ -133,8 +135,8 @@ bool SandboxFileSystemBackend::HasInplaceCopyImplementation( scoped_ptr<storage::FileStreamReader> SandboxFileSystemBackend::CreateFileStreamReader( const FileSystemURL& url, - int64 offset, - int64 max_bytes_to_read, + int64_t offset, + int64_t max_bytes_to_read, const base::Time& expected_modification_time, FileSystemContext* context) const { DCHECK(CanHandleType(url.type())); @@ -146,7 +148,7 @@ SandboxFileSystemBackend::CreateFileStreamReader( scoped_ptr<storage::FileStreamWriter> SandboxFileSystemBackend::CreateFileStreamWriter( const FileSystemURL& url, - int64 offset, + int64_t offset, FileSystemContext* context) const { DCHECK(CanHandleType(url.type())); DCHECK(delegate_); diff --git a/storage/browser/fileapi/sandbox_file_system_backend.h b/storage/browser/fileapi/sandbox_file_system_backend.h index e187f9b..6ed885e 100644 --- a/storage/browser/fileapi/sandbox_file_system_backend.h +++ b/storage/browser/fileapi/sandbox_file_system_backend.h @@ -5,11 +5,14 @@ #ifndef STORAGE_BROWSER_FILEAPI_SANDBOX_FILE_SYSTEM_BACKEND_H_ #define STORAGE_BROWSER_FILEAPI_SANDBOX_FILE_SYSTEM_BACKEND_H_ +#include <stdint.h> + #include <set> #include <string> #include "base/compiler_specific.h" #include "base/files/file_path.h" +#include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" #include "storage/browser/fileapi/file_system_backend.h" @@ -51,13 +54,13 @@ class STORAGE_EXPORT SandboxFileSystemBackend storage::FileSystemType type) const override; scoped_ptr<storage::FileStreamReader> CreateFileStreamReader( const FileSystemURL& url, - int64 offset, - int64 max_bytes_to_read, + int64_t offset, + int64_t max_bytes_to_read, const base::Time& expected_modification_time, FileSystemContext* context) const override; scoped_ptr<FileStreamWriter> CreateFileStreamWriter( const FileSystemURL& url, - int64 offset, + int64_t offset, FileSystemContext* context) const override; FileSystemQuotaUtil* GetQuotaUtil() override; const UpdateObserverList* GetUpdateObservers( diff --git a/storage/browser/fileapi/sandbox_file_system_backend_delegate.cc b/storage/browser/fileapi/sandbox_file_system_backend_delegate.cc index cf06875b..a7f1d83 100644 --- a/storage/browser/fileapi/sandbox_file_system_backend_delegate.cc +++ b/storage/browser/fileapi/sandbox_file_system_backend_delegate.cc @@ -4,10 +4,14 @@ #include "storage/browser/fileapi/sandbox_file_system_backend_delegate.h" +#include <stddef.h> +#include <stdint.h> + #include <vector> #include "base/command_line.h" #include "base/files/file_util.h" +#include "base/macros.h" #include "base/metrics/histogram.h" #include "base/stl_util.h" #include "base/task_runner_util.h" @@ -39,7 +43,7 @@ const char kOpenFileSystemLabel[] = "FileSystem.OpenFileSystem"; const char kOpenFileSystemDetailLabel[] = "FileSystem.OpenFileSystemDetail"; const char kOpenFileSystemDetailNonThrottledLabel[] = "FileSystem.OpenFileSystemDetailNonthrottled"; -int64 kMinimumStatsCollectionIntervalHours = 1; +int64_t kMinimumStatsCollectionIntervalHours = 1; // For type directory names in ObfuscatedFileUtil. // TODO(kinuko,nhiroki): Each type string registration should be done @@ -296,7 +300,7 @@ SandboxFileSystemBackendDelegate::CreateFileSystemOperationContext( scoped_ptr<storage::FileStreamReader> SandboxFileSystemBackendDelegate::CreateFileStreamReader( const FileSystemURL& url, - int64 offset, + int64_t offset, const base::Time& expected_modification_time, FileSystemContext* context) const { if (!IsAccessValid(url)) @@ -309,7 +313,7 @@ SandboxFileSystemBackendDelegate::CreateFileStreamReader( scoped_ptr<FileStreamWriter> SandboxFileSystemBackendDelegate::CreateFileStreamWriter( const FileSystemURL& url, - int64 offset, + int64_t offset, FileSystemContext* context, FileSystemType type) const { if (!IsAccessValid(url)) @@ -327,8 +331,8 @@ SandboxFileSystemBackendDelegate::DeleteOriginDataOnFileTaskRunner( const GURL& origin_url, FileSystemType type) { DCHECK(file_task_runner_->RunsTasksOnCurrentThread()); - int64 usage = GetOriginUsageOnFileTaskRunner( - file_system_context, origin_url, type); + int64_t usage = + GetOriginUsageOnFileTaskRunner(file_system_context, origin_url, type); usage_cache()->CloseCacheFiles(); bool result = obfuscated_file_util()->DeleteDirectoryForOriginAndType( origin_url, GetTypeString(type)); @@ -380,7 +384,7 @@ void SandboxFileSystemBackendDelegate::GetOriginsForHostOnFileTaskRunner( } } -int64 SandboxFileSystemBackendDelegate::GetOriginUsageOnFileTaskRunner( +int64_t SandboxFileSystemBackendDelegate::GetOriginUsageOnFileTaskRunner( FileSystemContext* file_system_context, const GURL& origin_url, FileSystemType type) { @@ -399,21 +403,21 @@ int64 SandboxFileSystemBackendDelegate::GetOriginUsageOnFileTaskRunner( base_path.Append(FileSystemUsageCache::kUsageFileName); bool is_valid = usage_cache()->IsValid(usage_file_path); - uint32 dirty_status = 0; + uint32_t dirty_status = 0; bool dirty_status_available = usage_cache()->GetDirty(usage_file_path, &dirty_status); bool visited = !visited_origins_.insert(origin_url).second; if (is_valid && (dirty_status == 0 || (dirty_status_available && visited))) { // The usage cache is clean (dirty == 0) or the origin is already // initialized and running. Read the cache file to get the usage. - int64 usage = 0; + int64_t usage = 0; return usage_cache()->GetUsage(usage_file_path, &usage) ? usage : -1; } // The usage cache has not been initialized or the cache is dirty. // Get the directory size now and update the cache. usage_cache()->Delete(usage_file_path); - int64 usage = RecalculateUsage(file_system_context, origin_url, type); + int64_t usage = RecalculateUsage(file_system_context, origin_url, type); // This clears the dirty flag too. usage_cache()->UpdateUsage(usage_file_path, usage); @@ -589,7 +593,7 @@ SandboxFileSystemBackendDelegate::GetUsageCachePathForOriginAndType( return base_path.Append(FileSystemUsageCache::kUsageFileName); } -int64 SandboxFileSystemBackendDelegate::RecalculateUsage( +int64_t SandboxFileSystemBackendDelegate::RecalculateUsage( FileSystemContext* context, const GURL& origin, FileSystemType type) { @@ -601,7 +605,7 @@ int64 SandboxFileSystemBackendDelegate::RecalculateUsage( &operation_context, url, true)); base::FilePath file_path_each; - int64 usage = 0; + int64_t usage = 0; while (!(file_path_each = enumerator->Next()).empty()) { usage += enumerator->Size(); diff --git a/storage/browser/fileapi/sandbox_file_system_backend_delegate.h b/storage/browser/fileapi/sandbox_file_system_backend_delegate.h index f6b00cb..b5c731e 100644 --- a/storage/browser/fileapi/sandbox_file_system_backend_delegate.h +++ b/storage/browser/fileapi/sandbox_file_system_backend_delegate.h @@ -5,12 +5,15 @@ #ifndef STORAGE_BROWSER_FILEAPI_SANDBOX_FILE_SYSTEM_BACKEND_DELEGATE_H_ #define STORAGE_BROWSER_FILEAPI_SANDBOX_FILE_SYSTEM_BACKEND_DELEGATE_H_ +#include <stdint.h> + #include <map> #include <set> #include <string> #include <utility> #include "base/files/file_path.h" +#include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" #include "base/memory/weak_ptr.h" @@ -116,12 +119,12 @@ class STORAGE_EXPORT SandboxFileSystemBackendDelegate base::File::Error* error_code) const; scoped_ptr<storage::FileStreamReader> CreateFileStreamReader( const FileSystemURL& url, - int64 offset, + int64_t offset, const base::Time& expected_modification_time, FileSystemContext* context) const; scoped_ptr<FileStreamWriter> CreateFileStreamWriter( const FileSystemURL& url, - int64 offset, + int64_t offset, FileSystemContext* context, FileSystemType type) const; @@ -136,9 +139,9 @@ class STORAGE_EXPORT SandboxFileSystemBackendDelegate void GetOriginsForHostOnFileTaskRunner(FileSystemType type, const std::string& host, std::set<GURL>* origins) override; - int64 GetOriginUsageOnFileTaskRunner(FileSystemContext* context, - const GURL& origin_url, - FileSystemType type) override; + int64_t GetOriginUsageOnFileTaskRunner(FileSystemContext* context, + const GURL& origin_url, + FileSystemType type) override; scoped_refptr<QuotaReservation> CreateQuotaReservationOnFileTaskRunner( const GURL& origin_url, FileSystemType type) override; @@ -223,9 +226,9 @@ class STORAGE_EXPORT SandboxFileSystemBackendDelegate FileSystemType type, base::File::Error* error_out); - int64 RecalculateUsage(FileSystemContext* context, - const GURL& origin, - FileSystemType type); + int64_t RecalculateUsage(FileSystemContext* context, + const GURL& origin, + FileSystemType type); ObfuscatedFileUtil* obfuscated_file_util(); diff --git a/storage/browser/fileapi/sandbox_isolated_origin_database.h b/storage/browser/fileapi/sandbox_isolated_origin_database.h index f01b5c0..4dbcaac 100644 --- a/storage/browser/fileapi/sandbox_isolated_origin_database.h +++ b/storage/browser/fileapi/sandbox_isolated_origin_database.h @@ -8,6 +8,7 @@ #include <string> #include <vector> +#include "base/macros.h" #include "storage/browser/fileapi/sandbox_origin_database_interface.h" namespace storage { diff --git a/storage/browser/fileapi/sandbox_origin_database.cc b/storage/browser/fileapi/sandbox_origin_database.cc index 024e13e..85424a2 100644 --- a/storage/browser/fileapi/sandbox_origin_database.cc +++ b/storage/browser/fileapi/sandbox_origin_database.cc @@ -4,6 +4,8 @@ #include "storage/browser/fileapi/sandbox_origin_database.h" +#include <stdint.h> + #include <set> #include <utility> @@ -27,7 +29,7 @@ const base::FilePath::CharType kOriginDatabaseName[] = FILE_PATH_LITERAL("Origins"); const char kOriginKeyPrefix[] = "ORIGIN:"; const char kLastPathKey[] = "LAST_PATH"; -const int64 kMinimumReportIntervalHours = 1; +const int64_t kMinimumReportIntervalHours = 1; const char kInitStatusHistogramLabel[] = "FileSystem.OriginDatabaseInit"; const char kDatabaseRepairHistogramLabel[] = "FileSystem.OriginDatabaseRepair"; diff --git a/storage/browser/fileapi/sandbox_origin_database.h b/storage/browser/fileapi/sandbox_origin_database.h index 7d700a3..0562385 100644 --- a/storage/browser/fileapi/sandbox_origin_database.h +++ b/storage/browser/fileapi/sandbox_origin_database.h @@ -8,6 +8,7 @@ #include <string> #include <vector> +#include "base/macros.h" #include "base/memory/scoped_ptr.h" #include "base/time/time.h" #include "storage/browser/fileapi/sandbox_origin_database_interface.h" diff --git a/storage/browser/fileapi/sandbox_prioritized_origin_database.h b/storage/browser/fileapi/sandbox_prioritized_origin_database.h index 40be0c7..7843565 100644 --- a/storage/browser/fileapi/sandbox_prioritized_origin_database.h +++ b/storage/browser/fileapi/sandbox_prioritized_origin_database.h @@ -9,6 +9,7 @@ #include <vector> #include "base/files/file_path.h" +#include "base/macros.h" #include "base/memory/scoped_ptr.h" #include "storage/browser/fileapi/sandbox_origin_database_interface.h" diff --git a/storage/browser/fileapi/sandbox_quota_observer.cc b/storage/browser/fileapi/sandbox_quota_observer.cc index 07d0a05..0b96b87 100644 --- a/storage/browser/fileapi/sandbox_quota_observer.cc +++ b/storage/browser/fileapi/sandbox_quota_observer.cc @@ -4,6 +4,8 @@ #include "storage/browser/fileapi/sandbox_quota_observer.h" +#include <stdint.h> + #include "base/sequenced_task_runner.h" #include "storage/browser/fileapi/file_system_usage_cache.h" #include "storage/browser/fileapi/sandbox_file_system_backend_delegate.h" @@ -35,8 +37,7 @@ void SandboxQuotaObserver::OnStartUpdate(const FileSystemURL& url) { file_system_usage_cache_->IncrementDirty(usage_file_path); } -void SandboxQuotaObserver::OnUpdate(const FileSystemURL& url, - int64 delta) { +void SandboxQuotaObserver::OnUpdate(const FileSystemURL& url, int64_t delta) { DCHECK(update_notify_runner_->RunsTasksOnCurrentThread()); if (quota_manager_proxy_.get()) { @@ -130,7 +131,7 @@ void SandboxQuotaObserver::ApplyPendingUsageUpdate() { void SandboxQuotaObserver::UpdateUsageCacheFile( const base::FilePath& usage_file_path, - int64 delta) { + int64_t delta) { DCHECK(!usage_file_path.empty()); if (!usage_file_path.empty() && delta != 0) file_system_usage_cache_->AtomicUpdateUsageByDelta(usage_file_path, delta); diff --git a/storage/browser/fileapi/sandbox_quota_observer.h b/storage/browser/fileapi/sandbox_quota_observer.h index 64c153a..769c062 100644 --- a/storage/browser/fileapi/sandbox_quota_observer.h +++ b/storage/browser/fileapi/sandbox_quota_observer.h @@ -5,11 +5,13 @@ #ifndef STORAGE_BROWSER_FILEAPI_SANDBOX_QUOTA_OBSERVER_H_ #define STORAGE_BROWSER_FILEAPI_SANDBOX_QUOTA_OBSERVER_H_ +#include <stdint.h> + #include <map> -#include "base/basictypes.h" #include "base/compiler_specific.h" #include "base/files/file_path.h" +#include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" #include "base/memory/weak_ptr.h" @@ -35,7 +37,7 @@ class SandboxQuotaObserver : public FileUpdateObserver, public FileAccessObserver { public: - typedef std::map<base::FilePath, int64> PendingUpdateNotificationMap; + typedef std::map<base::FilePath, int64_t> PendingUpdateNotificationMap; SandboxQuotaObserver(storage::QuotaManagerProxy* quota_manager_proxy, base::SequencedTaskRunner* update_notify_runner, @@ -45,7 +47,7 @@ class SandboxQuotaObserver // FileUpdateObserver overrides. void OnStartUpdate(const FileSystemURL& url) override; - void OnUpdate(const FileSystemURL& url, int64 delta) override; + void OnUpdate(const FileSystemURL& url, int64_t delta) override; void OnEndUpdate(const FileSystemURL& url) override; // FileAccessObserver overrides. @@ -57,7 +59,8 @@ class SandboxQuotaObserver private: void ApplyPendingUsageUpdate(); - void UpdateUsageCacheFile(const base::FilePath& usage_file_path, int64 delta); + void UpdateUsageCacheFile(const base::FilePath& usage_file_path, + int64_t delta); base::FilePath GetUsageCachePath(const FileSystemURL& url); diff --git a/storage/browser/fileapi/task_runner_bound_observer_list.h b/storage/browser/fileapi/task_runner_bound_observer_list.h index baa584d..bbe91f7 100644 --- a/storage/browser/fileapi/task_runner_bound_observer_list.h +++ b/storage/browser/fileapi/task_runner_bound_observer_list.h @@ -7,7 +7,6 @@ #include <map> -#include "base/basictypes.h" #include "base/bind.h" #include "base/memory/ref_counted.h" #include "base/sequenced_task_runner.h" diff --git a/storage/browser/fileapi/timed_task_helper.h b/storage/browser/fileapi/timed_task_helper.h index 4663501..fb0d5f2 100644 --- a/storage/browser/fileapi/timed_task_helper.h +++ b/storage/browser/fileapi/timed_task_helper.h @@ -5,9 +5,9 @@ #ifndef STORAGE_BROWSER_FILEAPI_TIMED_TASK_HELPER_H_ #define STORAGE_BROWSER_FILEAPI_TIMED_TASK_HELPER_H_ -#include "base/basictypes.h" #include "base/callback.h" #include "base/location.h" +#include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" #include "base/time/time.h" diff --git a/storage/browser/fileapi/transient_file_util.h b/storage/browser/fileapi/transient_file_util.h index d81708a..d3e3da7 100644 --- a/storage/browser/fileapi/transient_file_util.h +++ b/storage/browser/fileapi/transient_file_util.h @@ -5,6 +5,7 @@ #ifndef STORAGE_BROWSER_FILEAPI_TRANSIENT_FILE_UTIL_H_ #define STORAGE_BROWSER_FILEAPI_TRANSIENT_FILE_UTIL_H_ +#include "base/macros.h" #include "base/memory/scoped_ptr.h" #include "storage/browser/fileapi/local_file_util.h" #include "storage/browser/storage_browser_export.h" diff --git a/storage/browser/fileapi/watcher_manager.h b/storage/browser/fileapi/watcher_manager.h index e38d207..470a988 100644 --- a/storage/browser/fileapi/watcher_manager.h +++ b/storage/browser/fileapi/watcher_manager.h @@ -7,7 +7,6 @@ #include <vector> -#include "base/basictypes.h" #include "base/callback_forward.h" #include "base/files/file.h" diff --git a/storage/browser/quota/client_usage_tracker.cc b/storage/browser/quota/client_usage_tracker.cc index 0b11bd1..e0a901c 100644 --- a/storage/browser/quota/client_usage_tracker.cc +++ b/storage/browser/quota/client_usage_tracker.cc @@ -4,6 +4,8 @@ #include "storage/browser/quota/client_usage_tracker.h" +#include <stdint.h> + #include "base/bind.h" #include "base/stl_util.h" #include "net/base/net_util.h" @@ -18,8 +20,8 @@ typedef ClientUsageTracker::OriginUsageAccumulator OriginUsageAccumulator; typedef ClientUsageTracker::OriginSetByHost OriginSetByHost; void DidGetHostUsage(const UsageCallback& callback, - int64 limited_usage, - int64 unlimited_usage) { + int64_t limited_usage, + int64_t unlimited_usage) { DCHECK_GE(limited_usage, 0); DCHECK_GE(unlimited_usage, 0); callback.Run(limited_usage + unlimited_usage); @@ -48,8 +50,8 @@ bool OriginSetContainsOrigin(const OriginSetByHost& origins, } void DidGetGlobalUsageForLimitedGlobalUsage(const UsageCallback& callback, - int64 total_global_usage, - int64 global_unlimited_usage) { + int64_t total_global_usage, + int64_t global_unlimited_usage) { callback.Run(total_global_usage - global_unlimited_usage); } @@ -135,8 +137,7 @@ void ClientUsageTracker::GetHostUsage( &ClientUsageTracker::DidGetOriginsForHostUsage, AsWeakPtr(), host)); } -void ClientUsageTracker::UpdateUsageCache( - const GURL& origin, int64 delta) { +void ClientUsageTracker::UpdateUsageCache(const GURL& origin, int64_t delta) { std::string host = net::GetHostOrSpecFromURL(origin); if (cached_hosts_.find(host) != cached_hosts_.end()) { if (!IsUsageCacheEnabledForOrigin(origin)) @@ -165,7 +166,7 @@ void ClientUsageTracker::UpdateUsageCache( } void ClientUsageTracker::GetCachedHostsUsage( - std::map<std::string, int64>* host_usage) const { + std::map<std::string, int64_t>* host_usage) const { DCHECK(host_usage); for (const auto& host_and_usage_map : cached_usage_by_host_) { const std::string& host = host_and_usage_map.first; @@ -174,7 +175,7 @@ void ClientUsageTracker::GetCachedHostsUsage( } void ClientUsageTracker::GetCachedOriginsUsage( - std::map<GURL, int64>* origin_usage) const { + std::map<GURL, int64_t>* origin_usage) const { DCHECK(origin_usage); for (const auto& host_and_usage_map : cached_usage_by_host_) { for (const auto& origin_and_usage : host_and_usage_map.second) @@ -201,7 +202,7 @@ void ClientUsageTracker::SetUsageCacheEnabled(const GURL& origin, UsageMap::iterator found = cached_usage_for_host.find(origin); if (found != cached_usage_for_host.end()) { - int64 usage = found->second; + int64_t usage = found->second; UpdateUsageCache(origin, -usage); cached_usage_for_host.erase(found); if (cached_usage_for_host.empty()) { @@ -231,7 +232,7 @@ void ClientUsageTracker::SetUsageCacheEnabled(const GURL& origin, void ClientUsageTracker::AccumulateLimitedOriginUsage( AccumulateInfo* info, const UsageCallback& callback, - int64 usage) { + int64_t usage) { info->limited_usage += usage; if (--info->pending_jobs) return; @@ -271,8 +272,8 @@ void ClientUsageTracker::DidGetOriginsForGlobalUsage( void ClientUsageTracker::AccumulateHostUsage( AccumulateInfo* info, const GlobalUsageCallback& callback, - int64 limited_usage, - int64 unlimited_usage) { + int64_t limited_usage, + int64_t unlimited_usage) { info->limited_usage += limited_usage; info->unlimited_usage += unlimited_usage; if (--info->pending_jobs) @@ -309,7 +310,7 @@ void ClientUsageTracker::GetUsageForOrigins( for (const auto& origin : origins) { DCHECK_EQ(host, net::GetHostOrSpecFromURL(origin)); - int64 origin_usage = 0; + int64_t origin_usage = 0; if (GetCachedOriginUsage(origin, &origin_usage)) accumulator.Run(origin, origin_usage); else @@ -323,7 +324,7 @@ void ClientUsageTracker::GetUsageForOrigins( void ClientUsageTracker::AccumulateOriginUsage(AccumulateInfo* info, const std::string& host, const GURL& origin, - int64 usage) { + int64_t usage) { if (!origin.is_empty()) { if (usage < 0) usage = 0; @@ -343,8 +344,8 @@ void ClientUsageTracker::AccumulateOriginUsage(AccumulateInfo* info, host, info->limited_usage, info->unlimited_usage); } -void ClientUsageTracker::DidGetHostUsageAfterUpdate( - const GURL& origin, int64 usage) { +void ClientUsageTracker::DidGetHostUsageAfterUpdate(const GURL& origin, + int64_t usage) { if (!storage_monitor_) return; @@ -352,13 +353,13 @@ void ClientUsageTracker::DidGetHostUsageAfterUpdate( storage_monitor_->NotifyUsageChange(filter, 0); } -void ClientUsageTracker::AddCachedOrigin( - const GURL& origin, int64 new_usage) { +void ClientUsageTracker::AddCachedOrigin(const GURL& origin, + int64_t new_usage) { DCHECK(IsUsageCacheEnabledForOrigin(origin)); std::string host = net::GetHostOrSpecFromURL(origin); - int64* usage = &cached_usage_by_host_[host][origin]; - int64 delta = new_usage - *usage; + int64_t* usage = &cached_usage_by_host_[host][origin]; + int64_t delta = new_usage - *usage; *usage = new_usage; if (delta) { if (IsStorageUnlimited(origin)) @@ -374,21 +375,20 @@ void ClientUsageTracker::AddCachedHost(const std::string& host) { cached_hosts_.insert(host); } -int64 ClientUsageTracker::GetCachedHostUsage(const std::string& host) const { +int64_t ClientUsageTracker::GetCachedHostUsage(const std::string& host) const { HostUsageMap::const_iterator found = cached_usage_by_host_.find(host); if (found == cached_usage_by_host_.end()) return 0; - int64 usage = 0; + int64_t usage = 0; const UsageMap& usage_map = found->second; for (const auto& origin_and_usage : usage_map) usage += origin_and_usage.second; return usage; } -bool ClientUsageTracker::GetCachedOriginUsage( - const GURL& origin, - int64* usage) const { +bool ClientUsageTracker::GetCachedOriginUsage(const GURL& origin, + int64_t* usage) const { std::string host = net::GetHostOrSpecFromURL(origin); HostUsageMap::const_iterator found_host = cached_usage_by_host_.find(host); if (found_host == cached_usage_by_host_.end()) @@ -416,7 +416,7 @@ void ClientUsageTracker::OnGranted(const GURL& origin, int change_flags) { DCHECK(CalledOnValidThread()); if (change_flags & SpecialStoragePolicy::STORAGE_UNLIMITED) { - int64 usage = 0; + int64_t usage = 0; if (GetCachedOriginUsage(origin, &usage)) { global_unlimited_usage_ += usage; global_limited_usage_ -= usage; @@ -433,7 +433,7 @@ void ClientUsageTracker::OnRevoked(const GURL& origin, int change_flags) { DCHECK(CalledOnValidThread()); if (change_flags & SpecialStoragePolicy::STORAGE_UNLIMITED) { - int64 usage = 0; + int64_t usage = 0; if (GetCachedOriginUsage(origin, &usage)) { global_unlimited_usage_ -= usage; global_limited_usage_ += usage; diff --git a/storage/browser/quota/client_usage_tracker.h b/storage/browser/quota/client_usage_tracker.h index 0505fae..359b680 100644 --- a/storage/browser/quota/client_usage_tracker.h +++ b/storage/browser/quota/client_usage_tracker.h @@ -5,13 +5,15 @@ #ifndef STORAGE_BROWSER_QUOTA_CLIENT_USAGE_TRACKER_H_ #define STORAGE_BROWSER_QUOTA_CLIENT_USAGE_TRACKER_H_ +#include <stdint.h> + #include <map> #include <set> #include <string> #include <vector> -#include "base/basictypes.h" #include "base/callback.h" +#include "base/macros.h" #include "base/memory/scoped_ptr.h" #include "base/threading/non_thread_safe.h" #include "storage/browser/quota/quota_callbacks.h" @@ -33,10 +35,10 @@ class ClientUsageTracker : public SpecialStoragePolicy::Observer, public base::NonThreadSafe, public base::SupportsWeakPtr<ClientUsageTracker> { public: - typedef base::Callback<void(int64 limited_usage, - int64 unlimited_usage)> HostUsageAccumulator; - typedef base::Callback<void(const GURL& origin, - int64 usage)> OriginUsageAccumulator; + typedef base::Callback<void(int64_t limited_usage, int64_t unlimited_usage)> + HostUsageAccumulator; + typedef base::Callback<void(const GURL& origin, int64_t usage)> + OriginUsageAccumulator; typedef std::map<std::string, std::set<GURL> > OriginSetByHost; ClientUsageTracker(UsageTracker* tracker, @@ -49,25 +51,25 @@ class ClientUsageTracker : public SpecialStoragePolicy::Observer, void GetGlobalLimitedUsage(const UsageCallback& callback); void GetGlobalUsage(const GlobalUsageCallback& callback); void GetHostUsage(const std::string& host, const UsageCallback& callback); - void UpdateUsageCache(const GURL& origin, int64 delta); - void GetCachedHostsUsage(std::map<std::string, int64>* host_usage) const; - void GetCachedOriginsUsage(std::map<GURL, int64>* origin_usage) const; + void UpdateUsageCache(const GURL& origin, int64_t delta); + void GetCachedHostsUsage(std::map<std::string, int64_t>* host_usage) const; + void GetCachedOriginsUsage(std::map<GURL, int64_t>* origin_usage) const; void GetCachedOrigins(std::set<GURL>* origins) const; bool IsUsageCacheEnabledForOrigin(const GURL& origin) const; void SetUsageCacheEnabled(const GURL& origin, bool enabled); private: - typedef CallbackQueueMap<HostUsageAccumulator, std::string, int64, int64> + typedef CallbackQueueMap<HostUsageAccumulator, std::string, int64_t, int64_t> HostUsageAccumulatorMap; typedef std::set<std::string> HostSet; - typedef std::map<GURL, int64> UsageMap; + typedef std::map<GURL, int64_t> UsageMap; typedef std::map<std::string, UsageMap> HostUsageMap; struct AccumulateInfo { int pending_jobs; - int64 limited_usage; - int64 unlimited_usage; + int64_t limited_usage; + int64_t unlimited_usage; AccumulateInfo() : pending_jobs(0), limited_usage(0), unlimited_usage(0) {} @@ -75,13 +77,13 @@ class ClientUsageTracker : public SpecialStoragePolicy::Observer, void AccumulateLimitedOriginUsage(AccumulateInfo* info, const UsageCallback& callback, - int64 usage); + int64_t usage); void DidGetOriginsForGlobalUsage(const GlobalUsageCallback& callback, const std::set<GURL>& origins); void AccumulateHostUsage(AccumulateInfo* info, const GlobalUsageCallback& callback, - int64 limited_usage, - int64 unlimited_usage); + int64_t limited_usage, + int64_t unlimited_usage); void DidGetOriginsForHostUsage(const std::string& host, const std::set<GURL>& origins); @@ -91,18 +93,18 @@ class ClientUsageTracker : public SpecialStoragePolicy::Observer, void AccumulateOriginUsage(AccumulateInfo* info, const std::string& host, const GURL& origin, - int64 usage); + int64_t usage); - void DidGetHostUsageAfterUpdate(const GURL& origin, int64 usage); + void DidGetHostUsageAfterUpdate(const GURL& origin, int64_t usage); // Methods used by our GatherUsage tasks, as a task makes progress // origins and hosts are added incrementally to the cache. - void AddCachedOrigin(const GURL& origin, int64 usage); + void AddCachedOrigin(const GURL& origin, int64_t usage); void AddCachedHost(const std::string& host); - int64 GetCachedHostUsage(const std::string& host) const; - int64 GetCachedGlobalUnlimitedUsage(); - bool GetCachedOriginUsage(const GURL& origin, int64* usage) const; + int64_t GetCachedHostUsage(const std::string& host) const; + int64_t GetCachedGlobalUnlimitedUsage(); + bool GetCachedOriginUsage(const GURL& origin, int64_t* usage) const; // SpecialStoragePolicy::Observer overrides void OnGranted(const GURL& origin, int change_flags) override; @@ -116,8 +118,8 @@ class ClientUsageTracker : public SpecialStoragePolicy::Observer, const StorageType type_; StorageMonitor* storage_monitor_; - int64 global_limited_usage_; - int64 global_unlimited_usage_; + int64_t global_limited_usage_; + int64_t global_unlimited_usage_; bool global_usage_retrieved_; HostSet cached_hosts_; HostUsageMap cached_usage_by_host_; diff --git a/storage/browser/quota/quota_callbacks.h b/storage/browser/quota/quota_callbacks.h index 4746c5e..270e14f 100644 --- a/storage/browser/quota/quota_callbacks.h +++ b/storage/browser/quota/quota_callbacks.h @@ -5,11 +5,13 @@ #ifndef STORAGE_BROWSER_QUOTA_QUOTA_CALLBACKS_H_ #define STORAGE_BROWSER_QUOTA_QUOTA_CALLBACKS_H_ +#include <stddef.h> +#include <stdint.h> + #include <map> #include <set> #include <vector> -#include "base/basictypes.h" #include "base/callback.h" #include "storage/common/quota/quota_status_code.h" #include "storage/common/quota/quota_types.h" @@ -22,11 +24,12 @@ struct UsageInfo; typedef std::vector<UsageInfo> UsageInfoEntries; // Common callback types that are used throughout in the quota module. -typedef base::Callback<void(int64 usage, - int64 unlimited_usage)> GlobalUsageCallback; -typedef base::Callback<void(QuotaStatusCode status, int64 quota)> QuotaCallback; -typedef base::Callback<void(int64 usage)> UsageCallback; -typedef base::Callback<void(QuotaStatusCode, int64)> AvailableSpaceCallback; +typedef base::Callback<void(int64_t usage, int64_t unlimited_usage)> + GlobalUsageCallback; +typedef base::Callback<void(QuotaStatusCode status, int64_t quota)> + QuotaCallback; +typedef base::Callback<void(int64_t usage)> UsageCallback; +typedef base::Callback<void(QuotaStatusCode, int64_t)> AvailableSpaceCallback; typedef base::Callback<void(QuotaStatusCode)> StatusCallback; typedef base::Callback<void(const std::set<GURL>& origins, StorageType type)> GetOriginsCallback; diff --git a/storage/browser/quota/quota_client.h b/storage/browser/quota/quota_client.h index 624a3f2..973f4ad 100644 --- a/storage/browser/quota/quota_client.h +++ b/storage/browser/quota/quota_client.h @@ -5,6 +5,8 @@ #ifndef STORAGE_BROWSER_QUOTA_QUOTA_CLIENT_H_ #define STORAGE_BROWSER_QUOTA_QUOTA_CLIENT_H_ +#include <stdint.h> + #include <list> #include <set> #include <string> @@ -22,7 +24,7 @@ namespace storage { // All the methods are assumed to be called on the IO thread in the browser. class STORAGE_EXPORT QuotaClient { public: - typedef base::Callback<void(int64 usage)> GetUsageCallback; + typedef base::Callback<void(int64_t usage)> GetUsageCallback; typedef base::Callback<void(const std::set<GURL>& origins)> GetOriginsCallback; typedef base::Callback<void(QuotaStatusCode status)> DeletionCallback; diff --git a/storage/browser/quota/quota_database.cc b/storage/browser/quota/quota_database.cc index 3a28f02..546073f 100644 --- a/storage/browser/quota/quota_database.cc +++ b/storage/browser/quota/quota_database.cc @@ -4,12 +4,16 @@ #include "storage/browser/quota/quota_database.h" +#include <stddef.h> +#include <stdint.h> + #include <tuple> #include <vector> #include "base/auto_reset.h" #include "base/bind.h" #include "base/files/file_util.h" +#include "base/macros.h" #include "base/metrics/histogram_macros.h" #include "sql/connection.h" #include "sql/meta_table.h" @@ -116,14 +120,10 @@ QuotaDatabase::QuotaTableEntry::QuotaTableEntry() quota(0) { } -QuotaDatabase::QuotaTableEntry::QuotaTableEntry( - const std::string& host, - StorageType type, - int64 quota) - : host(host), - type(type), - quota(quota) { -} +QuotaDatabase::QuotaTableEntry::QuotaTableEntry(const std::string& host, + StorageType type, + int64_t quota) + : host(host), type(type), quota(quota) {} QuotaDatabase::OriginInfoTableEntry::OriginInfoTableEntry() : type(kStorageTypeUnknown), @@ -161,8 +161,9 @@ void QuotaDatabase::CloseConnection() { db_.reset(); } -bool QuotaDatabase::GetHostQuota( - const std::string& host, StorageType type, int64* quota) { +bool QuotaDatabase::GetHostQuota(const std::string& host, + StorageType type, + int64_t* quota) { DCHECK(quota); if (!LazyOpen(false)) return false; @@ -183,8 +184,9 @@ bool QuotaDatabase::GetHostQuota( return true; } -bool QuotaDatabase::SetHostQuota( - const std::string& host, StorageType type, int64 quota) { +bool QuotaDatabase::SetHostQuota(const std::string& host, + StorageType type, + int64_t quota) { DCHECK_GE(quota, 0); if (!LazyOpen(true)) return false; @@ -412,14 +414,14 @@ bool QuotaDatabase::DeleteOriginInfo( return true; } -bool QuotaDatabase::GetQuotaConfigValue(const char* key, int64* value) { +bool QuotaDatabase::GetQuotaConfigValue(const char* key, int64_t* value) { if (!LazyOpen(false)) return false; DCHECK(VerifyValidQuotaConfig(key)); return meta_table_->GetValue(key, value); } -bool QuotaDatabase::SetQuotaConfigValue(const char* key, int64 value) { +bool QuotaDatabase::SetQuotaConfigValue(const char* key, int64_t value) { if (!LazyOpen(true)) return false; DCHECK(VerifyValidQuotaConfig(key)); @@ -734,8 +736,9 @@ bool QuotaDatabase::UpgradeSchema(int current_version) { return false; } -bool QuotaDatabase::InsertOrReplaceHostQuota( - const std::string& host, StorageType type, int64 quota) { +bool QuotaDatabase::InsertOrReplaceHostQuota(const std::string& host, + StorageType type, + int64_t quota) { DCHECK(db_.get()); const char* kSql = "INSERT OR REPLACE INTO HostQuotaTable" diff --git a/storage/browser/quota/quota_database.h b/storage/browser/quota/quota_database.h index 4650dcc..49d5e13 100644 --- a/storage/browser/quota/quota_database.h +++ b/storage/browser/quota/quota_database.h @@ -5,12 +5,15 @@ #ifndef STORAGE_BROWSER_QUOTA_QUOTA_DATABASE_H_ #define STORAGE_BROWSER_QUOTA_QUOTA_DATABASE_H_ +#include <stddef.h> +#include <stdint.h> + #include <set> #include <string> -#include "base/basictypes.h" #include "base/callback.h" #include "base/files/file_path.h" +#include "base/macros.h" #include "base/memory/scoped_ptr.h" #include "base/time/time.h" #include "base/timer/timer.h" @@ -61,10 +64,10 @@ class STORAGE_EXPORT QuotaDatabase { void CloseConnection(); // Returns whether the record could be found. - bool GetHostQuota(const std::string& host, StorageType type, int64* quota); + bool GetHostQuota(const std::string& host, StorageType type, int64_t* quota); // Returns whether the operation succeeded. - bool SetHostQuota(const std::string& host, StorageType type, int64 quota); + bool SetHostQuota(const std::string& host, StorageType type, int64_t quota); bool DeleteHostQuota(const std::string& host, StorageType type); bool SetOriginLastAccessTime(const GURL& origin, @@ -102,8 +105,8 @@ class STORAGE_EXPORT QuotaDatabase { bool DeleteOriginInfo(const GURL& origin, StorageType type); - bool GetQuotaConfigValue(const char* key, int64* value); - bool SetQuotaConfigValue(const char* key, int64 value); + bool GetQuotaConfigValue(const char* key, int64_t* value); + bool SetQuotaConfigValue(const char* key, int64_t value); // Sets |origin| to the least recently used origin of origins not included // in |exceptions| and not granted the special unlimited storage right. @@ -129,13 +132,10 @@ class STORAGE_EXPORT QuotaDatabase { private: struct STORAGE_EXPORT QuotaTableEntry { QuotaTableEntry(); - QuotaTableEntry( - const std::string& host, - StorageType type, - int64 quota); + QuotaTableEntry(const std::string& host, StorageType type, int64_t quota); std::string host; StorageType type; - int64 quota; + int64_t quota; }; friend STORAGE_EXPORT bool operator <( const QuotaTableEntry& lhs, const QuotaTableEntry& rhs); @@ -175,8 +175,9 @@ class STORAGE_EXPORT QuotaDatabase { bool EnsureDatabaseVersion(); bool ResetSchema(); bool UpgradeSchema(int current_version); - bool InsertOrReplaceHostQuota( - const std::string& host, StorageType type, int64 quota); + bool InsertOrReplaceHostQuota(const std::string& host, + StorageType type, + int64_t quota); static bool CreateSchema( sql::Connection* database, diff --git a/storage/browser/quota/quota_manager.cc b/storage/browser/quota/quota_manager.cc index f8558f2..aa8a9f6 100644 --- a/storage/browser/quota/quota_manager.cc +++ b/storage/browser/quota/quota_manager.cc @@ -4,6 +4,9 @@ #include "storage/browser/quota/quota_manager.h" +#include <stddef.h> +#include <stdint.h> + #include <algorithm> #include <functional> #include <limits> @@ -12,6 +15,7 @@ #include "base/bind_helpers.h" #include "base/command_line.h" #include "base/files/file_util.h" +#include "base/macros.h" #include "base/metrics/histogram.h" #include "base/profiler/scoped_tracker.h" #include "base/sequenced_task_runner.h" diff --git a/storage/browser/quota/quota_manager_proxy.cc b/storage/browser/quota/quota_manager_proxy.cc index 921eab2..2efd22c 100644 --- a/storage/browser/quota/quota_manager_proxy.cc +++ b/storage/browser/quota/quota_manager_proxy.cc @@ -4,6 +4,8 @@ #include "storage/browser/quota/quota_manager_proxy.h" +#include <stdint.h> + #include "base/bind.h" #include "base/bind_helpers.h" #include "base/sequenced_task_runner.h" @@ -19,7 +21,9 @@ namespace { void DidGetUsageAndQuota( base::SequencedTaskRunner* original_task_runner, const QuotaManagerProxy::GetUsageAndQuotaCallback& callback, - QuotaStatusCode status, int64 usage, int64 quota) { + QuotaStatusCode status, + int64_t usage, + int64_t quota) { if (!original_task_runner->RunsTasksOnCurrentThread()) { original_task_runner->PostTask( FROM_HERE, @@ -66,11 +70,10 @@ void QuotaManagerProxy::NotifyStorageAccessed( manager_->NotifyStorageAccessed(client_id, origin, type); } -void QuotaManagerProxy::NotifyStorageModified( - QuotaClient::ID client_id, - const GURL& origin, - StorageType type, - int64 delta) { +void QuotaManagerProxy::NotifyStorageModified(QuotaClient::ID client_id, + const GURL& origin, + StorageType type, + int64_t delta) { if (!io_thread_->BelongsToCurrentThread()) { io_thread_->PostTask( FROM_HERE, diff --git a/storage/browser/quota/quota_manager_proxy.h b/storage/browser/quota/quota_manager_proxy.h index bf9d9ca..787a10b 100644 --- a/storage/browser/quota/quota_manager_proxy.h +++ b/storage/browser/quota/quota_manager_proxy.h @@ -5,9 +5,11 @@ #ifndef STORAGE_BROWSER_QUOTA_QUOTA_MANAGER_PROXY_H_ #define STORAGE_BROWSER_QUOTA_QUOTA_MANAGER_PROXY_H_ -#include "base/basictypes.h" +#include <stdint.h> + #include "base/callback.h" #include "base/files/file_path.h" +#include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" #include "base/memory/weak_ptr.h" @@ -41,7 +43,7 @@ class STORAGE_EXPORT QuotaManagerProxy virtual void NotifyStorageModified(QuotaClient::ID client_id, const GURL& origin, StorageType type, - int64 delta); + int64_t delta); virtual void NotifyOriginInUse(const GURL& origin); virtual void NotifyOriginNoLongerInUse(const GURL& origin); diff --git a/storage/browser/quota/quota_task.h b/storage/browser/quota/quota_task.h index 35e004e..9fd51c3 100644 --- a/storage/browser/quota/quota_task.h +++ b/storage/browser/quota/quota_task.h @@ -7,7 +7,6 @@ #include <set> -#include "base/basictypes.h" #include "base/compiler_specific.h" #include "base/memory/ref_counted.h" #include "base/sequenced_task_runner_helpers.h" diff --git a/storage/browser/quota/quota_temporary_storage_evictor.cc b/storage/browser/quota/quota_temporary_storage_evictor.cc index fcbad66..0fdc49a 100644 --- a/storage/browser/quota/quota_temporary_storage_evictor.cc +++ b/storage/browser/quota/quota_temporary_storage_evictor.cc @@ -4,6 +4,8 @@ #include "storage/browser/quota/quota_temporary_storage_evictor.h" +#include <stdint.h> + #include <algorithm> #include "base/bind.h" @@ -23,7 +25,7 @@ base::TimeDelta::FromDays(1), 50) namespace { -const int64 kMBytes = 1024 * 1024; +const int64_t kMBytes = 1024 * 1024; const double kUsageRatioToStartEviction = 0.7; const int kThresholdOfErrorsToStopEviction = 5; const int kHistogramReportIntervalMinutes = 60; @@ -46,7 +48,7 @@ QuotaTemporaryStorageEvictor::EvictionRoundStatistics::EvictionRoundStatistics() QuotaTemporaryStorageEvictor::QuotaTemporaryStorageEvictor( QuotaEvictionHandler* quota_eviction_handler, - int64 interval_ms) + int64_t interval_ms) : min_available_disk_space_to_start_eviction_( kMinAvailableDiskSpaceToStartEvictionNotSpecified), quota_eviction_handler_(quota_eviction_handler), @@ -60,7 +62,7 @@ QuotaTemporaryStorageEvictor::~QuotaTemporaryStorageEvictor() { } void QuotaTemporaryStorageEvictor::GetStatistics( - std::map<std::string, int64>* statistics) { + std::map<std::string, int64_t>* statistics) { DCHECK(statistics); (*statistics)["errors-on-evicting-origin"] = @@ -168,20 +170,20 @@ void QuotaTemporaryStorageEvictor::OnGotUsageAndQuotaForEviction( const UsageAndQuota& qau) { DCHECK(CalledOnValidThread()); - int64 usage = qau.global_limited_usage; + int64_t usage = qau.global_limited_usage; DCHECK_GE(usage, 0); if (status != kQuotaStatusOk) ++statistics_.num_errors_on_getting_usage_and_quota; - int64 usage_overage = std::max( - static_cast<int64>(0), - usage - static_cast<int64>(qau.quota * kUsageRatioToStartEviction)); + int64_t usage_overage = std::max( + static_cast<int64_t>(0), + usage - static_cast<int64_t>(qau.quota * kUsageRatioToStartEviction)); // min_available_disk_space_to_start_eviction_ might be < 0 if no value // is explicitly configured yet. - int64 diskspace_shortage = std::max( - static_cast<int64>(0), + int64_t diskspace_shortage = std::max( + static_cast<int64_t>(0), min_available_disk_space_to_start_eviction_ - qau.available_disk_space); if (!round_statistics_.is_initialized) { @@ -192,7 +194,7 @@ void QuotaTemporaryStorageEvictor::OnGotUsageAndQuotaForEviction( } round_statistics_.usage_on_end_of_round = usage; - int64 amount_to_evict = std::max(usage_overage, diskspace_shortage); + int64_t amount_to_evict = std::max(usage_overage, diskspace_shortage); if (status == kQuotaStatusOk && amount_to_evict > 0) { // Space is getting tight. Get the least recently used origin and continue. // TODO(michaeln): if the reason for eviction is low physical disk space, diff --git a/storage/browser/quota/quota_temporary_storage_evictor.h b/storage/browser/quota/quota_temporary_storage_evictor.h index be14a8a..f3cdf3a 100644 --- a/storage/browser/quota/quota_temporary_storage_evictor.h +++ b/storage/browser/quota/quota_temporary_storage_evictor.h @@ -5,10 +5,13 @@ #ifndef STORAGE_BROWSER_QUOTA_QUOTA_TEMPORARY_STORAGE_EVICTOR_H_ #define STORAGE_BROWSER_QUOTA_QUOTA_TEMPORARY_STORAGE_EVICTOR_H_ +#include <stdint.h> + #include <map> #include <set> #include <string> +#include "base/macros.h" #include "base/memory/weak_ptr.h" #include "base/threading/non_thread_safe.h" #include "base/timer/timer.h" @@ -35,11 +38,11 @@ class STORAGE_EXPORT QuotaTemporaryStorageEvictor : public base::NonThreadSafe { num_evicted_origins(0), num_eviction_rounds(0), num_skipped_eviction_rounds(0) {} - int64 num_errors_on_evicting_origin; - int64 num_errors_on_getting_usage_and_quota; - int64 num_evicted_origins; - int64 num_eviction_rounds; - int64 num_skipped_eviction_rounds; + int64_t num_errors_on_evicting_origin; + int64_t num_errors_on_getting_usage_and_quota; + int64_t num_evicted_origins; + int64_t num_eviction_rounds; + int64_t num_skipped_eviction_rounds; void subtract_assign(const Statistics& rhs) { num_errors_on_evicting_origin -= rhs.num_errors_on_evicting_origin; @@ -58,32 +61,31 @@ class STORAGE_EXPORT QuotaTemporaryStorageEvictor : public base::NonThreadSafe { bool is_initialized; base::Time start_time; - int64 usage_overage_at_round; - int64 diskspace_shortage_at_round; + int64_t usage_overage_at_round; + int64_t diskspace_shortage_at_round; - int64 usage_on_beginning_of_round; - int64 usage_on_end_of_round; - int64 num_evicted_origins_in_round; + int64_t usage_on_beginning_of_round; + int64_t usage_on_end_of_round; + int64_t num_evicted_origins_in_round; }; - QuotaTemporaryStorageEvictor( - QuotaEvictionHandler* quota_eviction_handler, - int64 interval_ms); + QuotaTemporaryStorageEvictor(QuotaEvictionHandler* quota_eviction_handler, + int64_t interval_ms); virtual ~QuotaTemporaryStorageEvictor(); - void GetStatistics(std::map<std::string, int64>* statistics); + void GetStatistics(std::map<std::string, int64_t>* statistics); void ReportPerRoundHistogram(); void ReportPerHourHistogram(); void Start(); - int64 min_available_disk_space_to_start_eviction() { + int64_t min_available_disk_space_to_start_eviction() { return min_available_disk_space_to_start_eviction_; } void reset_min_available_disk_space_to_start_eviction() { min_available_disk_space_to_start_eviction_ = kMinAvailableDiskSpaceToStartEvictionNotSpecified; } - void set_min_available_disk_space_to_start_eviction(int64 value) { + void set_min_available_disk_space_to_start_eviction(int64_t value) { min_available_disk_space_to_start_eviction_ = value; } @@ -108,7 +110,7 @@ class STORAGE_EXPORT QuotaTemporaryStorageEvictor : public base::NonThreadSafe { static const int kMinAvailableDiskSpaceToStartEvictionNotSpecified; - int64 min_available_disk_space_to_start_eviction_; + int64_t min_available_disk_space_to_start_eviction_; // Not owned; quota_eviction_handler owns us. QuotaEvictionHandler* quota_eviction_handler_; @@ -120,7 +122,7 @@ class STORAGE_EXPORT QuotaTemporaryStorageEvictor : public base::NonThreadSafe { base::Time time_of_end_of_last_round_; std::set<GURL> in_progress_eviction_origins_; - int64 interval_ms_; + int64_t interval_ms_; bool repeated_eviction_; base::OneShotTimer eviction_timer_; diff --git a/storage/browser/quota/storage_monitor.cc b/storage/browser/quota/storage_monitor.cc index 2ce2122..41ef41b 100644 --- a/storage/browser/quota/storage_monitor.cc +++ b/storage/browser/quota/storage_monitor.cc @@ -4,6 +4,8 @@ #include "storage/browser/quota/storage_monitor.h" +#include <stdint.h> + #include <algorithm> #include "base/stl_util.h" @@ -151,8 +153,8 @@ void HostStorageObservers::AddObserver( if (initialized_) { StorageObserver::Event event(params.filter, - std::max<int64>(cached_usage_, 0), - std::max<int64>(cached_quota_, 0)); + std::max<int64_t>(cached_usage_, 0), + std::max<int64_t>(cached_quota_, 0)); observer->OnStorageEvent(event); return; } @@ -172,7 +174,8 @@ bool HostStorageObservers::ContainsObservers() const { } void HostStorageObservers::NotifyUsageChange( - const StorageObserver::Filter& filter, int64 delta) { + const StorageObserver::Filter& filter, + int64_t delta) { if (initialized_) { cached_usage_ += delta; DispatchEvent(filter, true); @@ -215,8 +218,8 @@ void HostStorageObservers::StartInitialization( void HostStorageObservers::GotHostUsageAndQuota( const StorageObserver::Filter& filter, QuotaStatusCode status, - int64 usage, - int64 quota) { + int64_t usage, + int64_t quota) { initializing_ = false; if (status != kQuotaStatusOk) return; @@ -228,9 +231,8 @@ void HostStorageObservers::GotHostUsageAndQuota( void HostStorageObservers::DispatchEvent( const StorageObserver::Filter& filter, bool is_update) { - StorageObserver::Event event(filter, - std::max<int64>(cached_usage_, 0), - std::max<int64>(cached_quota_, 0)); + StorageObserver::Event event(filter, std::max<int64_t>(cached_usage_, 0), + std::max<int64_t>(cached_quota_, 0)); if (is_update) observers_.OnStorageChange(event); else @@ -303,7 +305,8 @@ const HostStorageObservers* StorageTypeObservers::GetHostObservers( } void StorageTypeObservers::NotifyUsageChange( - const StorageObserver::Filter& filter, int64 delta) { + const StorageObserver::Filter& filter, + int64_t delta) { std::string host = net::GetHostOrSpecFromURL(filter.origin); HostObserversMap::iterator it = host_observers_map_.find(host); if (it == host_observers_map_.end()) @@ -376,8 +379,8 @@ const StorageTypeObservers* StorageMonitor::GetStorageTypeObservers( return NULL; } -void StorageMonitor::NotifyUsageChange( - const StorageObserver::Filter& filter, int64 delta) { +void StorageMonitor::NotifyUsageChange(const StorageObserver::Filter& filter, + int64_t delta) { // Check preconditions. if (filter.storage_type == kStorageTypeUnknown || filter.storage_type == kStorageTypeQuotaNotManaged || diff --git a/storage/browser/quota/storage_monitor.h b/storage/browser/quota/storage_monitor.h index 143815a..d215804 100644 --- a/storage/browser/quota/storage_monitor.h +++ b/storage/browser/quota/storage_monitor.h @@ -5,8 +5,11 @@ #ifndef STORAGE_BROWSER_QUOTA_STORAGE_MONITOR_H_ #define STORAGE_BROWSER_QUOTA_STORAGE_MONITOR_H_ +#include <stdint.h> + #include <map> +#include "base/macros.h" #include "base/memory/weak_ptr.h" #include "base/time/time.h" #include "base/timer/timer.h" @@ -86,14 +89,14 @@ class STORAGE_EXPORT HostStorageObservers { bool ContainsObservers() const; // Handles a usage change. - void NotifyUsageChange(const StorageObserver::Filter& filter, int64 delta); + void NotifyUsageChange(const StorageObserver::Filter& filter, int64_t delta); private: void StartInitialization(const StorageObserver::Filter& filter); void GotHostUsageAndQuota(const StorageObserver::Filter& filter, QuotaStatusCode status, - int64 usage, - int64 quota); + int64_t usage, + int64_t quota); void DispatchEvent(const StorageObserver::Filter& filter, bool is_update); QuotaManager* quota_manager_; @@ -103,11 +106,11 @@ class STORAGE_EXPORT HostStorageObservers { bool initialized_; bool initializing_; bool event_occurred_before_init_; - int64 usage_deltas_during_init_; + int64_t usage_deltas_during_init_; // Cached accumulated usage and quota for the host. - int64 cached_usage_; - int64 cached_quota_; + int64_t cached_usage_; + int64_t cached_quota_; base::WeakPtrFactory<HostStorageObservers> weak_factory_; @@ -134,7 +137,7 @@ class STORAGE_EXPORT StorageTypeObservers { const HostStorageObservers* GetHostObservers(const std::string& host) const; // Handles a usage change. - void NotifyUsageChange(const StorageObserver::Filter& filter, int64 delta); + void NotifyUsageChange(const StorageObserver::Filter& filter, int64_t delta); private: typedef std::map<std::string, HostStorageObservers*> HostObserversMap; @@ -164,7 +167,7 @@ class STORAGE_EXPORT StorageMonitor { StorageType storage_type) const; // Handles a usage change. - void NotifyUsageChange(const StorageObserver::Filter& filter, int64 delta); + void NotifyUsageChange(const StorageObserver::Filter& filter, int64_t delta); private: typedef std::map<StorageType, StorageTypeObservers*> StorageTypeObserversMap; diff --git a/storage/browser/quota/storage_observer.cc b/storage/browser/quota/storage_observer.cc index 986b639..81d3387 100644 --- a/storage/browser/quota/storage_observer.cc +++ b/storage/browser/quota/storage_observer.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 "storage/browser/quota/storage_observer.h" namespace storage { @@ -52,9 +54,10 @@ StorageObserver::Event::Event() : usage(0), quota(0) { } -StorageObserver::Event::Event(const Filter& filter, int64 usage, int64 quota) - : filter(filter), usage(usage), quota(quota) { -} +StorageObserver::Event::Event(const Filter& filter, + int64_t usage, + int64_t quota) + : filter(filter), usage(usage), quota(quota) {} bool StorageObserver::Event::operator==(const Event& other) const { return filter == other.filter && diff --git a/storage/browser/quota/storage_observer.h b/storage/browser/quota/storage_observer.h index 729dadd..37c886a 100644 --- a/storage/browser/quota/storage_observer.h +++ b/storage/browser/quota/storage_observer.h @@ -5,7 +5,8 @@ #ifndef STORAGE_BROWSER_QUOTA_STORAGE_OBSERVER_H_ #define STORAGE_BROWSER_QUOTA_STORAGE_OBSERVER_H_ -#include "base/basictypes.h" +#include <stdint.h> + #include "base/time/time.h" #include "storage/browser/quota/quota_client.h" #include "storage/common/quota/quota_types.h" @@ -57,13 +58,13 @@ class STORAGE_EXPORT StorageObserver { Filter filter; // The current usage corresponding to the filter. - int64 usage; + int64_t usage; // The quota corresponding to the filter. - int64 quota; + int64_t quota; Event(); - Event(const Filter& filter, int64 usage, int64 quota); + Event(const Filter& filter, int64_t usage, int64_t quota); bool operator==(const Event& other) const; }; diff --git a/storage/browser/quota/usage_tracker.cc b/storage/browser/quota/usage_tracker.cc index de9fbeb..7c96a24 100644 --- a/storage/browser/quota/usage_tracker.cc +++ b/storage/browser/quota/usage_tracker.cc @@ -4,6 +4,8 @@ #include "storage/browser/quota/usage_tracker.h" +#include <stdint.h> + #include <algorithm> #include "base/bind.h" @@ -16,8 +18,8 @@ namespace storage { namespace { void DidGetGlobalUsageForLimitedGlobalUsage(const UsageCallback& callback, - int64 total_global_usage, - int64 global_unlimited_usage) { + int64_t total_global_usage, + int64_t global_unlimited_usage) { callback.Run(total_global_usage - global_unlimited_usage); } @@ -129,15 +131,16 @@ void UsageTracker::GetHostUsage(const std::string& host, accumulator.Run(0); } -void UsageTracker::UpdateUsageCache( - QuotaClient::ID client_id, const GURL& origin, int64 delta) { +void UsageTracker::UpdateUsageCache(QuotaClient::ID client_id, + const GURL& origin, + int64_t delta) { ClientUsageTracker* client_tracker = GetClientTracker(client_id); DCHECK(client_tracker); client_tracker->UpdateUsageCache(origin, delta); } void UsageTracker::GetCachedHostsUsage( - std::map<std::string, int64>* host_usage) const { + std::map<std::string, int64_t>* host_usage) const { DCHECK(host_usage); host_usage->clear(); for (const auto& client_id_and_tracker : client_tracker_map_) @@ -145,7 +148,7 @@ void UsageTracker::GetCachedHostsUsage( } void UsageTracker::GetCachedOriginsUsage( - std::map<GURL, int64>* origin_usage) const { + std::map<GURL, int64_t>* origin_usage) const { DCHECK(origin_usage); origin_usage->clear(); for (const auto& client_id_and_tracker : client_tracker_map_) @@ -169,7 +172,7 @@ void UsageTracker::SetUsageCacheEnabled(QuotaClient::ID client_id, } void UsageTracker::AccumulateClientGlobalLimitedUsage(AccumulateInfo* info, - int64 limited_usage) { + int64_t limited_usage) { info->usage += limited_usage; if (--info->pending_clients) return; @@ -180,8 +183,8 @@ void UsageTracker::AccumulateClientGlobalLimitedUsage(AccumulateInfo* info, } void UsageTracker::AccumulateClientGlobalUsage(AccumulateInfo* info, - int64 usage, - int64 unlimited_usage) { + int64_t usage, + int64_t unlimited_usage) { info->usage += usage; info->unlimited_usage += unlimited_usage; if (--info->pending_clients) @@ -205,7 +208,7 @@ void UsageTracker::AccumulateClientGlobalUsage(AccumulateInfo* info, void UsageTracker::AccumulateClientHostUsage(AccumulateInfo* info, const std::string& host, - int64 usage) { + int64_t usage) { info->usage += usage; if (--info->pending_clients) return; diff --git a/storage/browser/quota/usage_tracker.h b/storage/browser/quota/usage_tracker.h index ed54fcc..e62b292 100644 --- a/storage/browser/quota/usage_tracker.h +++ b/storage/browser/quota/usage_tracker.h @@ -5,12 +5,14 @@ #ifndef STORAGE_BROWSER_QUOTA_USAGE_TRACKER_H_ #define STORAGE_BROWSER_QUOTA_USAGE_TRACKER_H_ +#include <stdint.h> + #include <map> #include <set> #include <string> -#include "base/basictypes.h" #include "base/callback.h" +#include "base/macros.h" #include "base/memory/scoped_ptr.h" #include "base/threading/non_thread_safe.h" #include "storage/browser/quota/quota_callbacks.h" @@ -44,9 +46,9 @@ class STORAGE_EXPORT UsageTracker : public QuotaTaskObserver { void GetHostUsage(const std::string& host, const UsageCallback& callback); void UpdateUsageCache(QuotaClient::ID client_id, const GURL& origin, - int64 delta); - void GetCachedOriginsUsage(std::map<GURL, int64>* origin_usage) const; - void GetCachedHostsUsage(std::map<std::string, int64>* host_usage) const; + int64_t delta); + void GetCachedOriginsUsage(std::map<GURL, int64_t>* origin_usage) const; + void GetCachedHostsUsage(std::map<std::string, int64_t>* host_usage) const; void GetCachedOrigins(std::set<GURL>* origins) const; bool IsWorking() const { return global_usage_callbacks_.HasCallbacks() || @@ -61,27 +63,27 @@ class STORAGE_EXPORT UsageTracker : public QuotaTaskObserver { struct AccumulateInfo { AccumulateInfo() : pending_clients(0), usage(0), unlimited_usage(0) {} int pending_clients; - int64 usage; - int64 unlimited_usage; + int64_t usage; + int64_t unlimited_usage; }; typedef std::map<QuotaClient::ID, ClientUsageTracker*> ClientTrackerMap; - typedef CallbackQueue<UsageCallback, int64> UsageCallbackQueue; - typedef CallbackQueue<GlobalUsageCallback, int64, int64> + typedef CallbackQueue<UsageCallback, int64_t> UsageCallbackQueue; + typedef CallbackQueue<GlobalUsageCallback, int64_t, int64_t> GlobalUsageCallbackQueue; - typedef CallbackQueueMap<UsageCallback, std::string, int64> + typedef CallbackQueueMap<UsageCallback, std::string, int64_t> HostUsageCallbackMap; friend class ClientUsageTracker; void AccumulateClientGlobalLimitedUsage(AccumulateInfo* info, - int64 limited_usage); + int64_t limited_usage); void AccumulateClientGlobalUsage(AccumulateInfo* info, - int64 usage, - int64 unlimited_usage); + int64_t usage, + int64_t unlimited_usage); void AccumulateClientHostUsage(AccumulateInfo* info, const std::string& host, - int64 usage); + int64_t usage); const StorageType type_; ClientTrackerMap client_tracker_map_; diff --git a/storage/common/blob_storage/blob_item_bytes_request.cc b/storage/common/blob_storage/blob_item_bytes_request.cc index fa5eb68..2f08772 100644 --- a/storage/common/blob_storage/blob_item_bytes_request.cc +++ b/storage/common/blob_storage/blob_item_bytes_request.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 "storage/common/blob_storage/blob_item_bytes_request.h" namespace storage { diff --git a/storage/common/blob_storage/blob_item_bytes_request.h b/storage/common/blob_storage/blob_item_bytes_request.h index 00d6d18..11a619c 100644 --- a/storage/common/blob_storage/blob_item_bytes_request.h +++ b/storage/common/blob_storage/blob_item_bytes_request.h @@ -5,10 +5,10 @@ #ifndef STORAGE_COMMON_BLOB_STORAGE_BLOB_ITEM_BYTES_REQUEST_H_ #define STORAGE_COMMON_BLOB_STORAGE_BLOB_ITEM_BYTES_REQUEST_H_ +#include <stddef.h> #include <stdint.h> #include <ostream> -#include "base/basictypes.h" #include "storage/common/blob_storage/blob_storage_constants.h" #include "storage/common/storage_common_export.h" diff --git a/storage/common/blob_storage/blob_item_bytes_response.cc b/storage/common/blob_storage/blob_item_bytes_response.cc index 8e81dc6..40c0781 100644 --- a/storage/common/blob_storage/blob_item_bytes_response.cc +++ b/storage/common/blob_storage/blob_item_bytes_response.cc @@ -4,6 +4,8 @@ #include "storage/common/blob_storage/blob_item_bytes_response.h" +#include <stddef.h> + #include <algorithm> #include <string> diff --git a/storage/common/blob_storage/blob_item_bytes_response.h b/storage/common/blob_storage/blob_item_bytes_response.h index 344cc7d..189313f 100644 --- a/storage/common/blob_storage/blob_item_bytes_response.h +++ b/storage/common/blob_storage/blob_item_bytes_response.h @@ -5,12 +5,12 @@ #ifndef STORAGE_COMMON_BLOB_STORAGE_BLOB_ITEM_BYTES_RESPONSE_H_ #define STORAGE_COMMON_BLOB_STORAGE_BLOB_ITEM_BYTES_RESPONSE_H_ +#include <stddef.h> #include <stdint.h> #include <algorithm> #include <ostream> #include <vector> -#include "base/basictypes.h" #include "storage/common/storage_common_export.h" namespace storage { diff --git a/storage/common/blob_storage/blob_storage_constants.h b/storage/common/blob_storage/blob_storage_constants.h index ddf97ec..e77c868 100644 --- a/storage/common/blob_storage/blob_storage_constants.h +++ b/storage/common/blob_storage/blob_storage_constants.h @@ -5,11 +5,14 @@ #ifndef STORAGE_COMMON_BLOB_STORAGE_BLOB_STORAGE_CONSTANTS_H_ #define STORAGE_COMMON_BLOB_STORAGE_BLOB_STORAGE_CONSTANTS_H_ +#include <stddef.h> +#include <stdint.h> + namespace storage { // TODO(michaeln): use base::SysInfo::AmountOfPhysicalMemoryMB() in some // way to come up with a better limit. -const int64 kBlobStorageMaxMemoryUsage = 500 * 1024 * 1024; // Half a gig. +const int64_t kBlobStorageMaxMemoryUsage = 500 * 1024 * 1024; // Half a gig. const size_t kBlobStorageIPCThresholdBytes = 250 * 1024; const size_t kBlobStorageMaxSharedMemoryBytes = 10 * 1024 * 1024; const uint64_t kBlobStorageMaxFileSizeBytes = 100 * 1024 * 1024; diff --git a/storage/common/data_element.cc b/storage/common/data_element.cc index 8b1fc4d..821badb 100644 --- a/storage/common/data_element.cc +++ b/storage/common/data_element.cc @@ -4,6 +4,9 @@ #include "storage/common/data_element.h" +#include <stddef.h> +#include <stdint.h> + #include <algorithm> #include "base/strings/string_number_conversions.h" diff --git a/storage/common/data_element.h b/storage/common/data_element.h index 2e9ce9c..2f28c40 100644 --- a/storage/common/data_element.h +++ b/storage/common/data_element.h @@ -5,6 +5,7 @@ #ifndef STORAGE_COMMON_DATA_ELEMENT_H_ #define STORAGE_COMMON_DATA_ELEMENT_H_ +#include <stddef.h> #include <stdint.h> #include <limits> diff --git a/storage/common/database/database_connections.cc b/storage/common/database/database_connections.cc index 35bc139..aa82d1e 100644 --- a/storage/common/database/database_connections.cc +++ b/storage/common/database/database_connections.cc @@ -4,6 +4,8 @@ #include "storage/common/database/database_connections.h" +#include <stdint.h> + #include "base/auto_reset.h" #include "base/bind.h" #include "base/logging.h" @@ -74,7 +76,7 @@ void DatabaseConnections::RemoveConnections( } } -int64 DatabaseConnections::GetOpenDatabaseSize( +int64_t DatabaseConnections::GetOpenDatabaseSize( const std::string& origin_identifier, const base::string16& database_name) const { DCHECK(IsDatabaseOpened(origin_identifier, database_name)); @@ -84,7 +86,7 @@ int64 DatabaseConnections::GetOpenDatabaseSize( void DatabaseConnections::SetOpenDatabaseSize( const std::string& origin_identifier, const base::string16& database_name, - int64 size) { + int64_t size) { DCHECK(IsDatabaseOpened(origin_identifier, database_name)); connections_[origin_identifier][database_name].second = size; } diff --git a/storage/common/database/database_connections.h b/storage/common/database/database_connections.h index ec36b0f..fe66ac2 100644 --- a/storage/common/database/database_connections.h +++ b/storage/common/database/database_connections.h @@ -5,6 +5,8 @@ #ifndef STORAGE_COMMON_DATABASE_DATABASE_CONNECTIONS_H_ #define STORAGE_COMMON_DATABASE_DATABASE_CONNECTIONS_H_ +#include <stdint.h> + #include <map> #include <string> #include <vector> @@ -46,11 +48,11 @@ class STORAGE_COMMON_EXPORT DatabaseConnections { std::vector<std::pair<std::string, base::string16> >* closed_dbs); // Database sizes can be kept only if IsDatabaseOpened returns true. - int64 GetOpenDatabaseSize(const std::string& origin_identifier, - const base::string16& database_name) const; + int64_t GetOpenDatabaseSize(const std::string& origin_identifier, + const base::string16& database_name) const; void SetOpenDatabaseSize(const std::string& origin_identifier, const base::string16& database_name, - int64 size); + int64_t size); // Returns a list of the connections, <origin_id, name>. void ListConnections( @@ -58,7 +60,7 @@ class STORAGE_COMMON_EXPORT DatabaseConnections { private: // Mapping from name to <openCount, size> - typedef std::map<base::string16, std::pair<int, int64> > DBConnections; + typedef std::map<base::string16, std::pair<int, int64_t>> DBConnections; typedef std::map<std::string, DBConnections> OriginConnections; mutable OriginConnections connections_; // mutable for GetOpenDatabaseSize diff --git a/storage/common/database/database_identifier.cc b/storage/common/database/database_identifier.cc index 094e01f..2c1aa55 100644 --- a/storage/common/database/database_identifier.cc +++ b/storage/common/database/database_identifier.cc @@ -4,6 +4,9 @@ #include "storage/common/database/database_identifier.h" +#include <stddef.h> + +#include "base/macros.h" #include "base/strings/string_number_conversions.h" #include "base/strings/string_util.h" #include "url/url_canon.h" diff --git a/storage/common/database/database_identifier.h b/storage/common/database/database_identifier.h index a658ade..a37e2ad 100644 --- a/storage/common/database/database_identifier.h +++ b/storage/common/database/database_identifier.h @@ -7,7 +7,6 @@ #include <string> -#include "base/basictypes.h" #include "base/strings/string_piece.h" #include "storage/common/storage_common_export.h" #include "url/gurl.h" diff --git a/storage/common/fileapi/directory_entry.h b/storage/common/fileapi/directory_entry.h index fab7fae..0f86030 100644 --- a/storage/common/fileapi/directory_entry.h +++ b/storage/common/fileapi/directory_entry.h @@ -7,7 +7,6 @@ #include <string> -#include "base/basictypes.h" #include "base/files/file_path.h" #include "base/time/time.h" #include "storage/common/storage_common_export.h" diff --git a/storage/common/fileapi/file_system_util.cc b/storage/common/fileapi/file_system_util.cc index 16d74e4..4ce1657 100644 --- a/storage/common/fileapi/file_system_util.cc +++ b/storage/common/fileapi/file_system_util.cc @@ -4,9 +4,12 @@ #include "storage/common/fileapi/file_system_util.h" +#include <stddef.h> + #include <algorithm> #include "base/logging.h" +#include "base/macros.h" #include "base/strings/string_util.h" #include "base/strings/sys_string_conversions.h" #include "base/strings/utf_string_conversions.h" |