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

Unified Diff: net/websockets/websocket_job.h

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.cc ('k') | net/websockets/websocket_job.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/websockets/websocket_job.h
diff --git a/net/websockets/websocket_job.h b/net/websockets/websocket_job.h
index 31fa5035109c8cdd39620e57a204e5f4e07f2d07..23140c5e99cd642aaf9b93b568f09331863b4240 100644
--- a/net/websockets/websocket_job.h
+++ b/net/websockets/websocket_job.h
@@ -9,6 +9,7 @@
#include <vector>
#include "base/ref_counted.h"
+#include "net/base/address_list.h"
#include "net/base/completion_callback.h"
#include "net/socket_stream/socket_stream_job.h"
@@ -18,10 +19,9 @@ namespace net {
// WebSocket protocol specific job on SocketStream.
// It captures WebSocket handshake message and handles cookie operations.
-// Chome security policy doesn't allow renderer process (except dev tools)
+// Chrome security policy doesn't allow renderer process (except dev tools)
// see HttpOnly cookies, so it injects cookie header in handshake request and
// strips set-cookie headers in handshake response.
-// TODO(ukai): refactor to merge WebSocketThrottle functionality.
// TODO(ukai): refactor websocket.cc to use this.
class WebSocketJob : public SocketStreamJob, public SocketStream::Delegate {
public:
@@ -36,6 +36,7 @@ class WebSocketJob : public SocketStreamJob, public SocketStream::Delegate {
explicit WebSocketJob(SocketStream::Delegate* delegate);
+ State state() const { return state_; }
virtual void Connect();
virtual bool SendData(const char* data, int len);
virtual void Close();
@@ -45,6 +46,8 @@ class WebSocketJob : public SocketStreamJob, public SocketStream::Delegate {
virtual void DetachDelegate();
// SocketStream::Delegate methods.
+ virtual int OnStartOpenConnection(
+ SocketStream* socket, CompletionCallback* callback);
virtual void OnConnected(
SocketStream* socket, int max_pending_send_allowed);
virtual void OnSentData(
@@ -58,6 +61,7 @@ class WebSocketJob : public SocketStreamJob, public SocketStream::Delegate {
const SocketStream* socket, int error);
private:
+ friend class WebSocketThrottle;
friend class WebSocketJobTest;
virtual ~WebSocketJob();
@@ -74,8 +78,16 @@ class WebSocketJob : public SocketStreamJob, public SocketStream::Delegate {
GURL GetURLForCookies() const;
+ const AddressList& address_list() const;
+ void SetWaiting();
+ bool IsWaiting() const;
+ void Wakeup();
+
SocketStream::Delegate* delegate_;
State state_;
+ bool waiting_;
+ AddressList addresses_;
+ CompletionCallback* callback_; // for throttling.
std::string original_handshake_request_;
int original_handshake_request_header_length_;
« no previous file with comments | « net/socket_stream/socket_stream_throttle.cc ('k') | net/websockets/websocket_job.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698