Commit 9558bf09 authored by Victor Costan's avatar Victor Costan Committed by Commit Bot

AppCache: Clean up AppCacheDiskCache::PendingCall.

This CL has no functional changes.

The following cleanups were applied.

1) Made data members were const where applicable.
2) Added explicit {copy,move} {constructor,assignment} declarations.
3) Removed unnecessary default constructor.
4) Applied clang-tidy suggestion for push_back() -> emplace_back().

Change-Id: I5d3c55280f4a6020a743096cf603d90b135e875e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2464979
Auto-Submit: Victor Costan <pwnall@chromium.org>
Reviewed-by: default avatarenne <enne@chromium.org>
Commit-Queue: enne <enne@chromium.org>
Cr-Commit-Position: refs/heads/master@{#817168}
parent 6e5972c8
...@@ -252,8 +252,7 @@ net::Error AppCacheDiskCache::CreateEntry( ...@@ -252,8 +252,7 @@ net::Error AppCacheDiskCache::CreateEntry(
return net::ERR_ABORTED; return net::ERR_ABORTED;
if (is_initializing_or_waiting_to_initialize()) { if (is_initializing_or_waiting_to_initialize()) {
pending_calls_.push_back( pending_calls_.emplace_back(CREATE, key, entry, std::move(callback));
PendingCall(CREATE, key, entry, std::move(callback)));
return net::ERR_IO_PENDING; return net::ERR_IO_PENDING;
} }
...@@ -273,8 +272,7 @@ net::Error AppCacheDiskCache::OpenEntry(int64_t key, ...@@ -273,8 +272,7 @@ net::Error AppCacheDiskCache::OpenEntry(int64_t key,
return net::ERR_ABORTED; return net::ERR_ABORTED;
if (is_initializing_or_waiting_to_initialize()) { if (is_initializing_or_waiting_to_initialize()) {
pending_calls_.push_back( pending_calls_.emplace_back(OPEN, key, entry, std::move(callback));
PendingCall(OPEN, key, entry, std::move(callback)));
return net::ERR_IO_PENDING; return net::ERR_IO_PENDING;
} }
...@@ -292,8 +290,7 @@ net::Error AppCacheDiskCache::DoomEntry(int64_t key, ...@@ -292,8 +290,7 @@ net::Error AppCacheDiskCache::DoomEntry(int64_t key,
return net::ERR_ABORTED; return net::ERR_ABORTED;
if (is_initializing_or_waiting_to_initialize()) { if (is_initializing_or_waiting_to_initialize()) {
pending_calls_.push_back( pending_calls_.emplace_back(DOOM, key, nullptr, std::move(callback));
PendingCall(DOOM, key, nullptr, std::move(callback)));
return net::ERR_IO_PENDING; return net::ERR_IO_PENDING;
} }
...@@ -313,9 +310,6 @@ AppCacheDiskCache::AppCacheDiskCache(bool use_simple_cache) ...@@ -313,9 +310,6 @@ AppCacheDiskCache::AppCacheDiskCache(bool use_simple_cache)
is_disabled_(false), is_disabled_(false),
is_waiting_to_initialize_(false) {} is_waiting_to_initialize_(false) {}
AppCacheDiskCache::PendingCall::PendingCall()
: call_type(CREATE), key(0), entry(nullptr) {}
AppCacheDiskCache::PendingCall::PendingCall( AppCacheDiskCache::PendingCall::PendingCall(
PendingCallType call_type, PendingCallType call_type,
int64_t key, int64_t key,
...@@ -326,7 +320,7 @@ AppCacheDiskCache::PendingCall::PendingCall( ...@@ -326,7 +320,7 @@ AppCacheDiskCache::PendingCall::PendingCall(
entry(entry), entry(entry),
callback(std::move(callback)) {} callback(std::move(callback)) {}
AppCacheDiskCache::PendingCall::PendingCall(PendingCall&& other) = default; AppCacheDiskCache::PendingCall::PendingCall(PendingCall&&) = default;
AppCacheDiskCache::PendingCall::~PendingCall() = default; AppCacheDiskCache::PendingCall::~PendingCall() = default;
......
...@@ -112,18 +112,21 @@ class CONTENT_EXPORT AppCacheDiskCache { ...@@ -112,18 +112,21 @@ class CONTENT_EXPORT AppCacheDiskCache {
DOOM DOOM
}; };
struct PendingCall { struct PendingCall {
PendingCall();
PendingCall(PendingCallType call_type, PendingCall(PendingCallType call_type,
int64_t key, int64_t key,
AppCacheDiskCacheEntry** entry, AppCacheDiskCacheEntry** entry,
net::CompletionOnceCallback callback); net::CompletionOnceCallback callback);
PendingCall(PendingCall&& other);
PendingCall(const PendingCall&) = delete;
PendingCall& operator=(const PendingCall&) = delete;
PendingCall(PendingCall&&);
PendingCall& operator=(PendingCall&&) = delete;
~PendingCall(); ~PendingCall();
PendingCallType call_type; const PendingCallType call_type;
int64_t key; const int64_t key;
AppCacheDiskCacheEntry** entry; AppCacheDiskCacheEntry** const entry;
net::CompletionOnceCallback callback; net::CompletionOnceCallback callback;
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment