diff options
author | avi <avi@chromium.org> | 2015-12-10 11:41:47 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-12-10 19:42:59 +0000 |
commit | d0181f31d10f5126e836fd38bd6bf54d4c4d4872 (patch) | |
tree | f94d6cc687a74cb9998e031a6de03a15d07f3fe5 /content/browser/appcache | |
parent | 2040edbe49bb9dd7dc188607867136c048f9511e (diff) | |
download | chromium_src-d0181f31d10f5126e836fd38bd6bf54d4c4d4872.zip chromium_src-d0181f31d10f5126e836fd38bd6bf54d4c4d4872.tar.gz chromium_src-d0181f31d10f5126e836fd38bd6bf54d4c4d4872.tar.bz2 |
Remove kint32max.
BUG=138542, 488550
Review URL: https://codereview.chromium.org/1499423004
Cr-Commit-Position: refs/heads/master@{#364429}
Diffstat (limited to 'content/browser/appcache')
-rw-r--r-- | content/browser/appcache/appcache_disk_cache.cc | 40 | ||||
-rw-r--r-- | content/browser/appcache/appcache_disk_cache.h | 16 | ||||
-rw-r--r-- | content/browser/appcache/appcache_response.cc | 48 | ||||
-rw-r--r-- | content/browser/appcache/appcache_response.h | 63 |
4 files changed, 95 insertions, 72 deletions
diff --git a/content/browser/appcache/appcache_disk_cache.cc b/content/browser/appcache/appcache_disk_cache.cc index 8419e11..f7cbc58 100644 --- a/content/browser/appcache/appcache_disk_cache.cc +++ b/content/browser/appcache/appcache_disk_cache.cc @@ -4,6 +4,8 @@ #include "content/browser/appcache/appcache_disk_cache.h" +#include <limits> + #include "base/bind.h" #include "base/bind_helpers.h" #include "base/files/file_path.h" @@ -61,11 +63,11 @@ class AppCacheDiskCache::EntryImpl : public Entry { // Entry implementation. int Read(int index, - int64 offset, + int64_t offset, net::IOBuffer* buf, int buf_len, const net::CompletionCallback& callback) override { - if (offset < 0 || offset > kint32max) + if (offset < 0 || offset > std::numeric_limits<int32_t>::max()) return net::ERR_INVALID_ARGUMENT; if (!disk_cache_entry_) return net::ERR_ABORTED; @@ -74,11 +76,11 @@ class AppCacheDiskCache::EntryImpl : public Entry { } int Write(int index, - int64 offset, + int64_t offset, net::IOBuffer* buf, int buf_len, const net::CompletionCallback& callback) override { - if (offset < 0 || offset > kint32max) + if (offset < 0 || offset > std::numeric_limits<int32_t>::max()) return net::ERR_INVALID_ARGUMENT; if (!disk_cache_entry_) return net::ERR_ABORTED; @@ -87,7 +89,7 @@ class AppCacheDiskCache::EntryImpl : public Entry { index, static_cast<int>(offset), buf, buf_len, callback, kTruncate); } - int64 GetSize(int index) override { + int64_t GetSize(int index) override { return disk_cache_entry_ ? disk_cache_entry_->GetDataSize(index) : 0L; } @@ -119,7 +121,8 @@ class AppCacheDiskCache::ActiveCall : public base::RefCounted<AppCacheDiskCache::ActiveCall> { public: static int CreateEntry(const base::WeakPtr<AppCacheDiskCache>& owner, - int64 key, Entry** entry, + int64_t key, + Entry** entry, const net::CompletionCallback& callback) { scoped_refptr<ActiveCall> active_call( new ActiveCall(owner, entry, callback)); @@ -130,7 +133,8 @@ class AppCacheDiskCache::ActiveCall } static int OpenEntry(const base::WeakPtr<AppCacheDiskCache>& owner, - int64 key, Entry** entry, + int64_t key, + Entry** entry, const net::CompletionCallback& callback) { scoped_refptr<ActiveCall> active_call( new ActiveCall(owner, entry, callback)); @@ -141,7 +145,8 @@ class AppCacheDiskCache::ActiveCall } static int DoomEntry(const base::WeakPtr<AppCacheDiskCache>& owner, - int64 key, const net::CompletionCallback& callback) { + int64_t key, + const net::CompletionCallback& callback) { scoped_refptr<ActiveCall> active_call( new ActiveCall(owner, nullptr, callback)); int rv = owner->disk_cache()->DoomEntry( @@ -253,7 +258,8 @@ void AppCacheDiskCache::Disable() { disk_cache_.reset(); } -int AppCacheDiskCache::CreateEntry(int64 key, Entry** entry, +int AppCacheDiskCache::CreateEntry(int64_t key, + Entry** entry, const net::CompletionCallback& callback) { DCHECK(entry); DCHECK(!callback.is_null()); @@ -272,7 +278,8 @@ int AppCacheDiskCache::CreateEntry(int64 key, Entry** entry, weak_factory_.GetWeakPtr(), key, entry, callback); } -int AppCacheDiskCache::OpenEntry(int64 key, Entry** entry, +int AppCacheDiskCache::OpenEntry(int64_t key, + Entry** entry, const net::CompletionCallback& callback) { DCHECK(entry); DCHECK(!callback.is_null()); @@ -291,7 +298,7 @@ int AppCacheDiskCache::OpenEntry(int64 key, Entry** entry, weak_factory_.GetWeakPtr(), key, entry, callback); } -int AppCacheDiskCache::DoomEntry(int64 key, +int AppCacheDiskCache::DoomEntry(int64_t key, const net::CompletionCallback& callback) { DCHECK(!callback.is_null()); if (is_disabled_) @@ -321,15 +328,12 @@ AppCacheDiskCache::PendingCall::PendingCall() entry(NULL) { } -AppCacheDiskCache::PendingCall::PendingCall(PendingCallType call_type, - int64 key, +AppCacheDiskCache::PendingCall::PendingCall( + PendingCallType call_type, + int64_t key, Entry** entry, const net::CompletionCallback& callback) - : call_type(call_type), - key(key), - entry(entry), - callback(callback) { -} + : call_type(call_type), key(key), entry(entry), callback(callback) {} AppCacheDiskCache::PendingCall::~PendingCall() {} diff --git a/content/browser/appcache/appcache_disk_cache.h b/content/browser/appcache/appcache_disk_cache.h index 98ac3c0..2b8c299 100644 --- a/content/browser/appcache/appcache_disk_cache.h +++ b/content/browser/appcache/appcache_disk_cache.h @@ -5,6 +5,8 @@ #ifndef CONTENT_BROWSER_APPCACHE_APPCACHE_DISK_CACHE_H_ #define CONTENT_BROWSER_APPCACHE_APPCACHE_DISK_CACHE_H_ +#include <stdint.h> + #include <set> #include <vector> @@ -44,13 +46,13 @@ class CONTENT_EXPORT AppCacheDiskCache void Disable(); bool is_disabled() const { return is_disabled_; } - int CreateEntry(int64 key, + int CreateEntry(int64_t key, Entry** entry, const net::CompletionCallback& callback) override; - int OpenEntry(int64 key, + int OpenEntry(int64_t key, Entry** entry, const net::CompletionCallback& callback) override; - int DoomEntry(int64 key, const net::CompletionCallback& callback) override; + int DoomEntry(int64_t key, const net::CompletionCallback& callback) override; void set_is_waiting_to_initialize(bool is_waiting_to_initialize) { is_waiting_to_initialize_ = is_waiting_to_initialize; @@ -76,14 +78,16 @@ class CONTENT_EXPORT AppCacheDiskCache }; struct PendingCall { PendingCallType call_type; - int64 key; + int64_t key; Entry** entry; net::CompletionCallback callback; PendingCall(); - PendingCall(PendingCallType call_type, int64 key, - Entry** entry, const net::CompletionCallback& callback); + PendingCall(PendingCallType call_type, + int64_t key, + Entry** entry, + const net::CompletionCallback& callback); ~PendingCall(); }; diff --git a/content/browser/appcache/appcache_response.cc b/content/browser/appcache/appcache_response.cc index 014ecfe..eef2454 100644 --- a/content/browser/appcache/appcache_response.cc +++ b/content/browser/appcache/appcache_response.cc @@ -47,12 +47,15 @@ class WrappedPickleIOBuffer : public net::WrappedIOBuffer { // AppCacheResponseInfo ---------------------------------------------- -AppCacheResponseInfo::AppCacheResponseInfo( - AppCacheStorage* storage, const GURL& manifest_url, - int64 response_id, net::HttpResponseInfo* http_info, - int64 response_data_size) - : manifest_url_(manifest_url), response_id_(response_id), - http_response_info_(http_info), response_data_size_(response_data_size), +AppCacheResponseInfo::AppCacheResponseInfo(AppCacheStorage* storage, + const GURL& manifest_url, + int64_t response_id, + net::HttpResponseInfo* http_info, + int64_t response_data_size) + : manifest_url_(manifest_url), + response_id_(response_id), + http_response_info_(http_info), + response_data_size_(response_data_size), storage_(storage) { DCHECK(http_info); DCHECK(response_id != kAppCacheNoResponseId); @@ -75,15 +78,15 @@ HttpResponseInfoIOBuffer::~HttpResponseInfoIOBuffer() {} // AppCacheResponseIO ---------------------------------------------- -AppCacheResponseIO::AppCacheResponseIO( - int64 response_id, int64 group_id, AppCacheDiskCacheInterface* disk_cache) +AppCacheResponseIO::AppCacheResponseIO(int64_t response_id, + int64_t group_id, + AppCacheDiskCacheInterface* disk_cache) : response_id_(response_id), group_id_(group_id), disk_cache_(disk_cache), entry_(NULL), buffer_len_(0), - weak_factory_(this) { -} + weak_factory_(this) {} AppCacheResponseIO::~AppCacheResponseIO() { if (entry_) @@ -170,16 +173,15 @@ void AppCacheResponseIO::OpenEntryCallback( // AppCacheResponseReader ---------------------------------------------- AppCacheResponseReader::AppCacheResponseReader( - int64 response_id, - int64 group_id, + int64_t response_id, + int64_t group_id, AppCacheDiskCacheInterface* disk_cache) : AppCacheResponseIO(response_id, group_id, disk_cache), range_offset_(0), - range_length_(kint32max), + range_length_(std::numeric_limits<int32_t>::max()), read_position_(0), reading_metadata_size_(0), - weak_factory_(this) { -} + weak_factory_(this) {} AppCacheResponseReader::~AppCacheResponseReader() { } @@ -266,7 +268,7 @@ void AppCacheResponseReader::OnIOComplete(int result) { info_buffer_->response_data_size = entry_->GetSize(kResponseContentIndex); - int64 metadata_size = entry_->GetSize(kResponseMetadataIndex); + int64_t metadata_size = entry_->GetSize(kResponseMetadataIndex); if (metadata_size > 0) { reading_metadata_size_ = metadata_size; info_buffer_->http_info->metadata = new net::IOBufferWithSize( @@ -296,14 +298,15 @@ void AppCacheResponseReader::OnOpenEntryComplete() { // AppCacheResponseWriter ---------------------------------------------- AppCacheResponseWriter::AppCacheResponseWriter( - int64 response_id, int64 group_id, AppCacheDiskCacheInterface* disk_cache) + int64_t response_id, + int64_t group_id, + AppCacheDiskCacheInterface* disk_cache) : AppCacheResponseIO(response_id, group_id, disk_cache), info_size_(0), write_position_(0), write_amount_(0), creation_phase_(INITIAL_ATTEMPT), - weak_factory_(this) { -} + weak_factory_(this) {} AppCacheResponseWriter::~AppCacheResponseWriter() { } @@ -437,13 +440,12 @@ void AppCacheResponseWriter::OnCreateEntryComplete( // AppCacheResponseMetadataWriter ---------------------------------------------- AppCacheResponseMetadataWriter::AppCacheResponseMetadataWriter( - int64 response_id, - int64 group_id, + int64_t response_id, + int64_t group_id, AppCacheDiskCacheInterface* disk_cache) : AppCacheResponseIO(response_id, group_id, disk_cache), write_amount_(0), - weak_factory_(this) { -} + weak_factory_(this) {} AppCacheResponseMetadataWriter::~AppCacheResponseMetadataWriter() { } diff --git a/content/browser/appcache/appcache_response.h b/content/browser/appcache/appcache_response.h index a4c87db..8543b2b 100644 --- a/content/browser/appcache/appcache_response.h +++ b/content/browser/appcache/appcache_response.h @@ -5,6 +5,8 @@ #ifndef CONTENT_BROWSER_APPCACHE_APPCACHE_RESPONSE_H_ #define CONTENT_BROWSER_APPCACHE_APPCACHE_RESPONSE_H_ +#include <stdint.h> + #include "base/compiler_specific.h" #include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" @@ -31,25 +33,27 @@ class CONTENT_EXPORT AppCacheResponseInfo : public base::RefCounted<AppCacheResponseInfo> { public: // AppCacheResponseInfo takes ownership of the http_info. - AppCacheResponseInfo(AppCacheStorage* storage, const GURL& manifest_url, - int64 response_id, net::HttpResponseInfo* http_info, - int64 response_data_size); + AppCacheResponseInfo(AppCacheStorage* storage, + const GURL& manifest_url, + int64_t response_id, + net::HttpResponseInfo* http_info, + int64_t response_data_size); const GURL& manifest_url() const { return manifest_url_; } - int64 response_id() const { return response_id_; } + int64_t response_id() const { return response_id_; } const net::HttpResponseInfo* http_response_info() const { return http_response_info_.get(); } - int64 response_data_size() const { return response_data_size_; } + int64_t response_data_size() const { return response_data_size_; } private: friend class base::RefCounted<AppCacheResponseInfo>; virtual ~AppCacheResponseInfo(); const GURL manifest_url_; - const int64 response_id_; + const int64_t response_id_; const scoped_ptr<net::HttpResponseInfo> http_response_info_; - const int64 response_data_size_; + const int64_t response_data_size_; AppCacheStorage* storage_; }; @@ -73,21 +77,30 @@ class CONTENT_EXPORT AppCacheDiskCacheInterface { public: class Entry { public: - virtual int Read(int index, int64 offset, net::IOBuffer* buf, int buf_len, + virtual int Read(int index, + int64_t offset, + net::IOBuffer* buf, + int buf_len, const net::CompletionCallback& callback) = 0; - virtual int Write(int index, int64 offset, net::IOBuffer* buf, int buf_len, + virtual int Write(int index, + int64_t offset, + net::IOBuffer* buf, + int buf_len, const net::CompletionCallback& callback) = 0; - virtual int64 GetSize(int index) = 0; + virtual int64_t GetSize(int index) = 0; virtual void Close() = 0; protected: virtual ~Entry() {} }; - virtual int CreateEntry(int64 key, Entry** entry, + virtual int CreateEntry(int64_t key, + Entry** entry, const net::CompletionCallback& callback) = 0; - virtual int OpenEntry(int64 key, Entry** entry, + virtual int OpenEntry(int64_t key, + Entry** entry, + const net::CompletionCallback& callback) = 0; + virtual int DoomEntry(int64_t key, const net::CompletionCallback& callback) = 0; - virtual int DoomEntry(int64 key, const net::CompletionCallback& callback) = 0; protected: friend class base::RefCounted<AppCacheDiskCacheInterface>; @@ -98,11 +111,11 @@ class CONTENT_EXPORT AppCacheDiskCacheInterface { class CONTENT_EXPORT AppCacheResponseIO { public: virtual ~AppCacheResponseIO(); - int64 response_id() const { return response_id_; } + int64_t response_id() const { return response_id_; } protected: - AppCacheResponseIO(int64 response_id, - int64 group_id, + AppCacheResponseIO(int64_t response_id, + int64_t group_id, AppCacheDiskCacheInterface* disk_cache); virtual void OnIOComplete(int result) = 0; @@ -115,8 +128,8 @@ class CONTENT_EXPORT AppCacheResponseIO { void WriteRaw(int index, int offset, net::IOBuffer* buf, int buf_len); void OpenEntryIfNeeded(); - const int64 response_id_; - const int64 group_id_; + const int64_t response_id_; + const int64_t group_id_; AppCacheDiskCacheInterface* disk_cache_; AppCacheDiskCacheInterface::Entry* entry_; scoped_refptr<HttpResponseInfoIOBuffer> info_buffer_; @@ -177,8 +190,8 @@ class CONTENT_EXPORT AppCacheResponseReader friend class content::MockAppCacheStorage; // Should only be constructed by the storage class and derivatives. - AppCacheResponseReader(int64 response_id, - int64 group_id, + AppCacheResponseReader(int64_t response_id, + int64_t group_id, AppCacheDiskCacheInterface* disk_cache); void OnIOComplete(int result) override; @@ -230,12 +243,12 @@ class CONTENT_EXPORT AppCacheResponseWriter bool IsWritePending() { return IsIOPending(); } // Returns the amount written, info and data. - int64 amount_written() { return info_size_ + write_position_; } + int64_t amount_written() { return info_size_ + write_position_; } protected: // Should only be constructed by the storage class and derivatives. - AppCacheResponseWriter(int64 response_id, - int64 group_id, + AppCacheResponseWriter(int64_t response_id, + int64_t group_id, AppCacheDiskCacheInterface* disk_cache); private: @@ -292,8 +305,8 @@ class CONTENT_EXPORT AppCacheResponseMetadataWriter friend class AppCacheStorageImpl; friend class content::MockAppCacheStorage; // Should only be constructed by the storage class and derivatives. - AppCacheResponseMetadataWriter(int64 response_id, - int64 group_id, + AppCacheResponseMetadataWriter(int64_t response_id, + int64_t group_id, AppCacheDiskCacheInterface* disk_cache); private: |