chromium/extensions/renderer/extension_throttle_entry.cc

// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "extensions/renderer/extension_throttle_entry.h"

#include <algorithm>
#include <cmath>
#include <memory>
#include <utility>

#include "base/check_op.h"
#include "base/rand_util.h"
#include "base/strings/string_number_conversions.h"
#include "base/values.h"

namespace extensions {

const int ExtensionThrottleEntry::kDefaultSlidingWindowPeriodMs =;
const int ExtensionThrottleEntry::kDefaultMaxSendThreshold =;

// This set of back-off parameters will (at maximum values, i.e. without
// the reduction caused by jitter) add 0-41% (distributed uniformly
// in that range) to the "perceived downtime" of the remote server, once
// exponential back-off kicks in and is throttling requests for more than
// about a second at a time.  Once the maximum back-off is reached, the added
// perceived downtime decreases rapidly, percentage-wise.
//
// Another way to put it is that the maximum additional perceived downtime
// with these numbers is a couple of seconds shy of 15 minutes, and such
// a delay would not occur until the remote server has been actually
// unavailable at the end of each back-off period for a total of about
// 48 minutes.
//
// Ignoring the first couple of errors is just a conservative measure to
// avoid false positives.  It should help avoid back-off from kicking in e.g.
// on flaky connections.
const int ExtensionThrottleEntry::kDefaultNumErrorsToIgnore =;
const int ExtensionThrottleEntry::kDefaultInitialDelayMs =;
const double ExtensionThrottleEntry::kDefaultMultiplyFactor =;
const double ExtensionThrottleEntry::kDefaultJitterFactor =;
const int ExtensionThrottleEntry::kDefaultMaximumBackoffMs =;
const int ExtensionThrottleEntry::kDefaultEntryLifetimeMs =;

ExtensionThrottleEntry::ExtensionThrottleEntry(const std::string& url_id)
    :{}

ExtensionThrottleEntry::ExtensionThrottleEntry(
    const std::string& url_id,
    const net::BackoffEntry::Policy* backoff_policy)
    :{}

bool ExtensionThrottleEntry::IsEntryOutdated() const {}

void ExtensionThrottleEntry::DisableBackoffThrottling() {}

bool ExtensionThrottleEntry::ShouldRejectRequest() const {}

int64_t ExtensionThrottleEntry::ReserveSendingTimeForNextRequest(
    const base::TimeTicks& earliest_time) {}

base::TimeTicks ExtensionThrottleEntry::GetExponentialBackoffReleaseTime()
    const {}

void ExtensionThrottleEntry::UpdateWithResponse(int status_code) {}

void ExtensionThrottleEntry::ReceivedContentWasMalformed(int response_code) {}

const std::string& ExtensionThrottleEntry::GetURLIdForDebugging() const {}

ExtensionThrottleEntry::~ExtensionThrottleEntry() = default;

void ExtensionThrottleEntry::Initialize() {}

bool ExtensionThrottleEntry::IsConsideredSuccess(int response_code) {}

base::TimeTicks ExtensionThrottleEntry::ImplGetTimeNow() const {}

const net::BackoffEntry* ExtensionThrottleEntry::GetBackoffEntry() const {}

net::BackoffEntry* ExtensionThrottleEntry::GetBackoffEntry() {}

}  // namespace extensions