Commit 5ec1b0db authored by Chris Mumford's avatar Chris Mumford Committed by Commit Bot

Removed unused network logging from extensions throttle.

The extensions network throttle (ExtensionThrottleManager) used
to use the net::NetLog to log throttling activity. Logging was
only done if ExtensionThrottleManager::set_net_log was called,
but that was removed nearly four years ago in refs/heads/master@{#298862}
(https://codereview.chromium.org/631203003).

This change removes the logging implementation as these classes
will soon be moving to the render process.

Bug: 784576
Change-Id: I1025dd6f3134d438e549165f5b7045b3ecf2dc61
Reviewed-on: https://chromium-review.googlesource.com/1113899
Commit-Queue: Chris Mumford <cmumford@chromium.org>
Reviewed-by: default avatarReilly Grant <reillyg@chromium.org>
Cr-Commit-Position: refs/heads/master@{#570096}
parent a0fb4d02
......@@ -13,9 +13,6 @@
#include "base/values.h"
#include "extensions/browser/extension_throttle_manager.h"
#include "net/base/load_flags.h"
#include "net/log/net_log_capture_mode.h"
#include "net/log/net_log_event_type.h"
#include "net/log/net_log_source_type.h"
#include "net/url_request/url_request.h"
#include "net/url_request/url_request_context.h"
......@@ -47,20 +44,6 @@ const double ExtensionThrottleEntry::kDefaultJitterFactor = 0.4;
const int ExtensionThrottleEntry::kDefaultMaximumBackoffMs = 15 * 60 * 1000;
const int ExtensionThrottleEntry::kDefaultEntryLifetimeMs = 2 * 60 * 1000;
// Returns NetLog parameters when a request is rejected by throttling.
std::unique_ptr<base::Value> NetLogRejectedRequestCallback(
const std::string* url_id,
int num_failures,
const base::TimeDelta& release_after,
net::NetLogCaptureMode /* capture_mode */) {
std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
dict->SetString("url", *url_id);
dict->SetInteger("num_failures", num_failures);
dict->SetInteger("release_after_ms",
static_cast<int>(release_after.InMilliseconds()));
return std::move(dict);
}
ExtensionThrottleEntry::ExtensionThrottleEntry(
ExtensionThrottleManager* manager,
const std::string& url_id)
......@@ -78,9 +61,6 @@ ExtensionThrottleEntry::ExtensionThrottleEntry(
backoff_entry_(&backoff_policy_),
manager_(manager),
url_id_(url_id),
net_log_(net::NetLogWithSource::Make(
manager->net_log(),
net::NetLogSourceType::EXPONENTIAL_BACKOFF_THROTTLING)),
ignore_user_gesture_load_flag_for_tests_(
ignore_user_gesture_load_flag_for_tests) {
DCHECK(manager_);
......@@ -153,10 +133,6 @@ bool ExtensionThrottleEntry::ShouldRejectRequest(
if (!is_backoff_disabled_ && (ignore_user_gesture_load_flag_for_tests_ ||
!ExplicitUserRequest(request.load_flags())) &&
GetBackoffEntry()->ShouldRejectRequest()) {
net_log_.AddEvent(net::NetLogEventType::THROTTLING_REJECTED_REQUEST,
base::Bind(&NetLogRejectedRequestCallback, &url_id_,
GetBackoffEntry()->failure_count(),
GetBackoffEntry()->GetTimeUntilRelease()));
reject_request = true;
}
return reject_request;
......
......@@ -14,7 +14,6 @@
#include "base/time/time.h"
#include "extensions/browser/extension_throttle_entry_interface.h"
#include "net/base/backoff_entry.h"
#include "net/log/net_log_with_source.h"
namespace extensions {
......@@ -155,7 +154,6 @@ class ExtensionThrottleEntry : public ExtensionThrottleEntryInterface {
// Canonicalized URL string that this entry is for; used for logging only.
std::string url_id_;
net::NetLogWithSource net_log_;
bool ignore_user_gesture_load_flag_for_tests_;
DISALLOW_COPY_AND_ASSIGN(ExtensionThrottleEntry);
......
......@@ -25,7 +25,6 @@ const unsigned int ExtensionThrottleManager::kRequestsBetweenCollecting = 200;
ExtensionThrottleManager::ExtensionThrottleManager()
: requests_since_last_gc_(0),
logged_for_localhost_disabled_(false),
registered_from_thread_(base::kInvalidThreadId),
ignore_user_gesture_load_flag_for_tests_(false) {
url_id_replacements_.ClearPassword();
......@@ -99,13 +98,6 @@ ExtensionThrottleManager::RegisterRequestUrl(const GURL& url) {
// just constructed. This is to allow unit tests to explicitly override
// the entry for localhost URLs.
if (net::IsLocalhost(url)) {
if (!logged_for_localhost_disabled_) {
logged_for_localhost_disabled_ = true;
std::string host = url.host();
net_log_.AddEvent(net::NetLogEventType::THROTTLING_DISABLED_FOR_HOST,
net::NetLog::StringCallback("host", &host));
}
// TODO(joi): Once sliding window is separate from back-off throttling,
// we can simply return a dummy implementation of
// ExtensionThrottleEntryInterface here that never blocks anything.
......@@ -144,16 +136,6 @@ void ExtensionThrottleManager::SetIgnoreUserGestureLoadFlagForTests(
ignore_user_gesture_load_flag_for_tests_ = true;
}
void ExtensionThrottleManager::set_net_log(net::NetLog* net_log) {
DCHECK(net_log);
net_log_ = net::NetLogWithSource::Make(
net_log, net::NetLogSourceType::EXPONENTIAL_BACKOFF_THROTTLING);
}
net::NetLog* ExtensionThrottleManager::net_log() const {
return net_log_.net_log();
}
void ExtensionThrottleManager::OnNetworkChanged(
net::NetworkChangeNotifier::ConnectionType type) {
// When we switch from online to offline or change IP addresses, we
......
......@@ -23,11 +23,6 @@ namespace content {
class ResourceThrottle;
}
namespace net {
class NetLog;
class NetLogWithSource;
}
namespace extensions {
// Class that registers URL request throttler entries for URLs being accessed
......@@ -87,10 +82,6 @@ class ExtensionThrottleManager
void set_enforce_throttling(bool enforce);
bool enforce_throttling();
// Sets the net::NetLog instance to use.
void set_net_log(net::NetLog* net_log);
net::NetLog* net_log() const;
// NetworkChangeObserver interface.
void OnNetworkChanged(
net::NetworkChangeNotifier::ConnectionType type) override;
......@@ -135,13 +126,6 @@ class ExtensionThrottleManager
// Valid after construction.
GURL::Replacements url_id_replacements_;
// Initially false, switches to true once we have logged because of back-off
// being disabled for localhost.
bool logged_for_localhost_disabled_;
// net::NetLog to use, if configured.
net::NetLogWithSource net_log_;
// Valid once we've registered for network notifications.
base::PlatformThreadId registered_from_thread_;
......
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