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

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

Issue 12207148: Getting rid of SpdyFramer::GetControlFrameStreamId(), which cleans up the code and also makes it ea… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 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
« no previous file with comments | « no previous file | net/spdy/spdy_framer.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_FRAMER_H_ 5 #ifndef NET_SPDY_SPDY_FRAMER_H_
6 #define NET_SPDY_SPDY_FRAMER_H_ 6 #define NET_SPDY_SPDY_FRAMER_H_
7 7
8 #include <list> 8 #include <list>
9 #include <map> 9 #include <map>
10 #include <string> 10 #include <string>
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after
468 // On failure, returns NULL. 468 // On failure, returns NULL.
469 SpdyFrame* CompressFrame(const SpdyFrame& frame); 469 SpdyFrame* CompressFrame(const SpdyFrame& frame);
470 470
471 // Create a copy of a frame. 471 // Create a copy of a frame.
472 // Returned frame must be freed with "delete". 472 // Returned frame must be freed with "delete".
473 SpdyFrame* DuplicateFrame(const SpdyFrame& frame); 473 SpdyFrame* DuplicateFrame(const SpdyFrame& frame);
474 474
475 // Returns true if a frame could be compressed. 475 // Returns true if a frame could be compressed.
476 bool IsCompressible(const SpdyFrame& frame) const; 476 bool IsCompressible(const SpdyFrame& frame) const;
477 477
478 // Get the stream ID for the given control frame (SYN_STREAM, SYN_REPLY, and
479 // HEADERS). If the control frame is NULL or of another type, this
480 // function returns kInvalidStream.
481 static SpdyStreamId GetControlFrameStreamId(
482 const SpdyControlFrame* control_frame);
483
484 // For ease of testing and experimentation we can tweak compression on/off. 478 // For ease of testing and experimentation we can tweak compression on/off.
485 void set_enable_compression(bool value) { 479 void set_enable_compression(bool value) {
486 enable_compression_ = value; 480 enable_compression_ = value;
487 } 481 }
488 482
489 // Used only in log messages. 483 // Used only in log messages.
490 void set_display_protocol(const std::string& protocol) { 484 void set_display_protocol(const std::string& protocol) {
491 display_protocol_ = protocol; 485 display_protocol_ = protocol;
492 } 486 }
493 487
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
560 bool ProcessSetting(const char* data); // Always passed exactly 8 bytes. 554 bool ProcessSetting(const char* data); // Always passed exactly 8 bytes.
561 555
562 // Get (and lazily initialize) the ZLib state. 556 // Get (and lazily initialize) the ZLib state.
563 z_stream* GetHeaderCompressor(); 557 z_stream* GetHeaderCompressor();
564 z_stream* GetHeaderDecompressor(); 558 z_stream* GetHeaderDecompressor();
565 559
566 // Deliver the given control frame's compressed headers block to the visitor 560 // Deliver the given control frame's compressed headers block to the visitor
567 // in decompressed form, in chunks. Returns true if the visitor has 561 // in decompressed form, in chunks. Returns true if the visitor has
568 // accepted all of the chunks. 562 // accepted all of the chunks.
569 bool IncrementallyDecompressControlFrameHeaderData( 563 bool IncrementallyDecompressControlFrameHeaderData(
570 const SpdyControlFrame* frame, 564 SpdyStreamId stream_id,
571 const char* data, 565 const char* data,
572 size_t len); 566 size_t len);
573 567
574 // Deliver the given control frame's uncompressed headers block to the 568 // Deliver the given control frame's uncompressed headers block to the
575 // visitor in chunks. Returns true if the visitor has accepted all of the 569 // visitor in chunks. Returns true if the visitor has accepted all of the
576 // chunks. 570 // chunks.
577 bool IncrementallyDeliverControlFrameHeaderData(const SpdyControlFrame* frame, 571 bool IncrementallyDeliverControlFrameHeaderData(SpdyStreamId stream_id,
578 const char* data, 572 const char* data,
579 size_t len); 573 size_t len);
580 574
581 // Utility to copy the given data block to the current frame buffer, up 575 // Utility to copy the given data block to the current frame buffer, up
582 // to the given maximum number of bytes, and update the buffer 576 // to the given maximum number of bytes, and update the buffer
583 // data (pointer and length). Returns the number of bytes 577 // data (pointer and length). Returns the number of bytes
584 // read, and: 578 // read, and:
585 // *data is advanced the number of bytes read. 579 // *data is advanced the number of bytes read.
586 // *len is reduced by the number of bytes read. 580 // *len is reduced by the number of bytes read.
587 size_t UpdateCurrentFrameBuffer(const char** data, size_t* len, 581 size_t UpdateCurrentFrameBuffer(const char** data, size_t* len,
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
668 // starts with HTTP. If it does, we likely have an HTTP response. This 662 // starts with HTTP. If it does, we likely have an HTTP response. This
669 // isn't guaranteed though: we could have gotten a settings frame and then 663 // isn't guaranteed though: we could have gotten a settings frame and then
670 // corrupt data that just looks like HTTP, but deterministic checking requires 664 // corrupt data that just looks like HTTP, but deterministic checking requires
671 // a lot more state. 665 // a lot more state.
672 bool probable_http_response_; 666 bool probable_http_response_;
673 }; 667 };
674 668
675 } // namespace net 669 } // namespace net
676 670
677 #endif // NET_SPDY_SPDY_FRAMER_H_ 671 #endif // NET_SPDY_SPDY_FRAMER_H_
OLDNEW
« no previous file with comments | « no previous file | net/spdy/spdy_framer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698