Commit 55d8326f authored by John Abd-El-Malek's avatar John Abd-El-Malek Committed by Commit Bot

Remove obsolete NetworkContext::DiskCheck code.

Bug: 711579
Cq-Include-Trybots: master.tryserver.chromium.linux:linux_mojo
Change-Id: If272f72850da85b7959df00de5c1b5f97600f520
Reviewed-on: https://chromium-review.googlesource.com/830653Reviewed-by: default avatarMark Pearson <mpearson@chromium.org>
Commit-Queue: John Abd-El-Malek <jam@chromium.org>
Cr-Commit-Position: refs/heads/master@{#524734}
parent 25ea4099
......@@ -7,12 +7,9 @@
#include <memory>
#include "base/command_line.h"
#include "base/files/file_util.h"
#include "base/logging.h"
#include "base/message_loop/message_loop.h"
#include "base/metrics/histogram_macros.h"
#include "base/optional.h"
#include "base/rand_util.h"
#include "base/strings/string_number_conversions.h"
#include "base/task_scheduler/post_task.h"
#include "base/task_scheduler/task_traits.h"
......@@ -82,11 +79,6 @@ NetworkContext::NetworkContext(
: network_service_(network_service),
params_(std::move(params)),
binding_(this, std::move(request)) {
if (params_ && params_->http_cache_path) {
// Only sample 0.1% of NetworkContexts that get created.
if (base::RandUint64() % 1000 == 0)
disk_checker_ = std::make_unique<DiskChecker>(*params_->http_cache_path);
}
network_service_->RegisterNetworkContext(this);
ApplyContextParamsToBuilder(builder.get(), params_.get());
owned_url_request_context_ = builder->Build();
......@@ -186,30 +178,6 @@ void NetworkContext::OnConnectionError() {
delete this;
}
NetworkContext::DiskChecker::DiskChecker(const base::FilePath& cache_path)
: cache_path_(cache_path) {
timer_.Start(FROM_HERE, base::TimeDelta::FromHours(24),
base::Bind(&DiskChecker::CheckDiskSize, base::Unretained(this)));
// Check disk size at startup, hopefully before the HTTPCache has been cleared
// from the previous run.
CheckDiskSize();
}
void NetworkContext::DiskChecker::CheckDiskSize() {
base::PostTaskWithTraits(
FROM_HERE, {base::MayBlock(), base::TaskPriority::BACKGROUND},
base::Bind(&DiskChecker::CheckDiskSizeOnBackgroundThread, cache_path_));
}
void NetworkContext::DiskChecker::CheckDiskSizeOnBackgroundThread(
const base::FilePath& cache_path) {
int64_t size = base::ComputeDirectorySize(cache_path);
UMA_HISTOGRAM_MEMORY_LARGE_MB("Net.DiskCache.Size", size / 1024 / 1024);
}
NetworkContext::DiskChecker::~DiskChecker() = default;
std::unique_ptr<net::URLRequestContext> NetworkContext::MakeURLRequestContext(
mojom::NetworkContextParams* network_context_params) {
URLRequestContextBuilderMojo builder;
......
......@@ -13,7 +13,6 @@
#include "base/callback.h"
#include "base/macros.h"
#include "base/time/time.h"
#include "base/timer/timer.h"
#include "content/common/content_export.h"
#include "content/network/cookie_manager.h"
#include "content/public/common/network_service.mojom.h"
......@@ -145,24 +144,6 @@ class CONTENT_EXPORT NetworkContext : public mojom::NetworkContext {
std::unique_ptr<CookieManager> cookie_manager_;
// Temporary class to help diagnose the impact of https://crbug.com/711579.
// Every 24-hours, measures the size of the network cache and emits an UMA
// metric.
class DiskChecker {
public:
explicit DiskChecker(const base::FilePath& cache_path);
~DiskChecker();
private:
void CheckDiskSize();
static void CheckDiskSizeOnBackgroundThread(
const base::FilePath& cache_path);
base::RepeatingTimer timer_;
base::FilePath cache_path_;
DISALLOW_COPY_AND_ASSIGN(DiskChecker);
};
std::unique_ptr<DiskChecker> disk_checker_;
DISALLOW_COPY_AND_ASSIGN(NetworkContext);
};
......
......@@ -42295,6 +42295,9 @@ http://cs/file:chrome/histograms.xml - but prefer this file for new entries.
</histogram>
<histogram name="Net.DiskCache.Size" units="MB">
<obsolete>
Removed in Chrome 65.
</obsolete>
<owner>erikchen@chromium.org</owner>
<summary>
The sum of the size of all files in the HTTP cache directory.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment