Chromium Code Reviews| 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 53 public: | 53 public: |
| 54 // Delegate handles protocol specific behavior of spdy stream. | 54 // Delegate handles protocol specific behavior of spdy stream. |
| 55 class NET_EXPORT_PRIVATE Delegate { | 55 class NET_EXPORT_PRIVATE Delegate { |
| 56 public: | 56 public: |
| 57 Delegate() {} | 57 Delegate() {} |
| 58 | 58 |
| 59 // Called when SYN frame has been sent. | 59 // Called when SYN frame has been sent. |
| 60 // Returns true if no more data to be sent after SYN frame. | 60 // Returns true if no more data to be sent after SYN frame. |
| 61 virtual SpdySendStatus OnSendHeadersComplete() = 0; | 61 virtual SpdySendStatus OnSendHeadersComplete() = 0; |
| 62 | 62 |
| 63 // Called when stream is ready to send data. | 63 // Called when the stream is ready to send body data. The |
| 64 // Returns network error code. OK when it successfully sent data. | 64 // delegate must call QueueStreamData() on the stream, either |
| 65 // ERR_IO_PENDING when performing operation asynchronously. | 65 // immediately or asynchronously (e.g., if the data to be send has |
| 66 virtual int OnSendBody() = 0; | 66 // to be read asynchronously). Must return ERR_IO_PENDING. |
|
Ryan Hamilton
2013/05/22 03:17:30
Looks like it's now void
akalin
2013/05/22 08:40:05
Done.
| |
| 67 // | |
| 68 // Called only when OnSendHeadersComplete() or | |
| 69 // OnSendBodyComplete() returns MORE_DATA_TO_SEND. | |
| 70 // | |
| 71 // TODO(akalin): Remove the return value. | |
|
Ryan Hamilton
2013/05/22 03:17:30
I think you removed the return value, didn't you?
akalin
2013/05/22 08:40:05
Done.
| |
| 72 virtual void OnSendBody() = 0; | |
| 67 | 73 |
| 68 // Called when body data has been sent. |bytes_sent| is the number | 74 // Called when body data has been sent. |bytes_sent| is the number |
| 69 // of bytes that has been sent (may be zero). Must return whether | 75 // of bytes that has been sent (may be zero). Must return whether |
| 70 // there's more body data to send. | 76 // there's more body data to send. |
| 71 virtual SpdySendStatus OnSendBodyComplete(size_t bytes_sent) = 0; | 77 virtual SpdySendStatus OnSendBodyComplete(size_t bytes_sent) = 0; |
| 72 | 78 |
| 73 // Called when the SYN_STREAM, SYN_REPLY, or HEADERS frames are received. | 79 // Called when the SYN_STREAM, SYN_REPLY, or HEADERS frames are received. |
| 74 // Normal streams will receive a SYN_REPLY and optional HEADERS frames. | 80 // Normal streams will receive a SYN_REPLY and optional HEADERS frames. |
| 75 // Pushed streams will receive a SYN_STREAM and optional HEADERS frames. | 81 // Pushed streams will receive a SYN_STREAM and optional HEADERS frames. |
| 76 // Because a stream may have a SYN_* frame and multiple HEADERS frames, | 82 // Because a stream may have a SYN_* frame and multiple HEADERS frames, |
| (...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 356 // Try to make progress sending/receiving the request/response. | 362 // Try to make progress sending/receiving the request/response. |
| 357 int DoLoop(int result); | 363 int DoLoop(int result); |
| 358 | 364 |
| 359 // The implementations of each state of the state machine. | 365 // The implementations of each state of the state machine. |
| 360 int DoGetDomainBoundCert(); | 366 int DoGetDomainBoundCert(); |
| 361 int DoGetDomainBoundCertComplete(int result); | 367 int DoGetDomainBoundCertComplete(int result); |
| 362 int DoSendDomainBoundCert(); | 368 int DoSendDomainBoundCert(); |
| 363 int DoSendDomainBoundCertComplete(int result); | 369 int DoSendDomainBoundCertComplete(int result); |
| 364 int DoSendHeaders(); | 370 int DoSendHeaders(); |
| 365 int DoSendHeadersComplete(); | 371 int DoSendHeadersComplete(); |
| 366 int DoSendBody(); | 372 void DoSendBody(); |
|
Ryan Hamilton
2013/05/22 03:17:30
I don't think this is a good idea. The pattern we
akalin
2013/05/22 08:40:05
Done.
| |
| 367 int DoSendBodyComplete(int result); | 373 int DoSendBodyComplete(int result); |
| 368 int DoReadHeaders(); | 374 int DoReadHeaders(); |
| 369 int DoReadHeadersComplete(int result); | 375 int DoReadHeadersComplete(int result); |
| 370 int DoOpen(); | 376 int DoOpen(); |
| 371 | 377 |
| 372 // Update the histograms. Can safely be called repeatedly, but should only | 378 // Update the histograms. Can safely be called repeatedly, but should only |
| 373 // be called after the stream has completed. | 379 // be called after the stream has completed. |
| 374 void UpdateHistograms(); | 380 void UpdateHistograms(); |
| 375 | 381 |
| 376 // When a server pushed stream is first created, this function is posted on | 382 // When a server pushed stream is first created, this function is posted on |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 457 // When OnFrameWriteComplete() is called, these variables are set. | 463 // When OnFrameWriteComplete() is called, these variables are set. |
| 458 SpdyFrameType just_completed_frame_type_; | 464 SpdyFrameType just_completed_frame_type_; |
| 459 size_t just_completed_frame_size_; | 465 size_t just_completed_frame_size_; |
| 460 | 466 |
| 461 DISALLOW_COPY_AND_ASSIGN(SpdyStream); | 467 DISALLOW_COPY_AND_ASSIGN(SpdyStream); |
| 462 }; | 468 }; |
| 463 | 469 |
| 464 } // namespace net | 470 } // namespace net |
| 465 | 471 |
| 466 #endif // NET_SPDY_SPDY_STREAM_H_ | 472 #endif // NET_SPDY_SPDY_STREAM_H_ |
| OLD | NEW |