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

Unified Diff: net/socket_stream/socket_stream_throttle.cc

Issue 669157: Refactor WebSocket throttling feature. (Closed)
Patch Set: Fix for tyoshino's comment Created 10 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 | « net/socket_stream/socket_stream_throttle.h ('k') | net/websockets/websocket_job.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/socket_stream/socket_stream_throttle.cc
diff --git a/net/socket_stream/socket_stream_throttle.cc b/net/socket_stream/socket_stream_throttle.cc
deleted file mode 100644
index 6a1d20df692bd315d4b0c892672280e87a15946b..0000000000000000000000000000000000000000
--- a/net/socket_stream/socket_stream_throttle.cc
+++ /dev/null
@@ -1,80 +0,0 @@
-// Copyright (c) 2009 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.
-
-#include <string>
-
-#include "net/socket_stream/socket_stream_throttle.h"
-
-#include "base/hash_tables.h"
-#include "base/singleton.h"
-#include "net/base/completion_callback.h"
-#include "net/socket_stream/socket_stream.h"
-
-namespace net {
-
-// Default SocketStreamThrottle. No throttling. Used for unknown URL scheme.
-class DefaultSocketStreamThrottle : public SocketStreamThrottle {
- private:
- DefaultSocketStreamThrottle() {}
- virtual ~DefaultSocketStreamThrottle() {}
- friend struct DefaultSingletonTraits<DefaultSocketStreamThrottle>;
-
- DISALLOW_COPY_AND_ASSIGN(DefaultSocketStreamThrottle);
-};
-
-class SocketStreamThrottleRegistry {
- public:
- SocketStreamThrottle* GetSocketStreamThrottleForScheme(
- const std::string& scheme);
-
- void RegisterSocketStreamThrottle(
- const std::string& scheme, SocketStreamThrottle* throttle);
-
- private:
- typedef base::hash_map<std::string, SocketStreamThrottle*> ThrottleMap;
-
- SocketStreamThrottleRegistry() {}
- ~SocketStreamThrottleRegistry() {}
- friend struct DefaultSingletonTraits<SocketStreamThrottleRegistry>;
-
- ThrottleMap throttles_;
-
- DISALLOW_COPY_AND_ASSIGN(SocketStreamThrottleRegistry);
-};
-
-SocketStreamThrottle*
-SocketStreamThrottleRegistry::GetSocketStreamThrottleForScheme(
- const std::string& scheme) {
- ThrottleMap::const_iterator found = throttles_.find(scheme);
- if (found == throttles_.end()) {
- SocketStreamThrottle* throttle =
- Singleton<DefaultSocketStreamThrottle>::get();
- throttles_[scheme] = throttle;
- return throttle;
- }
- return found->second;
-}
-
-void SocketStreamThrottleRegistry::RegisterSocketStreamThrottle(
- const std::string& scheme, SocketStreamThrottle* throttle) {
- throttles_[scheme] = throttle;
-}
-
-/* static */
-SocketStreamThrottle* SocketStreamThrottle::GetSocketStreamThrottleForScheme(
- const std::string& scheme) {
- SocketStreamThrottleRegistry* registry =
- Singleton<SocketStreamThrottleRegistry>::get();
- return registry->GetSocketStreamThrottleForScheme(scheme);
-}
-
-/* static */
-void SocketStreamThrottle::RegisterSocketStreamThrottle(
- const std::string& scheme, SocketStreamThrottle* throttle) {
- SocketStreamThrottleRegistry* registry =
- Singleton<SocketStreamThrottleRegistry>::get();
- registry->RegisterSocketStreamThrottle(scheme, throttle);
-}
-
-} // namespace net
« no previous file with comments | « net/socket_stream/socket_stream_throttle.h ('k') | net/websockets/websocket_job.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698