summaryrefslogtreecommitdiff
path: root/chromium/net/disk_cache
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2020-01-23 17:21:03 +0100
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2020-01-23 16:25:15 +0000
commitc551f43206405019121bd2b2c93714319a0a3300 (patch)
tree1f48c30631c421fd4bbb3c36da20183c8a2ed7d7 /chromium/net/disk_cache
parent7961cea6d1041e3e454dae6a1da660b453efd238 (diff)
downloadqtwebengine-chromium-c551f43206405019121bd2b2c93714319a0a3300.tar.gz
BASELINE: Update Chromium to 79.0.3945.139
Change-Id: I336b7182fab9bca80b709682489c07db112eaca5 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'chromium/net/disk_cache')
-rw-r--r--chromium/net/disk_cache/backend_unittest.cc28
-rw-r--r--chromium/net/disk_cache/blockfile/backend_impl.cc5
-rw-r--r--chromium/net/disk_cache/blockfile/eviction.cc2
-rw-r--r--chromium/net/disk_cache/blockfile/histogram_macros.h2
-rw-r--r--chromium/net/disk_cache/blockfile/in_flight_backend_io.cc21
-rw-r--r--chromium/net/disk_cache/blockfile/sparse_control.cc40
-rw-r--r--chromium/net/disk_cache/blockfile/webfonts_histogram.cc105
-rw-r--r--chromium/net/disk_cache/blockfile/webfonts_histogram.h26
-rw-r--r--chromium/net/disk_cache/disk_cache.cc6
-rw-r--r--chromium/net/disk_cache/disk_cache.h9
-rw-r--r--chromium/net/disk_cache/disk_cache_fuzzer.cc7
-rw-r--r--chromium/net/disk_cache/disk_cache_fuzzer.proto2
-rw-r--r--chromium/net/disk_cache/disk_cache_perftest.cc127
-rw-r--r--chromium/net/disk_cache/entry_unittest.cc60
-rw-r--r--chromium/net/disk_cache/simple/simple_backend_impl.cc4
-rw-r--r--chromium/net/disk_cache/simple/simple_entry_impl.cc26
-rw-r--r--chromium/net/disk_cache/simple/simple_histogram_macros.h4
-rw-r--r--chromium/net/disk_cache/simple/simple_index.cc4
18 files changed, 233 insertions, 245 deletions
diff --git a/chromium/net/disk_cache/backend_unittest.cc b/chromium/net/disk_cache/backend_unittest.cc
index 04246a726cb..5a1e5b7bfb3 100644
--- a/chromium/net/disk_cache/backend_unittest.cc
+++ b/chromium/net/disk_cache/backend_unittest.cc
@@ -3723,8 +3723,8 @@ TEST_F(DiskCacheTest, MultipleInstances) {
nullptr, &cache[0], cb.callback());
ASSERT_THAT(cb.GetResult(rv), IsOk());
rv = disk_cache::CreateCacheBackend(
- net::MEDIA_CACHE, net::CACHE_BACKEND_DEFAULT, store2.GetPath(), 0, false,
- nullptr, &cache[1], cb.callback());
+ net::GENERATED_BYTE_CODE_CACHE, net::CACHE_BACKEND_DEFAULT,
+ store2.GetPath(), 0, false, nullptr, &cache[1], cb.callback());
ASSERT_THAT(cb.GetResult(rv), IsOk());
ASSERT_TRUE(cache[0].get() != nullptr && cache[1].get() != nullptr);
@@ -4345,14 +4345,14 @@ TEST_F(DiskCacheBackendTest, DISABLED_SimpleCachePrioritizedEntryOrder) {
base::RunLoop read_run_loop;
entry2->ReadData(2, 0, read_buf2.get(), kSize,
- base::BindRepeating(finished_callback, &finished_read_order,
- 2, read_run_loop.QuitClosure()));
+ base::BindOnce(finished_callback, &finished_read_order, 2,
+ read_run_loop.QuitClosure()));
entry3->ReadData(2, 0, read_buf3.get(), kSize,
- base::BindRepeating(finished_callback, &finished_read_order,
- 3, base::Passed(base::OnceClosure())));
+ base::BindOnce(finished_callback, &finished_read_order, 3,
+ base::OnceClosure()));
entry1->ReadData(2, 0, read_buf1.get(), kSize,
- base::BindRepeating(finished_callback, &finished_read_order,
- 1, base::Passed(base::OnceClosure())));
+ base::BindOnce(finished_callback, &finished_read_order, 1,
+ base::OnceClosure()));
EXPECT_EQ(0u, finished_read_order.size());
read_run_loop.Run();
@@ -4437,14 +4437,14 @@ TEST_F(DiskCacheBackendTest, SimpleCacheFIFOEntryOrder) {
base::RunLoop read_run_loop;
entry2->ReadData(2, 0, read_buf2.get(), kSize,
- base::BindRepeating(finished_callback, &finished_read_order,
- 2, base::Passed(base::OnceClosure())));
+ base::BindOnce(finished_callback, &finished_read_order, 2,
+ base::OnceClosure()));
entry3->ReadData(2, 0, read_buf3.get(), kSize,
- base::BindRepeating(finished_callback, &finished_read_order,
- 3, base::Passed(base::OnceClosure())));
+ base::BindOnce(finished_callback, &finished_read_order, 3,
+ base::OnceClosure()));
entry1->ReadData(2, 0, read_buf1.get(), kSize,
- base::BindRepeating(finished_callback, &finished_read_order,
- 1, read_run_loop.QuitClosure()));
+ base::BindOnce(finished_callback, &finished_read_order, 1,
+ read_run_loop.QuitClosure()));
EXPECT_EQ(0u, finished_read_order.size());
read_run_loop.Run();
diff --git a/chromium/net/disk_cache/blockfile/backend_impl.cc b/chromium/net/disk_cache/blockfile/backend_impl.cc
index 365080f7ebe..0675953dd05 100644
--- a/chromium/net/disk_cache/blockfile/backend_impl.cc
+++ b/chromium/net/disk_cache/blockfile/backend_impl.cc
@@ -39,7 +39,6 @@
#include "net/disk_cache/blockfile/experiments.h"
#include "net/disk_cache/blockfile/file.h"
#include "net/disk_cache/blockfile/histogram_macros.h"
-#include "net/disk_cache/blockfile/webfonts_histogram.h"
#include "net/disk_cache/cache_util.h"
// Provide a BackendImpl object to macros from histogram_macros.h.
@@ -521,9 +520,6 @@ scoped_refptr<EntryImpl> BackendImpl::OpenEntryImpl(const std::string& key) {
if (cache_entry && ENTRY_NORMAL != cache_entry->entry()->Data()->state) {
// The entry was already evicted.
cache_entry = nullptr;
- web_fonts_histogram::RecordEvictedEntry(key);
- } else if (!cache_entry) {
- web_fonts_histogram::RecordCacheMiss(key);
}
int current_size = data_->header.num_bytes / (1024 * 1024);
@@ -548,7 +544,6 @@ scoped_refptr<EntryImpl> BackendImpl::OpenEntryImpl(const std::string& key) {
CACHE_UMA(HOURS, "AllOpenByUseHours.Hit", 0,
static_cast<base::HistogramBase::Sample>(use_hours));
stats_.OnEvent(Stats::OPEN_HIT);
- web_fonts_histogram::RecordCacheHit(cache_entry.get());
return cache_entry;
}
diff --git a/chromium/net/disk_cache/blockfile/eviction.cc b/chromium/net/disk_cache/blockfile/eviction.cc
index 489f5494f10..fdc2169db70 100644
--- a/chromium/net/disk_cache/blockfile/eviction.cc
+++ b/chromium/net/disk_cache/blockfile/eviction.cc
@@ -47,7 +47,6 @@
#include "net/disk_cache/blockfile/experiments.h"
#include "net/disk_cache/blockfile/histogram_macros.h"
#include "net/disk_cache/blockfile/trace.h"
-#include "net/disk_cache/blockfile/webfonts_histogram.h"
// Provide a BackendImpl object to macros from histogram_macros.h.
#define CACHE_UMA_BACKEND_IMPL_OBJ backend_
@@ -290,7 +289,6 @@ bool Eviction::EvictEntry(CacheRankingsBlock* node, bool empty,
return false;
}
- web_fonts_histogram::RecordEviction(entry.get());
ReportTrimTimes(entry.get());
if (empty || !new_eviction_) {
entry->DoomImpl();
diff --git a/chromium/net/disk_cache/blockfile/histogram_macros.h b/chromium/net/disk_cache/blockfile/histogram_macros.h
index 3a681779df0..a5de85cc9da 100644
--- a/chromium/net/disk_cache/blockfile/histogram_macros.h
+++ b/chromium/net/disk_cache/blockfile/histogram_macros.h
@@ -92,11 +92,11 @@
const std::string my_name = \
CACHE_UMA_BACKEND_IMPL_OBJ->HistogramName(name, experiment); \
switch (CACHE_UMA_BACKEND_IMPL_OBJ->GetCacheType()) { \
+ case net::REMOVED_MEDIA_CACHE: \
default: \
NOTREACHED(); \
FALLTHROUGH; \
case net::DISK_CACHE: \
- case net::MEDIA_CACHE: \
case net::APP_CACHE: \
case net::SHADER_CACHE: \
case net::PNACL_CACHE: \
diff --git a/chromium/net/disk_cache/blockfile/in_flight_backend_io.cc b/chromium/net/disk_cache/blockfile/in_flight_backend_io.cc
index b7c901bceb5..3d2250a9246 100644
--- a/chromium/net/disk_cache/blockfile/in_flight_backend_io.cc
+++ b/chromium/net/disk_cache/blockfile/in_flight_backend_io.cc
@@ -365,23 +365,22 @@ void BackendIO::ExecuteEntryOperation() {
case OP_READ:
result_ =
entry_->ReadDataImpl(index_, offset_, buf_.get(), buf_len_,
- base::Bind(&BackendIO::OnIOComplete, this));
+ base::BindOnce(&BackendIO::OnIOComplete, this));
break;
case OP_WRITE:
- result_ =
- entry_->WriteDataImpl(index_, offset_, buf_.get(), buf_len_,
- base::Bind(&BackendIO::OnIOComplete, this),
- truncate_);
+ result_ = entry_->WriteDataImpl(
+ index_, offset_, buf_.get(), buf_len_,
+ base::BindOnce(&BackendIO::OnIOComplete, this), truncate_);
break;
case OP_READ_SPARSE:
result_ = entry_->ReadSparseDataImpl(
- offset64_, buf_.get(), buf_len_,
- base::Bind(&BackendIO::OnIOComplete, this));
+ offset64_, buf_.get(), buf_len_,
+ base::BindOnce(&BackendIO::OnIOComplete, this));
break;
case OP_WRITE_SPARSE:
result_ = entry_->WriteSparseDataImpl(
- offset64_, buf_.get(), buf_len_,
- base::Bind(&BackendIO::OnIOComplete, this));
+ offset64_, buf_.get(), buf_len_,
+ base::BindOnce(&BackendIO::OnIOComplete, this));
break;
case OP_GET_RANGE:
result_ = entry_->GetAvailableRangeImpl(offset64_, buf_len_, start_);
@@ -392,7 +391,7 @@ void BackendIO::ExecuteEntryOperation() {
break;
case OP_IS_READY:
result_ = entry_->ReadyForSparseIOImpl(
- base::Bind(&BackendIO::OnIOComplete, this));
+ base::BindOnce(&BackendIO::OnIOComplete, this));
break;
default:
NOTREACHED() << "Invalid Operation";
@@ -629,7 +628,7 @@ void InFlightBackendIO::OnOperationComplete(BackgroundIO* operation,
void InFlightBackendIO::PostOperation(const base::Location& from_here,
BackendIO* operation) {
background_thread_->PostTask(
- from_here, base::Bind(&BackendIO::ExecuteOperation, operation));
+ from_here, base::BindOnce(&BackendIO::ExecuteOperation, operation));
OnOperationPosted(operation);
}
diff --git a/chromium/net/disk_cache/blockfile/sparse_control.cc b/chromium/net/disk_cache/blockfile/sparse_control.cc
index cdde574433b..a914ac0dac4 100644
--- a/chromium/net/disk_cache/blockfile/sparse_control.cc
+++ b/chromium/net/disk_cache/blockfile/sparse_control.cc
@@ -43,6 +43,10 @@ const int kMaxMapSize = 8 * 1024;
// The maximum number of bytes that a child can store.
const int kMaxEntrySize = 0x100000;
+// How much we can address. 8 KiB bitmap (kMaxMapSize above) gives us offsets
+// up to 64 GiB.
+const int64_t kMaxEndOffset = 8ll * kMaxMapSize * kMaxEntrySize;
+
// The size of each data block (tracked by the child allocation bitmap).
const int kBlockSize = 1024;
@@ -264,12 +268,38 @@ int SparseControl::StartIO(SparseOperation op,
if (offset < 0 || buf_len < 0)
return net::ERR_INVALID_ARGUMENT;
- // We only support up to 64 GB.
- if (static_cast<uint64_t>(offset) + static_cast<unsigned int>(buf_len) >=
- UINT64_C(0x1000000000)) {
- return net::ERR_CACHE_OPERATION_NOT_SUPPORTED;
+ int64_t end_offset = 0; // non-inclusive.
+ if (!base::CheckAdd(offset, buf_len).AssignIfValid(&end_offset)) {
+ // Writes aren't permitted to try to cross the end of address space;
+ // read/GetAvailableRange clip.
+ if (op == kWriteOperation)
+ return net::ERR_INVALID_ARGUMENT;
+ else
+ end_offset = std::numeric_limits<int64_t>::max();
+ }
+
+ if (offset >= kMaxEndOffset) {
+ // Interval is within valid offset space, but completely outside backend
+ // supported range. Permit GetAvailableRange to say "nothing here", actual
+ // I/O fails.
+ if (op == kGetRangeOperation)
+ return 0;
+ else
+ return net::ERR_CACHE_OPERATION_NOT_SUPPORTED;
}
+ if (end_offset > kMaxEndOffset) {
+ // Interval is partially what the backend can handle. Fail writes, clip
+ // reads.
+ if (op == kWriteOperation)
+ return net::ERR_CACHE_OPERATION_NOT_SUPPORTED;
+ else
+ end_offset = kMaxEndOffset;
+ }
+
+ DCHECK_GE(end_offset, offset);
+ buf_len = end_offset - offset;
+
DCHECK(!user_buf_.get());
DCHECK(user_callback_.is_null());
@@ -420,7 +450,7 @@ int SparseControl::OpenSparseEntry(int data_len) {
if (!(PARENT_ENTRY & entry_->GetEntryFlags()))
return net::ERR_CACHE_OPERATION_NOT_SUPPORTED;
- // Dont't go over board with the bitmap. 8 KB gives us offsets up to 64 GB.
+ // Don't go over board with the bitmap.
int map_len = data_len - sizeof(sparse_header_);
if (map_len > kMaxMapSize || map_len % 4)
return net::ERR_CACHE_OPERATION_NOT_SUPPORTED;
diff --git a/chromium/net/disk_cache/blockfile/webfonts_histogram.cc b/chromium/net/disk_cache/blockfile/webfonts_histogram.cc
deleted file mode 100644
index 95f54afc542..00000000000
--- a/chromium/net/disk_cache/blockfile/webfonts_histogram.cc
+++ /dev/null
@@ -1,105 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "net/disk_cache/blockfile/webfonts_histogram.h"
-
-#include "base/strings/string_piece.h"
-#include "base/strings/stringprintf.h"
-#include "net/disk_cache/blockfile/entry_impl.h"
-#include "net/disk_cache/blockfile/histogram_macros.h"
-
-namespace {
-
-enum WebFontDiskCacheEventType {
- CACHE_EVENT_MISS,
- CACHE_EVENT_HIT,
- CACHE_EVENT_EVICTED_ENTRY,
- CACHE_EVENT_MAX
-};
-
-// Tests if the substring of str that begins at pos starts with substr. If so,
-// returns true and advances pos by the length of substr.
-bool Consume(const std::string& str, const base::StringPiece& substr,
- std::string::size_type* pos) {
- if (!str.compare(*pos, substr.length(), substr.data())) {
- *pos += substr.length();
- return true;
- }
- return false;
-}
-
-const char kRoboto[] = "roboto";
-const char kOpenSans[] = "opensans";
-const char kOthers[] = "others";
-
-// Check if the given string is a URL for a font resource of Google Fonts.
-// If so, returns a label for UMA histogram ("roboto", "opensans" or "others").
-const char* HistogramLabel(const std::string& str) {
- std::string::size_type pos = 0;
- if (Consume(str, "http://", &pos) || Consume(str, "https://", &pos)) {
- if (Consume(str, "themes.googleusercontent.com/static/fonts/", &pos) ||
- Consume(str, "ssl.gstatic.com/fonts/", &pos) ||
- Consume(str, "fonts.gstatic.com/s/", &pos)) {
- if (Consume(str, kRoboto, &pos))
- return kRoboto;
- if (Consume(str, kOpenSans, &pos))
- return kOpenSans;
- return kOthers;
- }
- }
- return nullptr;
-}
-
-std::string HistogramName(const char* prefix, const char* label) {
- return base::StringPrintf("WebFont.%s_%s", prefix, label);
-}
-
-void RecordCacheEvent(WebFontDiskCacheEventType type, const char* label) {
- CACHE_HISTOGRAM_ENUMERATION(HistogramName("DiskCacheHit", label),
- type, CACHE_EVENT_MAX);
-}
-
-} // namespace
-
-namespace disk_cache {
-namespace web_fonts_histogram {
-
-void RecordCacheMiss(const std::string& key) {
- const char* label = HistogramLabel(key);
- if (label)
- RecordCacheEvent(CACHE_EVENT_MISS, label);
-}
-
-void RecordEvictedEntry(const std::string& key) {
- const char* label = HistogramLabel(key);
- if (label)
- RecordCacheEvent(CACHE_EVENT_EVICTED_ENTRY, label);
-}
-
-void RecordCacheHit(EntryImpl* entry) {
- const char* label = HistogramLabel(entry->GetKey());
- if (!label)
- return;
- EntryStore* info = entry->entry()->Data();
- CACHE_HISTOGRAM_COUNTS_10000(HistogramName("DiskCache.ReuseCount.Hit", label),
- info->reuse_count);
- CACHE_HISTOGRAM_AGE(HistogramName("DiskCache.EntryAge.Hit", label),
- base::Time::FromInternalValue(info->creation_time));
- RecordCacheEvent(CACHE_EVENT_HIT, label);
-}
-
-void RecordEviction(EntryImpl* entry) {
- const char* label = HistogramLabel(entry->GetKey());
- if (!label)
- return;
- EntryStore* info = entry->entry()->Data();
- CACHE_HISTOGRAM_COUNTS_10000(
- HistogramName("DiskCache.ReuseCount.Evict", label),
- info->reuse_count);
- CACHE_HISTOGRAM_AGE(HistogramName("DiskCache.EntryAge.Evict", label),
- base::Time::FromInternalValue(info->creation_time));
-}
-
-} // namespace web_fonts_histogram
-} // namespace disk_cache
diff --git a/chromium/net/disk_cache/blockfile/webfonts_histogram.h b/chromium/net/disk_cache/blockfile/webfonts_histogram.h
deleted file mode 100644
index 1a920a95514..00000000000
--- a/chromium/net/disk_cache/blockfile/webfonts_histogram.h
+++ /dev/null
@@ -1,26 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef NET_DISK_CACHE_BLOCKFILE_WEBFONTS_HISTOGRAM_H_
-#define NET_DISK_CACHE_BLOCKFILE_WEBFONTS_HISTOGRAM_H_
-
-#include <string>
-
-namespace disk_cache {
-
-class EntryImpl;
-
-// A collection of functions for histogram reporting about web fonts.
-namespace web_fonts_histogram {
-
-void RecordCacheMiss(const std::string& key);
-void RecordEvictedEntry(const std::string& key);
-void RecordCacheHit(EntryImpl* entry);
-void RecordEviction(EntryImpl* entry);
-
-} // namespace web_fonts_histogram
-
-} // namespace disk_cache
-
-#endif // NET_DISK_CACHE_BLOCKFILE_WEBFONTS_HISTOGRAM_H_
diff --git a/chromium/net/disk_cache/disk_cache.cc b/chromium/net/disk_cache/disk_cache.cc
index 2bd21ba0680..b5d3315bd28 100644
--- a/chromium/net/disk_cache/disk_cache.cc
+++ b/chromium/net/disk_cache/disk_cache.cc
@@ -121,7 +121,7 @@ net::Error CacheCreator::Run() {
simple_cache->set_app_status_listener(app_status_listener_);
#endif
return simple_cache->Init(
- base::Bind(&CacheCreator::OnIOComplete, base::Unretained(this)));
+ base::BindOnce(&CacheCreator::OnIOComplete, base::Unretained(this)));
}
// Avoid references to blockfile functions on Android to reduce binary size.
@@ -134,7 +134,7 @@ net::Error CacheCreator::Run() {
created_cache_.reset(new_cache);
new_cache->SetMaxSize(max_bytes_);
net::Error rv = new_cache->Init(
- base::Bind(&CacheCreator::OnIOComplete, base::Unretained(this)));
+ base::BindOnce(&CacheCreator::OnIOComplete, base::Unretained(this)));
DCHECK_EQ(net::ERR_IO_PENDING, rv);
return rv;
#endif
@@ -243,7 +243,7 @@ net::Error CreateCacheBackendImpl(
std::move(app_status_listener),
#endif
net_log, backend, std::move(post_cleanup_callback), std::move(callback));
- if (type == net::DISK_CACHE || type == net::MEDIA_CACHE) {
+ if (type == net::DISK_CACHE) {
DCHECK(!had_post_cleanup_callback);
return creator->Run();
}
diff --git a/chromium/net/disk_cache/disk_cache.h b/chromium/net/disk_cache/disk_cache.h
index 91aaa7d6f8c..c1d5f7ae660 100644
--- a/chromium/net/disk_cache/disk_cache.h
+++ b/chromium/net/disk_cache/disk_cache.h
@@ -52,9 +52,9 @@ using EntryResultCallback = base::OnceCallback<void(EntryResult)>;
// Returns an instance of a Backend of the given |type|. |path| points to a
// folder where the cached data will be stored (if appropriate). This cache
// instance must be the only object that will be reading or writing files to
-// that folder (if another one exists, and |type| is not net::DISK_CACHE or
-// net::MEDIA_CACHE, this operation will not complete until the previous
-// duplicate gets destroyed and finishes all I/O).
+// that folder (if another one exists, and |type| is not net::DISK_CACHE this
+// operation will not complete until the previous duplicate gets destroyed and
+// finishes all I/O).
//
// The returned object should be deleted when not needed anymore.
// If |force| is true, and there is a problem with the cache initialization, the
@@ -96,8 +96,7 @@ NET_EXPORT net::Error CreateCacheBackend(
// will get invoked even if the creation fails. The invocation will always be
// via the event loop, and never direct.
//
-// This is currently unsupported for |type| == net::DISK_CACHE or
-// net::MEDIA_CACHE.
+// This is currently unsupported for |type| == net::DISK_CACHE.
//
// Note that this will not wait for |post_cleanup_callback| of a previous
// instance for |path| to run.
diff --git a/chromium/net/disk_cache/disk_cache_fuzzer.cc b/chromium/net/disk_cache/disk_cache_fuzzer.cc
index 2f1ee041605..cc531029c74 100644
--- a/chromium/net/disk_cache/disk_cache_fuzzer.cc
+++ b/chromium/net/disk_cache/disk_cache_fuzzer.cc
@@ -246,9 +246,10 @@ net::CacheType GetCacheTypeAndPrint(
MAYBE_PRINT << "Cache type = APP_CACHE." << std::endl;
return net::CacheType::APP_CACHE;
break;
- case disk_cache_fuzzer::FuzzCommands::MEDIA_CACHE:
- MAYBE_PRINT << "Cache type = MEDIA_CACHE." << std::endl;
- return net::CacheType::MEDIA_CACHE;
+ case disk_cache_fuzzer::FuzzCommands::REMOVED_MEDIA_CACHE:
+ // Media cache no longer in use; handle as HTTP_CACHE
+ MAYBE_PRINT << "Cache type = REMOVED_MEDIA_CACHE." << std::endl;
+ return net::CacheType::DISK_CACHE;
break;
case disk_cache_fuzzer::FuzzCommands::SHADER_CACHE:
MAYBE_PRINT << "Cache type = SHADER_CACHE." << std::endl;
diff --git a/chromium/net/disk_cache/disk_cache_fuzzer.proto b/chromium/net/disk_cache/disk_cache_fuzzer.proto
index 779bdb59af3..b9dbe0831c0 100644
--- a/chromium/net/disk_cache/disk_cache_fuzzer.proto
+++ b/chromium/net/disk_cache/disk_cache_fuzzer.proto
@@ -25,7 +25,7 @@ message FuzzCommands {
enum CacheType {
APP_CACHE = 1;
- MEDIA_CACHE = 2;
+ REMOVED_MEDIA_CACHE = 2;
SHADER_CACHE = 3;
PNACL_CACHE = 4;
GENERATED_BYTE_CODE_CACHE = 5;
diff --git a/chromium/net/disk_cache/disk_cache_perftest.cc b/chromium/net/disk_cache/disk_cache_perftest.cc
index 56fef9b1861..43583a319e3 100644
--- a/chromium/net/disk_cache/disk_cache_perftest.cc
+++ b/chromium/net/disk_cache/disk_cache_perftest.cc
@@ -16,9 +16,9 @@
#include "base/run_loop.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
-#include "base/test/perf_time_logger.h"
#include "base/test/test_file_util.h"
#include "base/threading/thread.h"
+#include "base/timer/elapsed_timer.h"
#include "build/build_config.h"
#include "net/base/cache_type.h"
#include "net/base/completion_repeating_callback.h"
@@ -35,6 +35,7 @@
#include "net/disk_cache/simple/simple_index.h"
#include "net/disk_cache/simple/simple_index_file.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "testing/perf/perf_result_reporter.h"
#include "testing/platform_test.h"
using base::Time;
@@ -52,6 +53,50 @@ const int kChunkSize = 32 * 1024;
// As of 2017-01-12, this is a typical per-tab limit on HTTP connections.
const int kMaxParallelOperations = 10;
+static constexpr char kMetricPrefixDiskCache[] = "DiskCache.";
+static constexpr char kMetricPrefixSimpleIndex[] = "SimpleIndex.";
+static constexpr char kMetricCacheEntriesWriteTimeMs[] =
+ "cache_entries_write_time";
+static constexpr char kMetricCacheHeadersReadTimeColdMs[] =
+ "cache_headers_read_time_cold";
+static constexpr char kMetricCacheHeadersReadTimeWarmMs[] =
+ "cache_headers_read_time_warm";
+static constexpr char kMetricCacheEntriesReadTimeColdMs[] =
+ "cache_entries_read_time_cold";
+static constexpr char kMetricCacheEntriesReadTimeWarmMs[] =
+ "cache_entries_read_time_warm";
+static constexpr char kMetricCacheKeysHashTimeMs[] = "cache_keys_hash_time";
+static constexpr char kMetricFillBlocksTimeMs[] = "fill_sequential_blocks_time";
+static constexpr char kMetricCreateDeleteBlocksTimeMs[] =
+ "create_and_delete_random_blocks_time";
+static constexpr char kMetricSimpleCacheInitTotalTimeMs[] =
+ "simple_cache_initial_read_total_time";
+static constexpr char kMetricSimpleCacheInitPerEntryTimeUs[] =
+ "simple_cache_initial_read_per_entry_time";
+static constexpr char kMetricAverageEvictionTimeMs[] = "average_eviction_time";
+
+perf_test::PerfResultReporter SetUpDiskCacheReporter(const std::string& story) {
+ perf_test::PerfResultReporter reporter(kMetricPrefixDiskCache, story);
+ reporter.RegisterImportantMetric(kMetricCacheEntriesWriteTimeMs, "ms");
+ reporter.RegisterImportantMetric(kMetricCacheHeadersReadTimeColdMs, "ms");
+ reporter.RegisterImportantMetric(kMetricCacheHeadersReadTimeWarmMs, "ms");
+ reporter.RegisterImportantMetric(kMetricCacheEntriesReadTimeColdMs, "ms");
+ reporter.RegisterImportantMetric(kMetricCacheEntriesReadTimeWarmMs, "ms");
+ reporter.RegisterImportantMetric(kMetricCacheKeysHashTimeMs, "ms");
+ reporter.RegisterImportantMetric(kMetricFillBlocksTimeMs, "ms");
+ reporter.RegisterImportantMetric(kMetricCreateDeleteBlocksTimeMs, "ms");
+ reporter.RegisterImportantMetric(kMetricSimpleCacheInitTotalTimeMs, "ms");
+ reporter.RegisterImportantMetric(kMetricSimpleCacheInitPerEntryTimeUs, "us");
+ return reporter;
+}
+
+perf_test::PerfResultReporter SetUpSimpleIndexReporter(
+ const std::string& story) {
+ perf_test::PerfResultReporter reporter(kMetricPrefixSimpleIndex, story);
+ reporter.RegisterImportantMetric(kMetricAverageEvictionTimeMs, "ms");
+ return reporter;
+}
+
void MaybeIncreaseFdLimitTo(unsigned int max_descriptors) {
#if defined(OS_POSIX)
base::IncreaseFdLimitTo(max_descriptors);
@@ -76,8 +121,10 @@ class DiskCachePerfTest : public DiskCacheTestWithCache {
protected:
// Helper methods for constructing tests.
- bool TimeWrites();
- bool TimeReads(WhatToRead what_to_read, const char* timer_message);
+ bool TimeWrites(const std::string& story);
+ bool TimeReads(WhatToRead what_to_read,
+ const std::string& metric,
+ const std::string& story);
void ResetAndEvictSystemDiskCache();
// Callbacks used within tests for intermediate operations.
@@ -90,7 +137,7 @@ class DiskCachePerfTest : public DiskCacheTestWithCache {
int result);
// Complete perf tests.
- void CacheBackendPerformance();
+ void CacheBackendPerformance(const std::string& story);
const size_t kFdLimitForCacheTests = 8192;
@@ -350,7 +397,7 @@ bool ReadHandler::CheckForErrorAndCancel(int result) {
return false;
}
-bool DiskCachePerfTest::TimeWrites() {
+bool DiskCachePerfTest::TimeWrites(const std::string& story) {
for (size_t i = 0; i < kNumEntries; i++) {
TestEntry entry;
entry.key = GenerateKey(true);
@@ -360,30 +407,40 @@ bool DiskCachePerfTest::TimeWrites() {
net::TestCompletionCallback cb;
- base::PerfTimeLogger timer("Write disk cache entries");
+ auto reporter = SetUpDiskCacheReporter(story);
+ base::ElapsedTimer write_timer;
WriteHandler write_handler(this, cache_.get(), cb.callback());
write_handler.Run();
- return cb.WaitForResult() == net::OK;
+ auto result = cb.WaitForResult();
+ reporter.AddResult(kMetricCacheEntriesWriteTimeMs,
+ write_timer.Elapsed().InMillisecondsF());
+ return result == net::OK;
}
bool DiskCachePerfTest::TimeReads(WhatToRead what_to_read,
- const char* timer_message) {
- base::PerfTimeLogger timer(timer_message);
+ const std::string& metric,
+ const std::string& story) {
+ auto reporter = SetUpDiskCacheReporter(story);
+ base::ElapsedTimer timer;
net::TestCompletionCallback cb;
ReadHandler read_handler(this, what_to_read, cache_.get(), cb.callback());
read_handler.Run();
- return cb.WaitForResult() == net::OK;
+ auto result = cb.WaitForResult();
+ reporter.AddResult(metric, timer.Elapsed().InMillisecondsF());
+ return result == net::OK;
}
TEST_F(DiskCachePerfTest, BlockfileHashes) {
- base::PerfTimeLogger timer("Hash disk cache keys");
+ auto reporter = SetUpDiskCacheReporter("baseline_story");
+ base::ElapsedTimer timer;
for (int i = 0; i < 300000; i++) {
std::string key = GenerateKey(true);
base::Hash(key);
}
- timer.Done();
+ reporter.AddResult(kMetricCacheKeysHashTimeMs,
+ timer.Elapsed().InMillisecondsF());
}
void DiskCachePerfTest::ResetAndEvictSystemDiskCache() {
@@ -412,41 +469,41 @@ void DiskCachePerfTest::ResetAndEvictSystemDiskCache() {
InitCache();
}
-void DiskCachePerfTest::CacheBackendPerformance() {
+void DiskCachePerfTest::CacheBackendPerformance(const std::string& story) {
LOG(ERROR) << "Using cache at:" << cache_path_.MaybeAsASCII();
SetMaxSize(500 * 1024 * 1024);
InitCache();
- EXPECT_TRUE(TimeWrites());
+ EXPECT_TRUE(TimeWrites(story));
disk_cache::SimpleBackendImpl::FlushWorkerPoolForTesting();
base::RunLoop().RunUntilIdle();
ResetAndEvictSystemDiskCache();
EXPECT_TRUE(TimeReads(WhatToRead::HEADERS_ONLY,
- "Read disk cache headers only (cold)"));
+ kMetricCacheHeadersReadTimeColdMs, story));
EXPECT_TRUE(TimeReads(WhatToRead::HEADERS_ONLY,
- "Read disk cache headers only (warm)"));
+ kMetricCacheHeadersReadTimeWarmMs, story));
disk_cache::SimpleBackendImpl::FlushWorkerPoolForTesting();
base::RunLoop().RunUntilIdle();
ResetAndEvictSystemDiskCache();
EXPECT_TRUE(TimeReads(WhatToRead::HEADERS_AND_BODY,
- "Read disk cache entries (cold)"));
+ kMetricCacheEntriesReadTimeColdMs, story));
EXPECT_TRUE(TimeReads(WhatToRead::HEADERS_AND_BODY,
- "Read disk cache entries (warm)"));
+ kMetricCacheEntriesReadTimeWarmMs, story));
disk_cache::SimpleBackendImpl::FlushWorkerPoolForTesting();
base::RunLoop().RunUntilIdle();
}
TEST_F(DiskCachePerfTest, CacheBackendPerformance) {
- CacheBackendPerformance();
+ CacheBackendPerformance("blockfile_cache");
}
TEST_F(DiskCachePerfTest, SimpleCacheBackendPerformance) {
SetSimpleCacheMode();
- CacheBackendPerformance();
+ CacheBackendPerformance("simple_cache");
}
// Creating and deleting "entries" on a block-file is something quite frequent
@@ -463,7 +520,8 @@ TEST_F(DiskCachePerfTest, BlockFilesPerformance) {
const int kNumBlocks = 60000;
disk_cache::Addr address[kNumBlocks];
- base::PerfTimeLogger timer1("Fill three block-files");
+ auto reporter = SetUpDiskCacheReporter("blockfile_cache");
+ base::ElapsedTimer sequential_timer;
// Fill up the 32-byte block file (use three files).
for (int i = 0; i < kNumBlocks; i++) {
@@ -472,8 +530,9 @@ TEST_F(DiskCachePerfTest, BlockFilesPerformance) {
files.CreateBlock(disk_cache::RANKINGS, block_size, &address[i]));
}
- timer1.Done();
- base::PerfTimeLogger timer2("Create and delete blocks");
+ reporter.AddResult(kMetricFillBlocksTimeMs,
+ sequential_timer.Elapsed().InMillisecondsF());
+ base::ElapsedTimer random_timer;
for (int i = 0; i < 200000; i++) {
int block_size = base::RandInt(1, 4);
@@ -484,7 +543,8 @@ TEST_F(DiskCachePerfTest, BlockFilesPerformance) {
files.CreateBlock(disk_cache::RANKINGS, block_size, &address[entry]));
}
- timer2.Done();
+ reporter.AddResult(kMetricCreateDeleteBlocksTimeMs,
+ random_timer.Elapsed().InMillisecondsF());
base::RunLoop().RunUntilIdle();
}
@@ -567,12 +627,14 @@ TEST_F(DiskCachePerfTest, SimpleCacheInitialReadPortion) {
disk_cache::SimpleBackendImpl::FlushWorkerPoolForTesting();
base::RunLoop().RunUntilIdle();
- LOG(ERROR) << "Early portion:" << elapsed_early << " ms";
- LOG(ERROR) << "\tPer entry:"
- << 1000 * (elapsed_early / (kIterations * kBatchSize)) << " us";
- LOG(ERROR) << "Event loop portion: " << elapsed_late << " ms";
- LOG(ERROR) << "\tPer entry:"
- << 1000 * (elapsed_late / (kIterations * kBatchSize)) << " us";
+ auto reporter = SetUpDiskCacheReporter("early_portion");
+ reporter.AddResult(kMetricSimpleCacheInitTotalTimeMs, elapsed_early);
+ reporter.AddResult(kMetricSimpleCacheInitPerEntryTimeUs,
+ 1000 * (elapsed_early / (kIterations * kBatchSize)));
+ reporter = SetUpDiskCacheReporter("event_loop_portion");
+ reporter.AddResult(kMetricSimpleCacheInitTotalTimeMs, elapsed_late);
+ reporter.AddResult(kMetricSimpleCacheInitPerEntryTimeUs,
+ 1000 * (elapsed_late / (kIterations * kBatchSize)));
}
// Measures how quickly SimpleIndex can compute which entries to evict.
@@ -612,8 +674,9 @@ TEST(SimpleIndexPerfTest, EvictionPerformance) {
evict_elapsed_ms += timer.Elapsed().InMillisecondsF();
}
- LOG(ERROR) << "Average time to evict:" << (evict_elapsed_ms / iterations)
- << "ms";
+ auto reporter = SetUpSimpleIndexReporter("baseline_story");
+ reporter.AddResult(kMetricAverageEvictionTimeMs,
+ evict_elapsed_ms / iterations);
}
} // namespace
diff --git a/chromium/net/disk_cache/entry_unittest.cc b/chromium/net/disk_cache/entry_unittest.cc
index 045fcb32bc0..3e609b9e10a 100644
--- a/chromium/net/disk_cache/entry_unittest.cc
+++ b/chromium/net/disk_cache/entry_unittest.cc
@@ -83,7 +83,7 @@ class DiskCacheEntryTest : public DiskCacheTestWithCache {
void DoomSparseEntry();
void PartialSparseEntry();
void SparseInvalidArg();
- void SparseClipEnd(bool expected_unsupported);
+ void SparseClipEnd(int64_t max_index, bool expected_unsupported);
bool SimpleCacheMakeBadChecksumEntry(const std::string& key, int data_size);
bool SimpleCacheThirdStreamFileExists(const char* key);
void SyncDoomEntry(const char* key);
@@ -2175,14 +2175,12 @@ void DiskCacheEntryTest::UpdateSparseEntry() {
}
TEST_F(DiskCacheEntryTest, UpdateSparseEntry) {
- SetCacheType(net::MEDIA_CACHE);
InitCache();
UpdateSparseEntry();
}
TEST_F(DiskCacheEntryTest, MemoryOnlyUpdateSparseEntry) {
SetMemoryOnlyMode();
- SetCacheType(net::MEDIA_CACHE);
InitCache();
UpdateSparseEntry();
}
@@ -2461,7 +2459,8 @@ TEST_F(DiskCacheEntryTest, SimpleSparseInvalidArg) {
SparseInvalidArg();
}
-void DiskCacheEntryTest::SparseClipEnd(bool expect_unsupported) {
+void DiskCacheEntryTest::SparseClipEnd(int64_t max_index,
+ bool expect_unsupported) {
std::string key("key");
disk_cache::Entry* entry = nullptr;
ASSERT_THAT(CreateEntry(key, &entry), IsOk());
@@ -2474,7 +2473,7 @@ void DiskCacheEntryTest::SparseClipEnd(bool expect_unsupported) {
base::MakeRefCounted<net::IOBuffer>(kSize * 2);
CacheTestFillBuffer(read_buf->data(), kSize * 2, false);
- const int64_t kOffset = std::numeric_limits<int64_t>::max() - kSize;
+ const int64_t kOffset = max_index - kSize;
int rv = WriteSparseData(entry, kOffset, buf.get(), kSize);
EXPECT_EQ(
rv, expect_unsupported ? net::ERR_CACHE_OPERATION_NOT_SUPPORTED : kSize);
@@ -2494,7 +2493,8 @@ void DiskCacheEntryTest::SparseClipEnd(bool expect_unsupported) {
cb.callback());
rv = cb.GetResult(rv);
if (expect_unsupported) {
- EXPECT_EQ(rv, net::ERR_CACHE_OPERATION_NOT_SUPPORTED);
+ // GetAvailableRange just returns nothing found, not an error.
+ EXPECT_EQ(rv, 0);
} else {
EXPECT_EQ(kSize, rv);
EXPECT_EQ(kOffset, out_start);
@@ -2507,19 +2507,57 @@ TEST_F(DiskCacheEntryTest, SparseClipEnd) {
InitCache();
// Blockfile refuses to deal with sparse indices over 64GiB.
- SparseClipEnd(/* expect_unsupported = */ true);
+ SparseClipEnd(std::numeric_limits<int64_t>::max(),
+ /* expect_unsupported = */ true);
+}
+
+TEST_F(DiskCacheEntryTest, SparseClipEnd2) {
+ InitCache();
+
+ const int64_t kLimit = 64ll * 1024 * 1024 * 1024;
+ // Separate test for blockfile for indices right at the edge of its address
+ // space limit. kLimit must match kMaxEndOffset in sparse_control.cc
+ SparseClipEnd(kLimit, /* expect_unsupported = */ false);
+
+ // Test with things after kLimit, too, which isn't an issue for backends
+ // supporting the entire 64-bit offset range.
+ std::string key("key2");
+ disk_cache::Entry* entry = nullptr;
+ ASSERT_THAT(CreateEntry(key, &entry), IsOk());
+
+ const int kSize = 1024;
+ scoped_refptr<net::IOBuffer> buf = base::MakeRefCounted<net::IOBuffer>(kSize);
+ CacheTestFillBuffer(buf->data(), kSize, false);
+
+ // Try to write after --- fails.
+ int rv = WriteSparseData(entry, kLimit, buf.get(), kSize);
+ EXPECT_EQ(net::ERR_CACHE_OPERATION_NOT_SUPPORTED, rv);
+
+ // Similarly for read.
+ rv = ReadSparseData(entry, kLimit, buf.get(), kSize);
+ EXPECT_EQ(net::ERR_CACHE_OPERATION_NOT_SUPPORTED, rv);
+
+ // GetAvailableRange just returns nothing.
+ net::TestCompletionCallback cb;
+ int64_t out_start = 0;
+ rv = entry->GetAvailableRange(kLimit, kSize * 3, &out_start, cb.callback());
+ rv = cb.GetResult(rv);
+ EXPECT_EQ(rv, 0);
+ entry->Close();
}
TEST_F(DiskCacheEntryTest, MemoryOnlySparseClipEnd) {
SetMemoryOnlyMode();
InitCache();
- SparseClipEnd(/* expect_unsupported = */ false);
+ SparseClipEnd(std::numeric_limits<int64_t>::max(),
+ /* expect_unsupported = */ false);
}
TEST_F(DiskCacheEntryTest, SimpleSparseClipEnd) {
SetSimpleCacheMode();
InitCache();
- SparseClipEnd(/* expect_unsupported = */ false);
+ SparseClipEnd(std::numeric_limits<int64_t>::max(),
+ /* expect_unsupported = */ false);
}
// Tests that corrupt sparse children are removed automatically.
@@ -5356,7 +5394,7 @@ TEST_F(DiskCacheEntryTest, MemoryOnlyZeroWriteBackwards) {
void DiskCacheEntryTest::SparseOffset64Bit() {
// Offsets to sparse ops are 64-bit, make sure we keep track of all of them.
// (Or, as at least in case of blockfile, fail things cleanly, as it has a
- // cap of 64GiB for indexes).
+ // cap on max offset that's much lower).
bool blockfile = !memory_only_ && !simple_cache_mode_;
InitCache();
@@ -5382,7 +5420,7 @@ void DiskCacheEntryTest::SparseOffset64Bit() {
EXPECT_EQ(0, GetAvailableRange(entry, /* offset = */ 0, kSize, &start_out));
start_out = -1;
- EXPECT_EQ(blockfile ? net::ERR_CACHE_OPERATION_NOT_SUPPORTED : kSize,
+ EXPECT_EQ(blockfile ? 0 : kSize,
GetAvailableRange(entry, kOffset, kSize, &start_out));
EXPECT_EQ(kOffset, start_out);
diff --git a/chromium/net/disk_cache/simple/simple_backend_impl.cc b/chromium/net/disk_cache/simple/simple_backend_impl.cc
index b01fce4d4a3..b8b40267592 100644
--- a/chromium/net/disk_cache/simple/simple_backend_impl.cc
+++ b/chromium/net/disk_cache/simple/simple_backend_impl.cc
@@ -363,7 +363,7 @@ void SimpleBackendImpl::DoomEntries(std::vector<uint64_t>* entry_hashes,
}
// Taking this pointer here avoids undefined behaviour from calling
- // base::Passed before mass_doom_entry_hashes.get().
+ // std::move() before mass_doom_entry_hashes.get().
std::vector<uint64_t>* mass_doom_entry_hashes_ptr =
mass_doom_entry_hashes.get();
@@ -372,7 +372,7 @@ void SimpleBackendImpl::DoomEntries(std::vector<uint64_t>* entry_hashes,
base::BindOnce(&SimpleSynchronousEntry::DeleteEntrySetFiles,
mass_doom_entry_hashes_ptr, path_),
base::BindOnce(&SimpleBackendImpl::DoomEntriesComplete, AsWeakPtr(),
- base::Passed(&mass_doom_entry_hashes), barrier_callback));
+ std::move(mass_doom_entry_hashes), barrier_callback));
}
int32_t SimpleBackendImpl::GetEntryCount() const {
diff --git a/chromium/net/disk_cache/simple/simple_entry_impl.cc b/chromium/net/disk_cache/simple/simple_entry_impl.cc
index 9618066a2d3..84833b9dd04 100644
--- a/chromium/net/disk_cache/simple/simple_entry_impl.cc
+++ b/chromium/net/disk_cache/simple/simple_entry_impl.cc
@@ -857,7 +857,7 @@ void SimpleEntryImpl::OpenEntryInternal(
base::OnceClosure reply = base::BindOnce(
&SimpleEntryImpl::CreationOperationComplete, this, result_state,
- std::move(callback), start_time, last_used_time, base::Passed(&results),
+ std::move(callback), start_time, last_used_time, std::move(results),
net::NetLogEventType::SIMPLE_CACHE_ENTRY_OPEN_END);
prioritized_task_runner_->PostTaskAndReply(FROM_HERE, std::move(task),
@@ -902,7 +902,7 @@ void SimpleEntryImpl::CreateEntryInternal(
start_time, file_tracker_, results.get());
OnceClosure reply = base::BindOnce(
&SimpleEntryImpl::CreationOperationComplete, this, result_state,
- std::move(callback), start_time, base::Time(), base::Passed(&results),
+ std::move(callback), start_time, base::Time(), std::move(results),
net::NetLogEventType::SIMPLE_CACHE_ENTRY_CREATE_END);
prioritized_task_runner_->PostTaskAndReply(FROM_HERE, std::move(task),
std::move(reply), entry_priority_);
@@ -965,7 +965,7 @@ void SimpleEntryImpl::OpenOrCreateEntryInternal(
base::OnceClosure reply = base::BindOnce(
&SimpleEntryImpl::CreationOperationComplete, this, result_state,
- std::move(callback), start_time, last_used_time, base::Passed(&results),
+ std::move(callback), start_time, last_used_time, std::move(results),
net::NetLogEventType::SIMPLE_CACHE_ENTRY_OPEN_OR_CREATE_END);
prioritized_task_runner_->PostTaskAndReply(FROM_HERE, std::move(task),
@@ -1011,10 +1011,10 @@ void SimpleEntryImpl::CloseInternal() {
&SimpleSynchronousEntry::Close, base::Unretained(synchronous_entry_),
SimpleEntryStat(last_used_, last_modified_, data_size_,
sparse_data_size_),
- base::Passed(&crc32s_to_write), base::RetainedRef(stream_0_data_),
+ std::move(crc32s_to_write), base::RetainedRef(stream_0_data_),
results.get());
OnceClosure reply = base::BindOnce(&SimpleEntryImpl::CloseOperationComplete,
- this, base::Passed(&results));
+ this, std::move(results));
synchronous_entry_ = nullptr;
prioritized_task_runner_->PostTaskAndReply(
FROM_HERE, std::move(task), std::move(reply), entry_priority_);
@@ -1121,7 +1121,7 @@ int SimpleEntryImpl::ReadDataInternal(bool sync_possible,
read_req, entry_stat.get(), base::RetainedRef(buf), result.get());
OnceClosure reply = base::BindOnce(
&SimpleEntryImpl::ReadOperationComplete, this, stream_index, offset,
- std::move(callback), base::Passed(&entry_stat), base::Passed(&result));
+ std::move(callback), std::move(entry_stat), std::move(result));
prioritized_task_runner_->PostTaskAndReply(FROM_HERE, std::move(task),
std::move(reply), entry_priority_);
return net::ERR_IO_PENDING;
@@ -1239,10 +1239,10 @@ void SimpleEntryImpl::WriteDataInternal(int stream_index,
stream_index, offset, buf_len, initial_crc, truncate,
doom_state_ != DOOM_NONE, request_update_crc),
base::Unretained(buf), entry_stat.get(), write_result.get());
- OnceClosure reply = base::BindOnce(
- &SimpleEntryImpl::WriteOperationComplete, this, stream_index,
- std::move(callback), base::Passed(&entry_stat),
- base::Passed(&write_result), base::RetainedRef(buf));
+ OnceClosure reply =
+ base::BindOnce(&SimpleEntryImpl::WriteOperationComplete, this,
+ stream_index, std::move(callback), std::move(entry_stat),
+ std::move(write_result), base::RetainedRef(buf));
prioritized_task_runner_->PostTaskAndReply(FROM_HERE, std::move(task),
std::move(reply), entry_priority_);
}
@@ -1287,7 +1287,7 @@ void SimpleEntryImpl::ReadSparseDataInternal(
base::RetainedRef(buf), last_used.get(), result.get());
OnceClosure reply = base::BindOnce(
&SimpleEntryImpl::ReadSparseOperationComplete, this, std::move(callback),
- base::Passed(&last_used), base::Passed(&result));
+ std::move(last_used), std::move(result));
prioritized_task_runner_->PostTaskAndReply(FROM_HERE, std::move(task),
std::move(reply), entry_priority_);
}
@@ -1343,7 +1343,7 @@ void SimpleEntryImpl::WriteSparseDataInternal(
result.get());
OnceClosure reply = base::BindOnce(
&SimpleEntryImpl::WriteSparseOperationComplete, this, std::move(callback),
- base::Passed(&entry_stat), base::Passed(&result));
+ std::move(entry_stat), std::move(result));
prioritized_task_runner_->PostTaskAndReply(FROM_HERE, std::move(task),
std::move(reply), entry_priority_);
}
@@ -1376,7 +1376,7 @@ void SimpleEntryImpl::GetAvailableRangeInternal(
out_start, result.get());
OnceClosure reply =
base::BindOnce(&SimpleEntryImpl::GetAvailableRangeOperationComplete, this,
- std::move(callback), base::Passed(&result));
+ std::move(callback), std::move(result));
prioritized_task_runner_->PostTaskAndReply(FROM_HERE, std::move(task),
std::move(reply), entry_priority_);
}
diff --git a/chromium/net/disk_cache/simple/simple_histogram_macros.h b/chromium/net/disk_cache/simple/simple_histogram_macros.h
index e10764d5dd3..84d0a57e490 100644
--- a/chromium/net/disk_cache/simple/simple_histogram_macros.h
+++ b/chromium/net/disk_cache/simple/simple_histogram_macros.h
@@ -31,10 +31,6 @@
SIMPLE_CACHE_THUNK(uma_type, \
("SimpleCache.App." uma_name, ##__VA_ARGS__)); \
break; \
- case net::MEDIA_CACHE: \
- SIMPLE_CACHE_THUNK(uma_type, \
- ("SimpleCache.Media." uma_name, ##__VA_ARGS__)); \
- break; \
case net::GENERATED_BYTE_CODE_CACHE: \
case net::GENERATED_NATIVE_CODE_CACHE: \
case net::SHADER_CACHE: \
diff --git a/chromium/net/disk_cache/simple/simple_index.cc b/chromium/net/disk_cache/simple/simple_index.cc
index 0db2b990ba6..323a23cf92b 100644
--- a/chromium/net/disk_cache/simple/simple_index.cc
+++ b/chromium/net/disk_cache/simple/simple_index.cc
@@ -461,8 +461,8 @@ void SimpleIndex::StartEvictionIfNeeded() {
static_cast<base::HistogramBase::Sample>(
evicted_so_far_size / kBytesInKb));
- delegate_->DoomEntries(&entry_hashes, base::Bind(&SimpleIndex::EvictionDone,
- AsWeakPtr()));
+ delegate_->DoomEntries(
+ &entry_hashes, base::BindOnce(&SimpleIndex::EvictionDone, AsWeakPtr()));
}
int32_t SimpleIndex::GetTrailerPrefetchSize(uint64_t entry_hash) const {