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

Side by Side Diff: net/spdy/spdy_stream.h

Issue 10689034: SPDY - chunked upload - speech recognition doesn't work with SPDY/3 (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 5 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 unified diff | Download patch | Annotate | Revision Log
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_SPDY_SPDY_STREAM_H_ 5 #ifndef NET_SPDY_SPDY_STREAM_H_
6 #define NET_SPDY_SPDY_STREAM_H_ 6 #define NET_SPDY_SPDY_STREAM_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 virtual bool OnSendHeadersComplete(int status) = 0; 54 virtual bool OnSendHeadersComplete(int status) = 0;
55 55
56 // Called when stream is ready to send data. 56 // Called when stream is ready to send data.
57 // Returns network error code. OK when it successfully sent data. 57 // Returns network error code. OK when it successfully sent data.
58 virtual int OnSendBody() = 0; 58 virtual int OnSendBody() = 0;
59 59
60 // Called when data has been sent. |status| indicates network error 60 // Called when data has been sent. |status| indicates network error
61 // or number of bytes that has been sent. On return, |eof| is set to true 61 // or number of bytes that has been sent. On return, |eof| is set to true
62 // if no more data is available to send in the request body. 62 // if no more data is available to send in the request body.
63 // Returns network error code. OK when it successfully sent data. 63 // Returns network error code. OK when it successfully sent data.
64 virtual int OnSendBodyComplete(int status, bool* eof) = 0; 64 virtual int OnSendBodyComplete(int status, bool* eof) = 0;
Ryan Sleevi 2012/07/02 21:52:47 In the case of SPDY, which already (seemingly) sup
Ryan Hamilton 2012/07/02 22:34:32 I agree with sleevi here.
ramant (doing other things) 2012/07/04 21:04:33 sleevi and I had walked through the code and verif
65 65
66 // Called when stream is ready to send chunked data.
67 // Returns network error code. OK when it successfully sent chunked data.
68 virtual int OnSendChunkedBody() = 0;
69
70 // Called when chunked data has been sent. |status| indicates network error
71 // or number of bytes that has been sent. On return, |eof| is set to true
72 // if no more chunked data is available to send in the request body.
73 // Returns network error code. OK when it successfully sent chunked data.
74 virtual int OnSendChunkedBodyComplete(int status, bool* eof) = 0;
75
66 // Called when the SYN_STREAM, SYN_REPLY, or HEADERS frames are received. 76 // Called when the SYN_STREAM, SYN_REPLY, or HEADERS frames are received.
67 // Normal streams will receive a SYN_REPLY and optional HEADERS frames. 77 // Normal streams will receive a SYN_REPLY and optional HEADERS frames.
68 // Pushed streams will receive a SYN_STREAM and optional HEADERS frames. 78 // Pushed streams will receive a SYN_STREAM and optional HEADERS frames.
69 // Because a stream may have a SYN_* frame and multiple HEADERS frames, 79 // Because a stream may have a SYN_* frame and multiple HEADERS frames,
70 // this callback may be called multiple times. 80 // this callback may be called multiple times.
71 // |status| indicates network error. Returns network error code. 81 // |status| indicates network error. Returns network error code.
72 virtual int OnResponseReceived(const SpdyHeaderBlock& response, 82 virtual int OnResponseReceived(const SpdyHeaderBlock& response,
73 base::Time response_time, 83 base::Time response_time,
74 int status) = 0; 84 int status) = 0;
75 85
76 // Called when data is received. 86 // Called when data is received.
77 virtual void OnDataReceived(const char* data, int length) = 0; 87 virtual void OnDataReceived(const char* data, int length) = 0;
78 88
79 // Called when data is sent. 89 // Called when data is sent.
80 virtual void OnDataSent(int length) = 0; 90 virtual void OnDataSent(int length) = 0;
81 91
82 // Called when SpdyStream is closed. 92 // Called when SpdyStream is closed.
83 virtual void OnClose(int status) = 0; 93 virtual void OnClose(int status) = 0;
84 94
85 // Sets the callback to be invoked when a new chunk is available to upload. 95 // Sets the callback to be invoked when a new chunk is available to upload.
86 virtual void set_chunk_callback(ChunkCallback* callback) = 0; 96 virtual void set_chunk_callback(ChunkCallback* callback) = 0;
87 97
98 // Returns true if the upload is chunked.
99 virtual bool IsRequestBodyChunked() = 0;
100
88 protected: 101 protected:
89 friend class base::RefCounted<Delegate>; 102 friend class base::RefCounted<Delegate>;
90 virtual ~Delegate() {} 103 virtual ~Delegate() {}
91 104
92 private: 105 private:
93 DISALLOW_COPY_AND_ASSIGN(Delegate); 106 DISALLOW_COPY_AND_ASSIGN(Delegate);
94 }; 107 };
95 108
96 // SpdyStream constructor 109 // SpdyStream constructor
97 SpdyStream(SpdySession* session, 110 SpdyStream(SpdySession* session,
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 private: 275 private:
263 enum State { 276 enum State {
264 STATE_NONE, 277 STATE_NONE,
265 STATE_GET_DOMAIN_BOUND_CERT, 278 STATE_GET_DOMAIN_BOUND_CERT,
266 STATE_GET_DOMAIN_BOUND_CERT_COMPLETE, 279 STATE_GET_DOMAIN_BOUND_CERT_COMPLETE,
267 STATE_SEND_DOMAIN_BOUND_CERT, 280 STATE_SEND_DOMAIN_BOUND_CERT,
268 STATE_SEND_DOMAIN_BOUND_CERT_COMPLETE, 281 STATE_SEND_DOMAIN_BOUND_CERT_COMPLETE,
269 STATE_SEND_HEADERS, 282 STATE_SEND_HEADERS,
270 STATE_SEND_HEADERS_COMPLETE, 283 STATE_SEND_HEADERS_COMPLETE,
271 STATE_SEND_BODY, 284 STATE_SEND_BODY,
285 STATE_SEND_CHUNKED_BODY,
286 STATE_SEND_CHUNKED_BODY_COMPLETE,
272 STATE_SEND_BODY_COMPLETE, 287 STATE_SEND_BODY_COMPLETE,
273 STATE_WAITING_FOR_RESPONSE, 288 STATE_WAITING_FOR_RESPONSE,
274 STATE_OPEN, 289 STATE_OPEN,
275 STATE_DONE 290 STATE_DONE
276 }; 291 };
277 292
278 friend class base::RefCounted<SpdyStream>; 293 friend class base::RefCounted<SpdyStream>;
279 virtual ~SpdyStream(); 294 virtual ~SpdyStream();
280 295
281 // If the stream is stalled and if |send_window_size_| is positive, then set 296 // If the stream is stalled and if |send_window_size_| is positive, then set
282 // |stalled_by_flow_control_| to false and unstall the stream. 297 // |stalled_by_flow_control_| to false and unstall the stream.
283 void PossiblyResumeIfStalled(); 298 void PossiblyResumeIfStalled();
284 299
285 void OnGetDomainBoundCertComplete(int result); 300 void OnGetDomainBoundCertComplete(int result);
286 301
287 // Try to make progress sending/receiving the request/response. 302 // Try to make progress sending/receiving the request/response.
288 int DoLoop(int result); 303 int DoLoop(int result);
289 304
290 // The implementations of each state of the state machine. 305 // The implementations of each state of the state machine.
291 int DoGetDomainBoundCert(); 306 int DoGetDomainBoundCert();
292 int DoGetDomainBoundCertComplete(int result); 307 int DoGetDomainBoundCertComplete(int result);
293 int DoSendDomainBoundCert(); 308 int DoSendDomainBoundCert();
294 int DoSendDomainBoundCertComplete(int result); 309 int DoSendDomainBoundCertComplete(int result);
295 int DoSendHeaders(); 310 int DoSendHeaders();
296 int DoSendHeadersComplete(int result); 311 int DoSendHeadersComplete(int result);
297 int DoSendBody(); 312 int DoSendBody();
313 int DoSendChunkedBody();
314 int DoSendChunkedBodyComplete(int result);
298 int DoSendBodyComplete(int result); 315 int DoSendBodyComplete(int result);
299 int DoReadHeaders(); 316 int DoReadHeaders();
300 int DoReadHeadersComplete(int result); 317 int DoReadHeadersComplete(int result);
301 int DoOpen(int result); 318 int DoOpen(int result);
302 319
303 // Update the histograms. Can safely be called repeatedly, but should only 320 // Update the histograms. Can safely be called repeatedly, but should only
304 // be called after the stream has completed. 321 // be called after the stream has completed.
305 void UpdateHistograms(); 322 void UpdateHistograms();
306 323
307 // When a server pushed stream is first created, this function is posted on 324 // When a server pushed stream is first created, this function is posted on
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 std::string domain_bound_private_key_; 383 std::string domain_bound_private_key_;
367 std::string domain_bound_cert_; 384 std::string domain_bound_cert_;
368 ServerBoundCertService::RequestHandle domain_bound_cert_request_handle_; 385 ServerBoundCertService::RequestHandle domain_bound_cert_request_handle_;
369 386
370 DISALLOW_COPY_AND_ASSIGN(SpdyStream); 387 DISALLOW_COPY_AND_ASSIGN(SpdyStream);
371 }; 388 };
372 389
373 } // namespace net 390 } // namespace net
374 391
375 #endif // NET_SPDY_SPDY_STREAM_H_ 392 #endif // NET_SPDY_SPDY_STREAM_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698