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

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

Issue 2167253002: s/SYN_STREAM/HEADERS/ in frame types, method names, comments. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 4 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
« no previous file with comments | « net/spdy/spdy_session_unittest.cc ('k') | net/spdy/spdy_stream.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_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 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 284
285 // Returns true if the underlying transport socket ever had any reads or 285 // Returns true if the underlying transport socket ever had any reads or
286 // writes. 286 // writes.
287 bool WasEverUsed() const; 287 bool WasEverUsed() const;
288 288
289 const BoundNetLog& net_log() const { return net_log_; } 289 const BoundNetLog& net_log() const { return net_log_; }
290 290
291 base::Time GetRequestTime() const; 291 base::Time GetRequestTime() const;
292 void SetRequestTime(base::Time t); 292 void SetRequestTime(base::Time t);
293 293
294 // Called at most once by the SpdySession when the initial response 294 // Called at most once by the SpdySession when the initial response headers
295 // headers have been received for this stream, i.e., a SYN_REPLY (or 295 // have been received for this stream. Returns a status code; if it is an
296 // SYN_STREAM for push streams) frame has been received. Returns a status 296 // error, the stream was closed by this function.
297 // code; if it is an error, the stream was closed by this function.
298 int OnInitialResponseHeadersReceived(const SpdyHeaderBlock& response_headers, 297 int OnInitialResponseHeadersReceived(const SpdyHeaderBlock& response_headers,
299 base::Time response_time, 298 base::Time response_time,
300 base::TimeTicks recv_first_byte_time); 299 base::TimeTicks recv_first_byte_time);
301 300
302 // Called by the SpdySession (only after 301 // Called by the SpdySession (only after
303 // OnInitialResponseHeadersReceived() has been called) when 302 // OnInitialResponseHeadersReceived() has been called) when
304 // late-bound headers are received for a stream. Returns a status 303 // late-bound headers are received for a stream. Returns a status
305 // code; if it is an error, the stream was closed by this function. 304 // code; if it is an error, the stream was closed by this function.
306 int OnAdditionalResponseHeadersReceived( 305 int OnAdditionalResponseHeadersReceived(
307 const SpdyHeaderBlock& additional_response_headers); 306 const SpdyHeaderBlock& additional_response_headers);
(...skipping 18 matching lines...) Expand all
326 // Called by the SpdySession when padding is consumed to allow for the stream 325 // Called by the SpdySession when padding is consumed to allow for the stream
327 // receiving window to be updated. 326 // receiving window to be updated.
328 void OnPaddingConsumed(size_t len); 327 void OnPaddingConsumed(size_t len);
329 328
330 // Called by the SpdySession when a frame has been successfully and completely 329 // Called by the SpdySession when a frame has been successfully and completely
331 // written. |frame_size| is the total size of the logical frame in bytes, 330 // written. |frame_size| is the total size of the logical frame in bytes,
332 // including framing overhead. For fragmented headers, this is the total size 331 // including framing overhead. For fragmented headers, this is the total size
333 // of the HEADERS or PUSH_PROMISE frame and subsequent CONTINUATION frames. 332 // of the HEADERS or PUSH_PROMISE frame and subsequent CONTINUATION frames.
334 void OnFrameWriteComplete(SpdyFrameType frame_type, size_t frame_size); 333 void OnFrameWriteComplete(SpdyFrameType frame_type, size_t frame_size);
335 334
336 // SYN_STREAM-specific write handler invoked by OnFrameWriteComplete(). 335 // HEADERS-specific write handler invoked by OnFrameWriteComplete().
337 int OnRequestHeadersSent(); 336 int OnRequestHeadersSent();
338 337
339 // DATA-specific write handler invoked by OnFrameWriteComplete(). 338 // DATA-specific write handler invoked by OnFrameWriteComplete().
340 // If more data is already available to be written, the next write is 339 // If more data is already available to be written, the next write is
341 // queued and ERR_IO_PENDING is returned. Returns OK otherwise. 340 // queued and ERR_IO_PENDING is returned. Returns OK otherwise.
342 int OnDataSent(size_t frame_size); 341 int OnDataSent(size_t frame_size);
343 342
344 // Called by the SpdySession when the request is finished. This callback 343 // Called by the SpdySession when the request is finished. This callback
345 // will always be called at the end of the request and signals to the 344 // will always be called at the end of the request and signals to the
346 // stream that the stream has no more network events. No further callbacks 345 // stream that the stream has no more network events. No further callbacks
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 int64_t raw_received_bytes() const { return raw_received_bytes_; } 424 int64_t raw_received_bytes() const { return raw_received_bytes_; }
426 int64_t raw_sent_bytes() const { return raw_sent_bytes_; } 425 int64_t raw_sent_bytes() const { return raw_sent_bytes_; }
427 426
428 bool GetLoadTimingInfo(LoadTimingInfo* load_timing_info) const; 427 bool GetLoadTimingInfo(LoadTimingInfo* load_timing_info) const;
429 428
430 // Get the URL from the appropriate stream headers, or the empty 429 // Get the URL from the appropriate stream headers, or the empty
431 // GURL() if it is unknown. 430 // GURL() if it is unknown.
432 const GURL& GetUrlFromHeaders() const { return url_from_header_block_; } 431 const GURL& GetUrlFromHeaders() const { return url_from_header_block_; }
433 432
434 private: 433 private:
435 class SynStreamBufferProducer; 434 class HeadersBufferProducer;
436 class HeaderBufferProducer;
437 435
438 // SpdyStream states and transitions are modeled 436 // SpdyStream states and transitions are modeled
439 // on the HTTP/2 stream state machine. All states and transitions 437 // on the HTTP/2 stream state machine. All states and transitions
440 // are modeled, with the exceptions of RESERVED_LOCAL (the client 438 // are modeled, with the exceptions of RESERVED_LOCAL (the client
441 // cannot initate push streams), and the transition to OPEN due to 439 // cannot initate push streams), and the transition to OPEN due to
442 // a remote SYN_STREAM (the client can only initate streams). 440 // a remote HEADERS (the client can only initate streams).
443 enum State { 441 enum State {
444 STATE_IDLE, 442 STATE_IDLE,
445 STATE_OPEN, 443 STATE_OPEN,
446 STATE_HALF_CLOSED_LOCAL_UNCLAIMED, 444 STATE_HALF_CLOSED_LOCAL_UNCLAIMED,
447 STATE_HALF_CLOSED_LOCAL, 445 STATE_HALF_CLOSED_LOCAL,
448 STATE_HALF_CLOSED_REMOTE, 446 STATE_HALF_CLOSED_REMOTE,
449 STATE_RESERVED_REMOTE, 447 STATE_RESERVED_REMOTE,
450 STATE_CLOSED, 448 STATE_CLOSED,
451 }; 449 };
452 450
453 // Update the histograms. Can safely be called repeatedly, but should only 451 // Update the histograms. Can safely be called repeatedly, but should only
454 // be called after the stream has completed. 452 // be called after the stream has completed.
455 void UpdateHistograms(); 453 void UpdateHistograms();
456 454
457 // When a server-push stream is claimed by SetDelegate(), this function is 455 // When a server-push stream is claimed by SetDelegate(), this function is
458 // posted on the current MessageLoop to replay everything the server has sent. 456 // posted on the current MessageLoop to replay everything the server has sent.
459 // From the perspective of SpdyStream's state machine, headers, data, and 457 // From the perspective of SpdyStream's state machine, headers, data, and
460 // FIN states received prior to the delegate being attached have not yet been 458 // FIN states received prior to the delegate being attached have not yet been
461 // read. While buffered by |pending_recv_data_| it's not until 459 // read. While buffered by |pending_recv_data_| it's not until
462 // PushedStreamReplay() is invoked that reads are considered 460 // PushedStreamReplay() is invoked that reads are considered
463 // to have occurred, driving the state machine forward. 461 // to have occurred, driving the state machine forward.
464 void PushedStreamReplay(); 462 void PushedStreamReplay();
465 463
466 // Produces the SYN_STREAM frame for the stream. The stream must 464 // Produces the HEADERS frame for the stream. The stream must
467 // already be activated. 465 // already be activated.
468 std::unique_ptr<SpdySerializedFrame> ProduceSynStreamFrame(); 466 std::unique_ptr<SpdySerializedFrame> ProduceHeadersFrame();
469 467
470 // Queues the send for next frame of the remaining data in 468 // Queues the send for next frame of the remaining data in
471 // |pending_send_data_|. Must be called only when 469 // |pending_send_data_|. Must be called only when
472 // |pending_send_data_| is set. 470 // |pending_send_data_| is set.
473 void QueueNextDataFrame(); 471 void QueueNextDataFrame();
474 472
475 // Merge the given headers into |response_headers_| and calls 473 // Merge the given headers into |response_headers_| and calls
476 // OnResponseHeadersUpdated() on the delegate (if attached). 474 // OnResponseHeadersUpdated() on the delegate (if attached).
477 // Returns a status code; if it is an error, the stream was closed 475 // Returns a status code; if it is an error, the stream was closed
478 // by this function. 476 // by this function.
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
567 bool write_handler_guard_; 565 bool write_handler_guard_;
568 566
569 base::WeakPtrFactory<SpdyStream> weak_ptr_factory_; 567 base::WeakPtrFactory<SpdyStream> weak_ptr_factory_;
570 568
571 DISALLOW_COPY_AND_ASSIGN(SpdyStream); 569 DISALLOW_COPY_AND_ASSIGN(SpdyStream);
572 }; 570 };
573 571
574 } // namespace net 572 } // namespace net
575 573
576 #endif // NET_SPDY_SPDY_STREAM_H_ 574 #endif // NET_SPDY_SPDY_STREAM_H_
OLDNEW
« no previous file with comments | « net/spdy/spdy_session_unittest.cc ('k') | net/spdy/spdy_stream.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698