OLD | NEW |
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 | 7 |
8 #include <deque> | 8 #include <deque> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 // 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. |
77 // Normal streams will receive a SYN_REPLY and optional HEADERS frames. | 77 // Normal streams will receive a SYN_REPLY and optional HEADERS frames. |
78 // Pushed streams will receive a SYN_STREAM and optional HEADERS frames. | 78 // Pushed streams will receive a SYN_STREAM and optional HEADERS frames. |
79 // 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, |
80 // this callback may be called multiple times. | 80 // this callback may be called multiple times. |
81 // |status| indicates network error. Returns network error code. | 81 // |status| indicates network error. Returns network error code. |
82 virtual int OnResponseReceived(const SpdyHeaderBlock& response, | 82 virtual int OnResponseReceived(const SpdyHeaderBlock& response, |
83 base::Time response_time, | 83 base::Time response_time, |
84 int status) = 0; | 84 int status) = 0; |
85 | 85 |
86 // Called when a HEADERS frame is sent. | |
87 virtual void OnHeadersSent() = 0; | |
88 | |
89 // Called when data is received. |buffer| may be NULL, which | 86 // Called when data is received. |buffer| may be NULL, which |
90 // signals EOF. Must return OK if the data was received | 87 // signals EOF. Must return OK if the data was received |
91 // successfully, or a network error code otherwise. | 88 // successfully, or a network error code otherwise. |
92 virtual int OnDataReceived(scoped_ptr<SpdyBuffer> buffer) = 0; | 89 virtual int OnDataReceived(scoped_ptr<SpdyBuffer> buffer) = 0; |
93 | 90 |
94 // Called when data is sent. | 91 // Called when data is sent. |
95 virtual void OnDataSent() = 0; | 92 virtual void OnDataSent() = 0; |
96 | 93 |
97 // Called when SpdyStream is closed. No other delegate functions | 94 // Called when SpdyStream is closed. No other delegate functions |
98 // will be called after this is called, and the delegate must not | 95 // will be called after this is called, and the delegate must not |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
370 int DoSendDomainBoundCert(); | 367 int DoSendDomainBoundCert(); |
371 int DoSendDomainBoundCertComplete(int result); | 368 int DoSendDomainBoundCertComplete(int result); |
372 int DoSendHeaders(); | 369 int DoSendHeaders(); |
373 int DoSendHeadersComplete(); | 370 int DoSendHeadersComplete(); |
374 int DoSendBody(); | 371 int DoSendBody(); |
375 int DoSendBodyComplete(int result); | 372 int DoSendBodyComplete(int result); |
376 int DoReadHeaders(); | 373 int DoReadHeaders(); |
377 int DoReadHeadersComplete(int result); | 374 int DoReadHeadersComplete(int result); |
378 int DoOpen(); | 375 int DoOpen(); |
379 | 376 |
| 377 // Does the bookkeeping necessary after a frame has just been |
| 378 // sent. If there's more data to be sent, |state_| is set to |
| 379 // |io_pending_state|, the next frame is queued up, and |
| 380 // ERR_IO_PENDING is returned. Otherwise, returns OK if successful |
| 381 // or an error if not. |
| 382 int ProcessJustCompletedFrame(int result, State io_pending_state); |
| 383 |
380 // Update the histograms. Can safely be called repeatedly, but should only | 384 // Update the histograms. Can safely be called repeatedly, but should only |
381 // be called after the stream has completed. | 385 // be called after the stream has completed. |
382 void UpdateHistograms(); | 386 void UpdateHistograms(); |
383 | 387 |
384 // When a server pushed stream is first created, this function is posted on | 388 // When a server pushed stream is first created, this function is posted on |
385 // the MessageLoop to replay all the data that the server has already sent. | 389 // the MessageLoop to replay all the data that the server has already sent. |
386 void PushedStreamReplayData(); | 390 void PushedStreamReplayData(); |
387 | 391 |
388 // Produces the SYN_STREAM frame for the stream. The stream must | 392 // Produces the SYN_STREAM frame for the stream. The stream must |
389 // already be activated. | 393 // already be activated. |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
474 // When OnFrameWriteComplete() is called, these variables are set. | 478 // When OnFrameWriteComplete() is called, these variables are set. |
475 SpdyFrameType just_completed_frame_type_; | 479 SpdyFrameType just_completed_frame_type_; |
476 size_t just_completed_frame_size_; | 480 size_t just_completed_frame_size_; |
477 | 481 |
478 DISALLOW_COPY_AND_ASSIGN(SpdyStream); | 482 DISALLOW_COPY_AND_ASSIGN(SpdyStream); |
479 }; | 483 }; |
480 | 484 |
481 } // namespace net | 485 } // namespace net |
482 | 486 |
483 #endif // NET_SPDY_SPDY_STREAM_H_ | 487 #endif // NET_SPDY_SPDY_STREAM_H_ |
OLD | NEW |