summaryrefslogtreecommitdiff
path: root/chromium/net/disk_cache/blockfile
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2022-05-12 15:59:20 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2022-05-25 06:57:22 +0000
commitf7eaed5286974984ba5f9e3189d8f49d03e99f81 (patch)
treecaed19b2af2024f35449fb0b781d0a25e09d4f8f /chromium/net/disk_cache/blockfile
parent9729c4479fe23554eae6e6dd1f30ff488f470c84 (diff)
downloadqtwebengine-chromium-f7eaed5286974984ba5f9e3189d8f49d03e99f81.tar.gz
BASELINE: Update Chromium to 100.0.4896.167
Change-Id: I98cbeb5d7543d966ffe04d8cefded0c493a11333 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'chromium/net/disk_cache/blockfile')
-rw-r--r--chromium/net/disk_cache/blockfile/block_files.cc14
-rw-r--r--chromium/net/disk_cache/blockfile/block_files.h4
-rw-r--r--chromium/net/disk_cache/blockfile/histogram_macros.h2
-rw-r--r--chromium/net/disk_cache/blockfile/in_flight_backend_io.h1
-rw-r--r--chromium/net/disk_cache/blockfile/mapped_file.h2
-rw-r--r--chromium/net/disk_cache/blockfile/rankings.cc4
6 files changed, 11 insertions, 16 deletions
diff --git a/chromium/net/disk_cache/blockfile/block_files.cc b/chromium/net/disk_cache/blockfile/block_files.cc
index 9a8706690bc..0f9a78a6ff1 100644
--- a/chromium/net/disk_cache/blockfile/block_files.cc
+++ b/chromium/net/disk_cache/blockfile/block_files.cc
@@ -256,12 +256,9 @@ BlockFileHeader* BlockHeader::Header() {
// ------------------------------------------------------------------------
-BlockFiles::BlockFiles(const base::FilePath& path)
- : init_(false), zero_buffer_(nullptr), path_(path) {}
+BlockFiles::BlockFiles(const base::FilePath& path) : path_(path) {}
BlockFiles::~BlockFiles() {
- if (zero_buffer_)
- delete[] zero_buffer_;
CloseFiles();
}
@@ -343,19 +340,18 @@ void BlockFiles::DeleteBlock(Addr address, bool deep) {
if (!address.is_initialized() || address.is_separate_file())
return;
- if (!zero_buffer_) {
- zero_buffer_ = new char[Addr::BlockSizeForFileType(BLOCK_4K) * 4];
- memset(zero_buffer_, 0, Addr::BlockSizeForFileType(BLOCK_4K) * 4);
- }
MappedFile* file = GetFile(address);
if (!file)
return;
+ if (zero_buffer_.empty())
+ zero_buffer_.resize(Addr::BlockSizeForFileType(BLOCK_4K) * 4, 0);
+
size_t size = address.BlockSize() * address.num_blocks();
size_t offset = address.start_block() * address.BlockSize() +
kBlockHeaderSize;
if (deep)
- file->Write(zero_buffer_, size, offset);
+ file->Write(zero_buffer_.data(), size, offset);
BlockHeader file_header(file);
file_header.DeleteMapBlock(address.start_block(), address.num_blocks());
diff --git a/chromium/net/disk_cache/blockfile/block_files.h b/chromium/net/disk_cache/blockfile/block_files.h
index 77d5e225715..6bfd7e20be6 100644
--- a/chromium/net/disk_cache/blockfile/block_files.h
+++ b/chromium/net/disk_cache/blockfile/block_files.h
@@ -151,8 +151,8 @@ class NET_EXPORT_PRIVATE BlockFiles {
// Returns the filename for a given file index.
base::FilePath Name(int index);
- bool init_;
- raw_ptr<char> zero_buffer_; // Buffer to speed-up cleaning deleted entries.
+ bool init_ = false;
+ std::vector<char> zero_buffer_; // Speed-up cleaning deleted entries.
base::FilePath path_; // Path to the backing folder.
std::vector<scoped_refptr<MappedFile>> block_files_; // The actual files.
std::unique_ptr<base::ThreadChecker> thread_checker_;
diff --git a/chromium/net/disk_cache/blockfile/histogram_macros.h b/chromium/net/disk_cache/blockfile/histogram_macros.h
index f5e09f428b3..dd77f405bff 100644
--- a/chromium/net/disk_cache/blockfile/histogram_macros.h
+++ b/chromium/net/disk_cache/blockfile/histogram_macros.h
@@ -95,7 +95,7 @@
case net::REMOVED_MEDIA_CACHE: \
default: \
NOTREACHED(); \
- FALLTHROUGH; \
+ [[fallthrough]]; \
case net::DISK_CACHE: \
case net::APP_CACHE: \
case net::SHADER_CACHE: \
diff --git a/chromium/net/disk_cache/blockfile/in_flight_backend_io.h b/chromium/net/disk_cache/blockfile/in_flight_backend_io.h
index 7e8c3b92c56..c5abe9e9ff7 100644
--- a/chromium/net/disk_cache/blockfile/in_flight_backend_io.h
+++ b/chromium/net/disk_cache/blockfile/in_flight_backend_io.h
@@ -7,7 +7,6 @@
#include <stdint.h>
-#include <list>
#include <string>
#include "base/memory/raw_ptr.h"
diff --git a/chromium/net/disk_cache/blockfile/mapped_file.h b/chromium/net/disk_cache/blockfile/mapped_file.h
index bbd2d2b960c..31f618aad9a 100644
--- a/chromium/net/disk_cache/blockfile/mapped_file.h
+++ b/chromium/net/disk_cache/blockfile/mapped_file.h
@@ -57,7 +57,7 @@ class NET_EXPORT_PRIVATE MappedFile : public File {
~MappedFile() override;
bool init_;
-#if defined(OS_WIN)
+#if BUILDFLAG(IS_WIN)
HANDLE section_;
#endif
void* buffer_; // Address of the memory mapped buffer.
diff --git a/chromium/net/disk_cache/blockfile/rankings.cc b/chromium/net/disk_cache/blockfile/rankings.cc
index 2fecdf9e2f3..c316c2e7063 100644
--- a/chromium/net/disk_cache/blockfile/rankings.cc
+++ b/chromium/net/disk_cache/blockfile/rankings.cc
@@ -20,7 +20,7 @@
#include "net/disk_cache/blockfile/histogram_macros.h"
#include "net/disk_cache/blockfile/stress_support.h"
-#if defined(OS_WIN)
+#if BUILDFLAG(IS_WIN)
#include <windows.h>
#endif
@@ -91,7 +91,7 @@ enum CrashLocation {
// builds, according to the value of g_rankings_crash. This used by
// crash_cache.exe to generate unit-test files.
void GenerateCrash(CrashLocation location) {
-#if !defined(NDEBUG) && !defined(OS_IOS)
+#if !defined(NDEBUG) && !BUILDFLAG(IS_IOS)
if (disk_cache::NO_CRASH == disk_cache::g_rankings_crash)
return;
switch (location) {