summaryrefslogtreecommitdiff
path: root/chromium/net/http/http_cache_transaction.cc
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2019-05-16 09:59:13 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2019-05-20 10:28:53 +0000
commit6c11fb357ec39bf087b8b632e2b1e375aef1b38b (patch)
treec8315530db18a8ee566521c39ab8a6af4f72bc03 /chromium/net/http/http_cache_transaction.cc
parent3ffaed019d0772e59d6cdb2d0d32fe4834c31f72 (diff)
downloadqtwebengine-chromium-6c11fb357ec39bf087b8b632e2b1e375aef1b38b.tar.gz
BASELINE: Update Chromium to 74.0.3729.159
Change-Id: I8d2497da544c275415aedd94dd25328d555de811 Reviewed-by: Michael Brüning <michael.bruning@qt.io>
Diffstat (limited to 'chromium/net/http/http_cache_transaction.cc')
-rw-r--r--chromium/net/http/http_cache_transaction.cc24
1 files changed, 19 insertions, 5 deletions
diff --git a/chromium/net/http/http_cache_transaction.cc b/chromium/net/http/http_cache_transaction.cc
index 16ece824e84..6964c708698 100644
--- a/chromium/net/http/http_cache_transaction.cc
+++ b/chromium/net/http/http_cache_transaction.cc
@@ -1056,6 +1056,10 @@ int HttpCache::Transaction::DoGetBackendComplete(int result) {
// function can be invoked multiple times for a transaction.
mode_ = NONE;
+ // Keep track of the fraction of requests that we can double-key.
+ UMA_HISTOGRAM_BOOLEAN("HttpCache.TopFrameOriginPresent",
+ request_->top_frame_origin.has_value());
+
if (!ShouldPassThrough()) {
cache_key_ = cache_->GenerateCacheKey(request_);
@@ -1329,8 +1333,8 @@ void HttpCache::Transaction::AddCacheLockTimeoutHandler(ActiveEntry* entry) {
next_state_ == STATE_FINISH_HEADERS_COMPLETE)) {
base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE,
- base::Bind(&HttpCache::Transaction::OnCacheLockTimeout,
- weak_factory_.GetWeakPtr(), entry_lock_waiting_since_));
+ base::BindOnce(&HttpCache::Transaction::OnCacheLockTimeout,
+ weak_factory_.GetWeakPtr(), entry_lock_waiting_since_));
} else {
int timeout_milliseconds = 20 * 1000;
if (partial_ && entry->writers && !entry->writers->IsEmpty() &&
@@ -1356,8 +1360,8 @@ void HttpCache::Transaction::AddCacheLockTimeoutHandler(ActiveEntry* entry) {
}
base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
FROM_HERE,
- base::Bind(&HttpCache::Transaction::OnCacheLockTimeout,
- weak_factory_.GetWeakPtr(), entry_lock_waiting_since_),
+ base::BindOnce(&HttpCache::Transaction::OnCacheLockTimeout,
+ weak_factory_.GetWeakPtr(), entry_lock_waiting_since_),
TimeDelta::FromMilliseconds(timeout_milliseconds));
}
}
@@ -2431,6 +2435,17 @@ bool HttpCache::Transaction::ShouldPassThrough() {
if (effective_load_flags_ & LOAD_DISABLE_CACHE)
return true;
+ // Prevent resources whose origin is opaque from being cached. Blink's memory
+ // cache should take care of reusing resources within the current page load,
+ // but otherwise a resource with an opaque top-frame origin won’t be used
+ // again. Also, if the request does not have a top frame origin, bypass the
+ // cache otherwise resources from different pages could share a cached entry
+ // in such cases.
+ if (base::FeatureList::IsEnabled(features::kSplitCacheByTopFrameOrigin) &&
+ (!request_->top_frame_origin || request_->top_frame_origin->opaque())) {
+ return true;
+ }
+
if (method_ == "GET" || method_ == "HEAD")
return false;
@@ -2477,7 +2492,6 @@ int HttpCache::Transaction::BeginCacheRead() {
} else {
TransitionToState(STATE_FINISH_HEADERS);
}
-
return OK;
}