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

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: rebase 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
« no previous file with comments | « net/tools/flip_server/sm_interface.h ('k') | net/tools/flip_server/spdy_interface.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 virtual void NewStream(uint32 stream_id, 147 virtual void NewStream(uint32 stream_id,
149 uint32 priority, 148 uint32 priority,
150 const std::string& filename) OVERRIDE; 149 const std::string& filename) OVERRIDE;
151 void AddToOutputOrder(const MemCacheIter& mci); 150 void AddToOutputOrder(const MemCacheIter& mci);
152 virtual void SendEOF(uint32 stream_id) OVERRIDE; 151 virtual void SendEOF(uint32 stream_id) OVERRIDE;
153 virtual void SendErrorNotFound(uint32 stream_id) OVERRIDE; 152 virtual void SendErrorNotFound(uint32 stream_id) OVERRIDE;
154 virtual size_t SendSynStream(uint32 stream_id, 153 virtual size_t SendSynStream(uint32 stream_id,
155 const BalsaHeaders& headers) OVERRIDE; 154 const BalsaHeaders& headers) OVERRIDE;
156 virtual size_t SendSynReply(uint32 stream_id, 155 virtual size_t SendSynReply(uint32 stream_id,
157 const BalsaHeaders& headers) OVERRIDE; 156 const BalsaHeaders& headers) OVERRIDE;
158 virtual void SendDataFrame(uint32 stream_id, const char* data, int64 len, 157 virtual void SendDataFrame(uint32 stream_id,
159 uint32 flags, bool compress) OVERRIDE; 158 const char* data,
159 int64 len,
160 uint32 flags,
161 bool compress) OVERRIDE;
160 BufferedSpdyFramer* spdy_framer() { return buffered_spdy_framer_; } 162 BufferedSpdyFramer* spdy_framer() { return buffered_spdy_framer_; }
161 163
162 const OutputOrdering& output_ordering() const { 164 const OutputOrdering& output_ordering() const {
163 return client_output_ordering_; 165 return client_output_ordering_;
164 } 166 }
165 167
166 static std::string forward_ip_header() { return forward_ip_header_; } 168 static std::string forward_ip_header() { return forward_ip_header_; }
167 static void set_forward_ip_header(const std::string& value) { 169 static void set_forward_ip_header(const std::string& value) {
168 forward_ip_header_ = value; 170 forward_ip_header_ = value;
169 } 171 }
170 SpdyMajorVersion spdy_version() const { 172 SpdyMajorVersion spdy_version() const {
171 return buffered_spdy_framer_->protocol_version(); 173 return buffered_spdy_framer_->protocol_version();
172 } 174 }
173 175
174 private: 176 private:
175 void SendEOFImpl(uint32 stream_id); 177 void SendEOFImpl(uint32 stream_id);
176 void SendErrorNotFoundImpl(uint32 stream_id); 178 void SendErrorNotFoundImpl(uint32 stream_id);
177 void KillStream(uint32 stream_id); 179 void KillStream(uint32 stream_id);
178 void CopyHeaders(SpdyHeaderBlock& dest, const BalsaHeaders& headers); 180 void CopyHeaders(SpdyHeaderBlock& dest, const BalsaHeaders& headers);
179 size_t SendSynStreamImpl(uint32 stream_id, const BalsaHeaders& headers); 181 size_t SendSynStreamImpl(uint32 stream_id, const BalsaHeaders& headers);
180 size_t SendSynReplyImpl(uint32 stream_id, const BalsaHeaders& headers); 182 size_t SendSynReplyImpl(uint32 stream_id, const BalsaHeaders& headers);
181 void SendDataFrameImpl(uint32 stream_id, const char* data, int64 len, 183 void SendDataFrameImpl(uint32 stream_id,
182 SpdyDataFlags flags, bool compress); 184 const char* data,
185 int64 len,
186 SpdyDataFlags flags,
187 bool compress);
183 void EnqueueDataFrame(DataFrame* df); 188 void EnqueueDataFrame(DataFrame* df);
184 virtual void GetOutput() OVERRIDE; 189 virtual void GetOutput() OVERRIDE;
185 190
186 private: 191 private:
187 BufferedSpdyFramer* buffered_spdy_framer_; 192 BufferedSpdyFramer* buffered_spdy_framer_;
188 bool valid_spdy_session_; // True if we have seen valid data on this session. 193 bool valid_spdy_session_; // True if we have seen valid data on this session.
189 // Use this to fail fast when junk is sent to our 194 // Use this to fail fast when junk is sent to our
190 // port. 195 // port.
191 196
192 SMConnection* connection_; 197 SMConnection* connection_;
193 OutputList* client_output_list_; 198 OutputList* client_output_list_;
194 OutputOrdering client_output_ordering_; 199 OutputOrdering client_output_ordering_;
195 uint32 next_outgoing_stream_id_; 200 uint32 next_outgoing_stream_id_;
196 EpollServer* epoll_server_; 201 EpollServer* epoll_server_;
197 FlipAcceptor* acceptor_; 202 FlipAcceptor* acceptor_;
198 MemoryCache* memory_cache_; 203 MemoryCache* memory_cache_;
199 std::vector<SMInterface*> server_interface_list; 204 std::vector<SMInterface*> server_interface_list;
200 std::vector<int32> unused_server_interface_list; 205 std::vector<int32> unused_server_interface_list;
201 typedef std::map<uint32, SMInterface*> StreamToSmif; 206 typedef std::map<uint32, SMInterface*> StreamToSmif;
202 StreamToSmif stream_to_smif_; 207 StreamToSmif stream_to_smif_;
203 bool close_on_error_; 208 bool close_on_error_;
204 209
205 static std::string forward_ip_header_; 210 static std::string forward_ip_header_;
206 }; 211 };
207 212
208 } // namespace net 213 } // namespace net
209 214
210 #endif // NET_TOOLS_FLIP_SERVER_SPDY_INTERFACE_H_ 215 #endif // NET_TOOLS_FLIP_SERVER_SPDY_INTERFACE_H_
OLDNEW
« no previous file with comments | « net/tools/flip_server/sm_interface.h ('k') | net/tools/flip_server/spdy_interface.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698