Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1178)

Unified Diff: content/browser/renderer_host/websocket_dispatcher_host.h

Issue 1009303002: Revert of Per-renderer WebSocket throttling (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | content/browser/renderer_host/websocket_dispatcher_host.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/renderer_host/websocket_dispatcher_host.h
diff --git a/content/browser/renderer_host/websocket_dispatcher_host.h b/content/browser/renderer_host/websocket_dispatcher_host.h
index debbf584c732138c1e31696b0f22e6f918a0dc3e..68057b683d35cbd39b86748bcaa75780ce307e32 100644
--- a/content/browser/renderer_host/websocket_dispatcher_host.h
+++ b/content/browser/renderer_host/websocket_dispatcher_host.h
@@ -5,15 +5,13 @@
#ifndef CONTENT_BROWSER_RENDERER_HOST_WEBSOCKET_DISPATCHER_HOST_H_
#define CONTENT_BROWSER_RENDERER_HOST_WEBSOCKET_DISPATCHER_HOST_H_
-#include <stdint.h>
#include <string>
#include <vector>
+#include "base/basictypes.h"
#include "base/callback.h"
#include "base/compiler_specific.h"
#include "base/containers/hash_tables.h"
-#include "base/time/time.h"
-#include "base/timer/timer.h"
#include "content/common/content_export.h"
#include "content/common/websocket.h"
#include "content/public/browser/browser_message_filter.h"
@@ -34,10 +32,9 @@
public:
typedef base::Callback<net::URLRequestContext*()> GetRequestContextCallback;
- // Given a routing_id and delay, WebSocketHostFactory returns a new
- // instance of WebSocketHost or its subclass.
- typedef base::Callback<WebSocketHost*(int, base::TimeDelta)>
- WebSocketHostFactory;
+ // Given a routing_id, WebSocketHostFactory returns a new instance of
+ // WebSocketHost or its subclass.
+ typedef base::Callback<WebSocketHost*(int)> WebSocketHostFactory; // NOLINT
// Return value for methods that may delete the WebSocketHost. This enum is
// binary-compatible with net::WebSocketEventInterface::ChannelState, to make
@@ -51,6 +48,12 @@
WebSocketDispatcherHost(
int process_id,
const GetRequestContextCallback& get_context_callback);
+
+ // For testing. Specify a factory method that creates mock version of
+ // WebSocketHost.
+ WebSocketDispatcherHost(int process_id,
+ const GetRequestContextCallback& get_context_callback,
+ const WebSocketHostFactory& websocket_host_factory);
// BrowserMessageFilter:
bool OnMessageReceived(const IPC::Message& message) override;
@@ -108,26 +111,12 @@
int render_process_id() const { return process_id_; }
- protected:
- // For testing. Specify a factory method that creates mock version of
- // WebSocketHost.
- WebSocketDispatcherHost(int process_id,
- const GetRequestContextCallback& get_context_callback,
- const WebSocketHostFactory& websocket_host_factory);
-
- int num_pending_connections() const { return num_pending_connections_; }
-
- // The number of handshakes that failed/succeeded in the current and
- // previous time period, respectively.
- int64_t num_failed_connections() const;
- int64_t num_succeeded_connections() const;
+ private:
+ typedef base::hash_map<int, WebSocketHost*> WebSocketHostTable;
~WebSocketDispatcherHost() override;
- private:
- typedef base::hash_map<int, WebSocketHost*> WebSocketHostTable;
-
- WebSocketHost* CreateWebSocketHost(int routing_id, base::TimeDelta delay);
+ WebSocketHost* CreateWebSocketHost(int routing_id);
// Looks up a WebSocketHost object by |routing_id|. Returns the object if one
// is found, or NULL otherwise.
@@ -143,14 +132,6 @@
// removes it from the |hosts_| table.
void DeleteWebSocketHost(int routing_id);
- // Calculates the delay for per-renderer WebSocket throttling.
- base::TimeDelta CalculateDelay() const;
-
- // Rotates the counts of successful and failed connections for current
- // and previous time periods. Called every two minutes while the counts
- // are non-zero.
- void ThrottlingPeriodTimerCallback();
-
// Table of WebSocketHost objects, owned by this object, indexed by
// routing_id.
WebSocketHostTable hosts_;
@@ -164,22 +145,6 @@
WebSocketHostFactory websocket_host_factory_;
- // Timer and counters for per-renderer WebSocket throttling.
- base::RepeatingTimer<WebSocketDispatcherHost> throttling_period_timer_;
-
- // The current number of pending connections.
- int num_pending_connections_;
-
- // The number of handshakes that failed in the current and previous time
- // period.
- int64_t num_current_succeeded_connections_;
- int64_t num_previous_succeeded_connections_;
-
- // The number of handshakes that succeeded in the current and previous time
- // period.
- int64_t num_current_failed_connections_;
- int64_t num_previous_failed_connections_;
-
DISALLOW_COPY_AND_ASSIGN(WebSocketDispatcherHost);
};
« no previous file with comments | « no previous file | content/browser/renderer_host/websocket_dispatcher_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698