summaryrefslogtreecommitdiffstats
path: root/extensions/browser/extension_throttle_entry_interface.h
diff options
context:
space:
mode:
authoroshima <oshima@chromium.org>2015-06-15 19:58:06 -0700
committerCommit bot <commit-bot@chromium.org>2015-06-16 02:59:16 +0000
commit94585c59bd8ca7c0aed789dc1e893b125aca8a3d (patch)
treec1aff60d8107e3b8a3520edbd392a81f2efee316 /extensions/browser/extension_throttle_entry_interface.h
parentc90d79007cf8709f11d967887feb790eaa8483ad (diff)
downloadchromium_src-94585c59bd8ca7c0aed789dc1e893b125aca8a3d.zip
chromium_src-94585c59bd8ca7c0aed789dc1e893b125aca8a3d.tar.gz
chromium_src-94585c59bd8ca7c0aed789dc1e893b125aca8a3d.tar.bz2
Revert "Make a ResourceThrottle for extensions on top of net::URLRequestThrottlerManager."
Reason for revert: Conditional jump on uninitialied value was reported on memory bot. See crbug.com/500769 for log. > Make a ResourceThrottle for extensions on top of net::URLRequestThrottlerManager. > > net::URLRequestThrottlerManager is used for throttling extensions originated > requests. We would like to move it out of net/ and place it in a more appropriate > directory. Since content::ResourceThrottle is the standard way to throttle > requests, this CL makes URLRequestThrottlerManager into a extensions > ResourceThrottle and place it in extensions/browser/. Followup CLs will clean up > URLRequestThrottlerManager usage from net/. > > BUG=484241 > > Review URL: https://codereview.chromium.org/1171983003 > > Cr-Commit-Position: refs/heads/master@{#334457} BUG=484241, 500769 TBR=xunjieli@chromium.org Initialize num_flush_callbacks_ BUG=500764 TBR=bubbe@chromium.org Review URL: https://codereview.chromium.org/1191543004 Cr-Commit-Position: refs/heads/master@{#334544}
Diffstat (limited to 'extensions/browser/extension_throttle_entry_interface.h')
-rw-r--r--extensions/browser/extension_throttle_entry_interface.h76
1 files changed, 0 insertions, 76 deletions
diff --git a/extensions/browser/extension_throttle_entry_interface.h b/extensions/browser/extension_throttle_entry_interface.h
deleted file mode 100644
index 99989b8..0000000
--- a/extensions/browser/extension_throttle_entry_interface.h
+++ /dev/null
@@ -1,76 +0,0 @@
-// Copyright (c) 2012 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 EXTENSIONS_BROWSER_EXTENSION_THROTTLE_ENTRY_INTERFACE_H_
-#define EXTENSIONS_BROWSER_EXTENSION_THROTTLE_ENTRY_INTERFACE_H_
-
-#include <string>
-
-#include "base/basictypes.h"
-#include "base/memory/ref_counted.h"
-#include "base/time/time.h"
-#include "net/base/net_export.h"
-
-namespace net {
-class URLRequest;
-} // namespace net
-
-namespace extensions {
-
-// Interface provided on entries of the URL request throttler manager.
-class ExtensionThrottleEntryInterface
- : public base::RefCountedThreadSafe<ExtensionThrottleEntryInterface> {
- public:
- ExtensionThrottleEntryInterface() {}
-
- // Returns true when we have encountered server errors and are doing
- // exponential back-off, unless the request has load flags that mean
- // it is likely to be user-initiated, or the NetworkDelegate returns
- // false for |CanThrottleRequest(request)|.
- //
- // URLRequestHttpJob checks this method prior to every request; it
- // cancels requests if this method returns true.
- virtual bool ShouldRejectRequest(const net::URLRequest& request) const = 0;
-
- // Calculates a recommended sending time for the next request and reserves it.
- // The sending time is not earlier than the current exponential back-off
- // release time or |earliest_time|. Moreover, the previous results of
- // the method are taken into account, in order to make sure they are spread
- // properly over time.
- // Returns the recommended delay before sending the next request, in
- // milliseconds. The return value is always positive or 0.
- // Although it is not mandatory, respecting the value returned by this method
- // is helpful to avoid traffic overload.
- virtual int64 ReserveSendingTimeForNextRequest(
- const base::TimeTicks& earliest_time) = 0;
-
- // Returns the time after which requests are allowed.
- virtual base::TimeTicks GetExponentialBackoffReleaseTime() const = 0;
-
- // This method needs to be called each time a response is received.
- virtual void UpdateWithResponse(int status_code) = 0;
-
- // Lets higher-level modules, that know how to parse particular response
- // bodies, notify of receiving malformed content for the given URL. This will
- // be handled by the throttler as if an HTTP 503 response had been received to
- // the request, i.e. it will count as a failure, unless the HTTP response code
- // indicated is already one of those that will be counted as an error.
- virtual void ReceivedContentWasMalformed(int response_code) = 0;
-
- // Get the URL ID associated with his entry. Should only be used for debugging
- // purpose.
- virtual const std::string& GetURLIdForDebugging() const = 0;
-
- protected:
- friend class base::RefCountedThreadSafe<ExtensionThrottleEntryInterface>;
- virtual ~ExtensionThrottleEntryInterface() {}
-
- private:
- friend class base::RefCounted<ExtensionThrottleEntryInterface>;
- DISALLOW_COPY_AND_ASSIGN(ExtensionThrottleEntryInterface);
-};
-
-} // namespace extensions
-
-#endif // EXTENSIONS_BROWSER_EXTENSION_THROTTLE_ENTRY_INTERFACE_H_