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 <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 SPDY_PUSH_STREAM | 48 SPDY_PUSH_STREAM |
49 }; | 49 }; |
50 | 50 |
51 // Passed to some SpdyStream functions to indicate whether there's | 51 // Passed to some SpdyStream functions to indicate whether there's |
52 // more data to send. | 52 // more data to send. |
53 enum SpdySendStatus { | 53 enum SpdySendStatus { |
54 MORE_DATA_TO_SEND, | 54 MORE_DATA_TO_SEND, |
55 NO_MORE_DATA_TO_SEND | 55 NO_MORE_DATA_TO_SEND |
56 }; | 56 }; |
57 | 57 |
58 // The SpdyStream is used by the SpdySession to represent each stream known | 58 // SpdyStream is owned by SpdySession and is used to represent each stream known |
59 // on the SpdySession. This class provides interfaces for SpdySession to use. | 59 // on the SpdySession. This class provides interfaces for SpdySession to use. |
60 // Streams can be created either by the client or by the server. When they | 60 // Streams can be created either by the client or by the server. When they |
61 // are initiated by the client, both the SpdySession and client object (such as | 61 // are initiated by the client, both the SpdySession and client object (such as |
62 // a SpdyNetworkTransaction) will maintain a reference to the stream. When | 62 // a SpdyNetworkTransaction) will maintain a reference to the stream. When |
63 // initiated by the server, only the SpdySession will maintain any reference, | 63 // initiated by the server, only the SpdySession will maintain any reference, |
64 // until such a time as a client object requests a stream for the path. | 64 // until such a time as a client object requests a stream for the path. |
65 class NET_EXPORT_PRIVATE SpdyStream { | 65 class NET_EXPORT_PRIVATE SpdyStream { |
66 public: | 66 public: |
67 // Delegate handles protocol specific behavior of spdy stream. | 67 // Delegate handles protocol specific behavior of spdy stream. |
68 class NET_EXPORT_PRIVATE Delegate { | 68 class NET_EXPORT_PRIVATE Delegate { |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 int OnHeadersSent(); | 273 int OnHeadersSent(); |
274 | 274 |
275 // DATA-specific write handler invoked by OnFrameWriteComplete(). | 275 // DATA-specific write handler invoked by OnFrameWriteComplete(). |
276 // If more data is already available to be written, the next write is | 276 // If more data is already available to be written, the next write is |
277 // queued and ERR_IO_PENDING is returned. Returns OK otherwise. | 277 // queued and ERR_IO_PENDING is returned. Returns OK otherwise. |
278 int OnDataSent(size_t frame_size); | 278 int OnDataSent(size_t frame_size); |
279 | 279 |
280 // Called by the SpdySession when the request is finished. This callback | 280 // Called by the SpdySession when the request is finished. This callback |
281 // will always be called at the end of the request and signals to the | 281 // will always be called at the end of the request and signals to the |
282 // stream that the stream has no more network events. No further callbacks | 282 // stream that the stream has no more network events. No further callbacks |
283 // to the stream will be made after this call. | 283 // to the stream will be made after this call. Must be called before |
| 284 // SpdyStream is destroyed. |
284 // |status| is an error code or OK. | 285 // |status| is an error code or OK. |
285 void OnClose(int status); | 286 void OnClose(int status); |
286 | 287 |
287 // Called by the SpdySession to log stream related errors. | 288 // Called by the SpdySession to log stream related errors. |
288 void LogStreamError(int status, const std::string& description); | 289 void LogStreamError(int status, const std::string& description); |
289 | 290 |
290 // If this stream is active, reset it, and close it otherwise. In | 291 // If this stream is active, reset it, and close it otherwise. In |
291 // either case the stream is deleted. | 292 // either case the stream is deleted. |
292 void Cancel(); | 293 void Cancel(); |
293 | 294 |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
517 bool write_handler_guard_; | 518 bool write_handler_guard_; |
518 | 519 |
519 base::WeakPtrFactory<SpdyStream> weak_ptr_factory_; | 520 base::WeakPtrFactory<SpdyStream> weak_ptr_factory_; |
520 | 521 |
521 DISALLOW_COPY_AND_ASSIGN(SpdyStream); | 522 DISALLOW_COPY_AND_ASSIGN(SpdyStream); |
522 }; | 523 }; |
523 | 524 |
524 } // namespace net | 525 } // namespace net |
525 | 526 |
526 #endif // NET_SPDY_SPDY_STREAM_H_ | 527 #endif // NET_SPDY_SPDY_STREAM_H_ |
OLD | NEW |