0

[HttpCache] Clarify some names

Makes the names of a couple of functions clearer.

Change-Id: I8c7923f62b691b3cf93642e54f4afd8cb257c01f
Reviewed-on: https://chromium-review.googlesource.com/937924
Reviewed-by: Shivani Sharma <shivanisha@chromium.org>
Commit-Queue: Josh Karlin <jkarlin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#539463}
This commit is contained in:
Josh Karlin
2018-02-27 16:58:26 +00:00
committed by Commit Bot
parent 7623355495
commit a01cb6f00f
2 changed files with 13 additions and 12 deletions

@ -239,10 +239,10 @@ bool HttpCache::Writers::CanAddWriters(ParallelWritingPattern* reason) {
void HttpCache::Writers::ProcessFailure(int error) {
// Notify waiting_for_read_ of the failure. Tasks will be posted for all the
// transactions.
ProcessWaitingForReadTransactions(error);
CompleteWaitingForReadTransactions(error);
// Idle readers should fail when Read is invoked on them.
SetIdleWritersFailState(error);
RemoveIdleWriters(error);
}
void HttpCache::Writers::TruncateEntry() {
@ -477,7 +477,7 @@ void HttpCache::Writers::OnDataReceived(int result) {
if (active_transaction_)
EraseTransaction(active_transaction_, result);
active_transaction_ = nullptr;
ProcessWaitingForReadTransactions(write_len_);
CompleteWaitingForReadTransactions(write_len_);
// Invoke entry processing.
DCHECK(ContainsOnlyIdleWriters());
@ -491,7 +491,7 @@ void HttpCache::Writers::OnDataReceived(int result) {
// Notify waiting_for_read_. Tasks will be posted for all the
// transactions.
ProcessWaitingForReadTransactions(write_len_);
CompleteWaitingForReadTransactions(write_len_);
active_transaction_ = nullptr;
}
@ -514,7 +514,7 @@ void HttpCache::Writers::OnCacheWriteFailure() {
}
}
void HttpCache::Writers::ProcessWaitingForReadTransactions(int result) {
void HttpCache::Writers::CompleteWaitingForReadTransactions(int result) {
for (auto it = waiting_for_read_.begin(); it != waiting_for_read_.end();) {
Transaction* transaction = it->first;
int callback_result = result;
@ -540,7 +540,7 @@ void HttpCache::Writers::ProcessWaitingForReadTransactions(int result) {
}
}
void HttpCache::Writers::SetIdleWritersFailState(int result) {
void HttpCache::Writers::RemoveIdleWriters(int result) {
// Since this is only for idle transactions, waiting_for_read_
// should be empty.
DCHECK(waiting_for_read_.empty());

@ -190,13 +190,14 @@ class NET_EXPORT_PRIVATE HttpCache::Writers {
void OnCacheWriteFailure();
void OnDataReceived(int result);
// Notifies the transactions waiting on Read of the result, by posting a task
// for each of them.
void ProcessWaitingForReadTransactions(int result);
// Completes any pending IO_PENDING read operations by copying any received
// bytes from read_buf_ to the given buffer and posts a task to run the
// callback with |result|.
void CompleteWaitingForReadTransactions(int result);
// Sets the state to FAIL_READ so that any subsequent Read on an idle
// transaction fails.
void SetIdleWritersFailState(int result);
// Removes idle writers, passing |result| which is to be used for any
// subsequent read transaction.
void RemoveIdleWriters(int result);
// Invoked when |active_transaction_| fails to read from network or write to
// cache. |error| indicates network read error code or cache write error.