Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(346)

Unified Diff: net/http/http_cache_transaction.cc

Issue 1080673004: Remove network load flags not used in net/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed errors due to missing changes. Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/base/load_flags_list.h ('k') | net/http/http_cache_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http/http_cache_transaction.cc
diff --git a/net/http/http_cache_transaction.cc b/net/http/http_cache_transaction.cc
index 24de37ab5e571309c53dfe1dddd8e18a107a454c..83fea07d93aa80bef7b901b0e854223586d7109d 100644
--- a/net/http/http_cache_transaction.cc
+++ b/net/http/http_cache_transaction.cc
@@ -173,50 +173,6 @@ bool NonErrorResponse(int status_code) {
return status_code_range == 2 || status_code_range == 3;
}
-// Error codes that will be considered indicative of a page being offline/
-// unreachable for LOAD_FROM_CACHE_IF_OFFLINE.
-bool IsOfflineError(int error) {
- return (
- error == ERR_NAME_NOT_RESOLVED || error == ERR_INTERNET_DISCONNECTED ||
- error == ERR_ADDRESS_UNREACHABLE || error == ERR_CONNECTION_TIMED_OUT);
-}
-
-// Enum for UMA, indicating the status (with regard to offline mode) of
-// a particular request.
-enum RequestOfflineStatus {
- // A cache transaction hit in cache (data was present and not stale)
- // and returned it.
- OFFLINE_STATUS_FRESH_CACHE,
-
- // A network request was required for a cache entry, and it succeeded.
- OFFLINE_STATUS_NETWORK_SUCCEEDED,
-
- // A network request was required for a cache entry, and it failed with
- // a non-offline error.
- OFFLINE_STATUS_NETWORK_FAILED,
-
- // A network request was required for a cache entry, it failed with an
- // offline error, and we could serve stale data if
- // LOAD_FROM_CACHE_IF_OFFLINE was set.
- OFFLINE_STATUS_DATA_AVAILABLE_OFFLINE,
-
- // A network request was required for a cache entry, it failed with
- // an offline error, and there was no servable data in cache (even
- // stale data).
- OFFLINE_STATUS_DATA_UNAVAILABLE_OFFLINE,
-
- OFFLINE_STATUS_MAX_ENTRIES
-};
-
-void RecordOfflineStatus(int load_flags, RequestOfflineStatus status) {
- // Restrict to main frame to keep statistics close to
- // "would have shown them something useful if offline mode was enabled".
- if (load_flags & LOAD_MAIN_FRAME) {
- UMA_HISTOGRAM_ENUMERATION("HttpCache.OfflineStatus", status,
- OFFLINE_STATUS_MAX_ENTRIES);
- }
-}
-
void RecordNoStoreHeaderHistogram(int load_flags,
const HttpResponseInfo* response) {
if (load_flags & LOAD_MAIN_FRAME) {
@@ -1115,28 +1071,6 @@ int HttpCache::Transaction::DoSendRequestComplete(int result) {
if (!cache_.get())
return ERR_UNEXPECTED;
- // If requested, and we have a readable cache entry, and we have
- // an error indicating that we're offline as opposed to in contact
- // with a bad server, read from cache anyway.
- if (IsOfflineError(result)) {
- if (mode_ == READ_WRITE && entry_ && !partial_) {
- RecordOfflineStatus(effective_load_flags_,
- OFFLINE_STATUS_DATA_AVAILABLE_OFFLINE);
- if (effective_load_flags_ & LOAD_FROM_CACHE_IF_OFFLINE) {
- UpdateTransactionPattern(PATTERN_NOT_COVERED);
- response_.server_data_unavailable = true;
- return SetupEntryForRead();
- }
- } else {
- RecordOfflineStatus(effective_load_flags_,
- OFFLINE_STATUS_DATA_UNAVAILABLE_OFFLINE);
- }
- } else {
- RecordOfflineStatus(effective_load_flags_,
- (result == OK ? OFFLINE_STATUS_NETWORK_SUCCEEDED :
- OFFLINE_STATUS_NETWORK_FAILED));
- }
-
// If we tried to conditionalize the request and failed, we know
// we won't be reading from the cache after this point.
if (couldnt_conditionalize_request_)
@@ -2225,7 +2159,6 @@ int HttpCache::Transaction::BeginCacheValidation() {
if (skip_validation) {
// TODO(ricea): Is this pattern okay for asynchronous revalidations?
UpdateTransactionPattern(PATTERN_ENTRY_USED);
- RecordOfflineStatus(effective_load_flags_, OFFLINE_STATUS_FRESH_CACHE);
return SetupEntryForRead();
} else {
// Make the network request conditional, to see if we may reuse our cached
« no previous file with comments | « net/base/load_flags_list.h ('k') | net/http/http_cache_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698