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

Side by Side Diff: net/tools/flip_server/spdy_interface.h

Issue 93793004: Format and Refactor Flip Server. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef NET_TOOLS_FLIP_SERVER_SPDY_INTERFACE_H_ 5 #ifndef NET_TOOLS_FLIP_SERVER_SPDY_INTERFACE_H_
6 #define NET_TOOLS_FLIP_SERVER_SPDY_INTERFACE_H_ 6 #define NET_TOOLS_FLIP_SERVER_SPDY_INTERFACE_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/compiler_specific.h" 12 #include "base/compiler_specific.h"
13 #include "net/spdy/buffered_spdy_framer.h" 13 #include "net/spdy/buffered_spdy_framer.h"
14 #include "net/spdy/spdy_protocol.h" 14 #include "net/spdy/spdy_protocol.h"
15 #include "net/tools/balsa/balsa_headers.h" 15 #include "net/tools/balsa/balsa_headers.h"
16 #include "net/tools/balsa/balsa_visitor_interface.h" 16 #include "net/tools/balsa/balsa_visitor_interface.h"
17 #include "net/tools/flip_server/output_ordering.h" 17 #include "net/tools/flip_server/output_ordering.h"
18 #include "net/tools/flip_server/sm_connection.h" 18 #include "net/tools/flip_server/sm_connection.h"
19 #include "net/tools/flip_server/sm_interface.h" 19 #include "net/tools/flip_server/sm_interface.h"
20 20
21 namespace net { 21 namespace net {
22 22
23 class FlipAcceptor; 23 class FlipAcceptor;
24 class MemoryCache; 24 class MemoryCache;
25 25
26 class SpdySM : public BufferedSpdyFramerVisitorInterface, 26 class SpdySM : public BufferedSpdyFramerVisitorInterface, public SMInterface {
27 public SMInterface {
28 public: 27 public:
29 SpdySM(SMConnection* connection, 28 SpdySM(SMConnection* connection,
30 SMInterface* sm_http_interface, 29 SMInterface* sm_http_interface,
31 EpollServer* epoll_server, 30 EpollServer* epoll_server,
32 MemoryCache* memory_cache, 31 MemoryCache* memory_cache,
33 FlipAcceptor* acceptor, 32 FlipAcceptor* acceptor,
34 SpdyMajorVersion spdy_version); 33 SpdyMajorVersion spdy_version);
35 virtual ~SpdySM(); 34 virtual ~SpdySM();
36 35
37 virtual void InitSMInterface(SMInterface* sm_http_interface, 36 virtual void InitSMInterface(SMInterface* sm_http_interface,
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 virtual void NewStream(uint32 stream_id, 142 virtual void NewStream(uint32 stream_id,
144 uint32 priority, 143 uint32 priority,
145 const std::string& filename) OVERRIDE; 144 const std::string& filename) OVERRIDE;
146 void AddToOutputOrder(const MemCacheIter& mci); 145 void AddToOutputOrder(const MemCacheIter& mci);
147 virtual void SendEOF(uint32 stream_id) OVERRIDE; 146 virtual void SendEOF(uint32 stream_id) OVERRIDE;
148 virtual void SendErrorNotFound(uint32 stream_id) OVERRIDE; 147 virtual void SendErrorNotFound(uint32 stream_id) OVERRIDE;
149 virtual size_t SendSynStream(uint32 stream_id, 148 virtual size_t SendSynStream(uint32 stream_id,
150 const BalsaHeaders& headers) OVERRIDE; 149 const BalsaHeaders& headers) OVERRIDE;
151 virtual size_t SendSynReply(uint32 stream_id, 150 virtual size_t SendSynReply(uint32 stream_id,
152 const BalsaHeaders& headers) OVERRIDE; 151 const BalsaHeaders& headers) OVERRIDE;
153 virtual void SendDataFrame(uint32 stream_id, const char* data, int64 len, 152 virtual void SendDataFrame(uint32 stream_id,
154 uint32 flags, bool compress) OVERRIDE; 153 const char* data,
154 int64 len,
155 uint32 flags,
156 bool compress) OVERRIDE;
155 BufferedSpdyFramer* spdy_framer() { return buffered_spdy_framer_; } 157 BufferedSpdyFramer* spdy_framer() { return buffered_spdy_framer_; }
156 158
157 const OutputOrdering& output_ordering() const { 159 const OutputOrdering& output_ordering() const {
158 return client_output_ordering_; 160 return client_output_ordering_;
159 } 161 }
160 162
161 static std::string forward_ip_header() { return forward_ip_header_; } 163 static std::string forward_ip_header() { return forward_ip_header_; }
162 static void set_forward_ip_header(const std::string& value) { 164 static void set_forward_ip_header(const std::string& value) {
163 forward_ip_header_ = value; 165 forward_ip_header_ = value;
164 } 166 }
165 167
166 private: 168 private:
167 void SendEOFImpl(uint32 stream_id); 169 void SendEOFImpl(uint32 stream_id);
168 void SendErrorNotFoundImpl(uint32 stream_id); 170 void SendErrorNotFoundImpl(uint32 stream_id);
169 void KillStream(uint32 stream_id); 171 void KillStream(uint32 stream_id);
170 void CopyHeaders(SpdyHeaderBlock& dest, const BalsaHeaders& headers); 172 void CopyHeaders(SpdyHeaderBlock& dest, const BalsaHeaders& headers);
171 size_t SendSynStreamImpl(uint32 stream_id, const BalsaHeaders& headers); 173 size_t SendSynStreamImpl(uint32 stream_id, const BalsaHeaders& headers);
172 size_t SendSynReplyImpl(uint32 stream_id, const BalsaHeaders& headers); 174 size_t SendSynReplyImpl(uint32 stream_id, const BalsaHeaders& headers);
173 void SendDataFrameImpl(uint32 stream_id, const char* data, int64 len, 175 void SendDataFrameImpl(uint32 stream_id,
174 SpdyDataFlags flags, bool compress); 176 const char* data,
177 int64 len,
178 SpdyDataFlags flags,
179 bool compress);
175 void EnqueueDataFrame(DataFrame* df); 180 void EnqueueDataFrame(DataFrame* df);
176 virtual void GetOutput() OVERRIDE; 181 virtual void GetOutput() OVERRIDE;
177 182
178 private: 183 private:
179 BufferedSpdyFramer* buffered_spdy_framer_; 184 BufferedSpdyFramer* buffered_spdy_framer_;
180 bool valid_spdy_session_; // True if we have seen valid data on this session. 185 bool valid_spdy_session_; // True if we have seen valid data on this session.
181 // Use this to fail fast when junk is sent to our 186 // Use this to fail fast when junk is sent to our
182 // port. 187 // port.
183 188
184 SMConnection* connection_; 189 SMConnection* connection_;
185 OutputList* client_output_list_; 190 OutputList* client_output_list_;
186 OutputOrdering client_output_ordering_; 191 OutputOrdering client_output_ordering_;
187 uint32 next_outgoing_stream_id_; 192 uint32 next_outgoing_stream_id_;
188 EpollServer* epoll_server_; 193 EpollServer* epoll_server_;
189 FlipAcceptor* acceptor_; 194 FlipAcceptor* acceptor_;
190 MemoryCache* memory_cache_; 195 MemoryCache* memory_cache_;
191 std::vector<SMInterface*> server_interface_list; 196 std::vector<SMInterface*> server_interface_list;
192 std::vector<int32> unused_server_interface_list; 197 std::vector<int32> unused_server_interface_list;
193 typedef std::map<uint32, SMInterface*> StreamToSmif; 198 typedef std::map<uint32, SMInterface*> StreamToSmif;
194 StreamToSmif stream_to_smif_; 199 StreamToSmif stream_to_smif_;
195 bool close_on_error_; 200 bool close_on_error_;
196 201
197 static std::string forward_ip_header_; 202 static std::string forward_ip_header_;
198 }; 203 };
199 204
200 } // namespace net 205 } // namespace net
201 206
202 #endif // NET_TOOLS_FLIP_SERVER_SPDY_INTERFACE_H_ 207 #endif // NET_TOOLS_FLIP_SERVER_SPDY_INTERFACE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698