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

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

Issue 10138003: Remove SpdyFramer::CompressFrame() and use CompressControlFrame instead. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 8 years, 8 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 | « net/spdy/buffered_spdy_framer.cc ('k') | 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 #pragma once 7 #pragma once
8 8
9 #include <list> 9 #include <list>
10 #include <map> 10 #include <map>
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 // On failure, returns NULL. 379 // On failure, returns NULL.
380 SpdyFrame* CompressFrame(const SpdyFrame& frame); 380 SpdyFrame* CompressFrame(const SpdyFrame& frame);
381 381
382 // Create a copy of a frame. 382 // Create a copy of a frame.
383 // Returned frame must be freed with "delete". 383 // Returned frame must be freed with "delete".
384 SpdyFrame* DuplicateFrame(const SpdyFrame& frame); 384 SpdyFrame* DuplicateFrame(const SpdyFrame& frame);
385 385
386 // Returns true if a frame could be compressed. 386 // Returns true if a frame could be compressed.
387 bool IsCompressible(const SpdyFrame& frame) const; 387 bool IsCompressible(const SpdyFrame& frame) const;
388 388
389 // Returns a new SpdyControlFrame with the compressed payload of |frame|.
390 SpdyControlFrame* CompressControlFrame(const SpdyControlFrame& frame);
391
389 // Get the minimum size of the control frame for the given control frame 392 // Get the minimum size of the control frame for the given control frame
390 // type. This is useful for validating frame blocks. 393 // type. This is useful for validating frame blocks.
391 static size_t GetMinimumControlFrameSize(int version, SpdyControlType type); 394 static size_t GetMinimumControlFrameSize(int version, SpdyControlType type);
392 395
393 // Get the stream ID for the given control frame (SYN_STREAM, SYN_REPLY, and 396 // Get the stream ID for the given control frame (SYN_STREAM, SYN_REPLY, and
394 // HEADERS). If the control frame is NULL or of another type, this 397 // HEADERS). If the control frame is NULL or of another type, this
395 // function returns kInvalidStream. 398 // function returns kInvalidStream.
396 static SpdyStreamId GetControlFrameStreamId( 399 static SpdyStreamId GetControlFrameStreamId(
397 const SpdyControlFrame* control_frame); 400 const SpdyControlFrame* control_frame);
398 401
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
458 size_t ProcessDataFramePayload(const char* data, size_t len); 461 size_t ProcessDataFramePayload(const char* data, size_t len);
459 462
460 // Helpers for above internal breakouts from ProcessInput. 463 // Helpers for above internal breakouts from ProcessInput.
461 void ProcessControlFrameHeader(); 464 void ProcessControlFrameHeader();
462 bool ProcessSetting(const char* data); // Always passed exactly 8 bytes. 465 bool ProcessSetting(const char* data); // Always passed exactly 8 bytes.
463 466
464 // Get (and lazily initialize) the ZLib state. 467 // Get (and lazily initialize) the ZLib state.
465 z_stream* GetHeaderCompressor(); 468 z_stream* GetHeaderCompressor();
466 z_stream* GetHeaderDecompressor(); 469 z_stream* GetHeaderDecompressor();
467 470
468 // Compression helpers
469 SpdyControlFrame* CompressControlFrame(const SpdyControlFrame& frame);
470
471 // Deliver the given control frame's compressed headers block to the visitor 471 // Deliver the given control frame's compressed headers block to the visitor
472 // in decompressed form, in chunks. Returns true if the visitor has 472 // in decompressed form, in chunks. Returns true if the visitor has
473 // accepted all of the chunks. 473 // accepted all of the chunks.
474 bool IncrementallyDecompressControlFrameHeaderData( 474 bool IncrementallyDecompressControlFrameHeaderData(
475 const SpdyControlFrame* frame, 475 const SpdyControlFrame* frame,
476 const char* data, 476 const char* data,
477 size_t len); 477 size_t len);
478 478
479 // Deliver the given control frame's uncompressed headers block to the 479 // Deliver the given control frame's uncompressed headers block to the
480 // visitor in chunks. Returns true if the visitor has accepted all of the 480 // visitor in chunks. Returns true if the visitor has accepted all of the
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
568 // starts with HTTP. If it does, we likely have an HTTP response. This 568 // starts with HTTP. If it does, we likely have an HTTP response. This
569 // isn't guaranteed though: we could have gotten a settings frame and then 569 // isn't guaranteed though: we could have gotten a settings frame and then
570 // corrupt data that just looks like HTTP, but deterministic checking requires 570 // corrupt data that just looks like HTTP, but deterministic checking requires
571 // a lot more state. 571 // a lot more state.
572 bool probable_http_response_; 572 bool probable_http_response_;
573 }; 573 };
574 574
575 } // namespace net 575 } // namespace net
576 576
577 #endif // NET_SPDY_SPDY_FRAMER_H_ 577 #endif // NET_SPDY_SPDY_FRAMER_H_
OLDNEW
« no previous file with comments | « net/spdy/buffered_spdy_framer.cc ('k') | net/spdy/spdy_framer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698