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

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: 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
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 362 matching lines...) Expand 10 before | Expand all | Expand 10 after
373 // On failure, returns NULL. 373 // On failure, returns NULL.
374 SpdyFrame* CompressFrame(const SpdyFrame& frame); 374 SpdyFrame* CompressFrame(const SpdyFrame& frame);
375 375
376 // Create a copy of a frame. 376 // Create a copy of a frame.
377 // Returned frame must be freed with "delete". 377 // Returned frame must be freed with "delete".
378 SpdyFrame* DuplicateFrame(const SpdyFrame& frame); 378 SpdyFrame* DuplicateFrame(const SpdyFrame& frame);
379 379
380 // Returns true if a frame could be compressed. 380 // Returns true if a frame could be compressed.
381 bool IsCompressible(const SpdyFrame& frame) const; 381 bool IsCompressible(const SpdyFrame& frame) const;
382 382
383 SpdyControlFrame* CompressControlFrame(const SpdyControlFrame& frame);
384
383 // Get the minimum size of the control frame for the given control frame 385 // Get the minimum size of the control frame for the given control frame
384 // type. This is useful for validating frame blocks. 386 // type. This is useful for validating frame blocks.
385 static size_t GetMinimumControlFrameSize(int version, SpdyControlType type); 387 static size_t GetMinimumControlFrameSize(int version, SpdyControlType type);
386 388
387 // Get the stream ID for the given control frame (SYN_STREAM, SYN_REPLY, and 389 // Get the stream ID for the given control frame (SYN_STREAM, SYN_REPLY, and
388 // HEADERS). If the control frame is NULL or of another type, this 390 // HEADERS). If the control frame is NULL or of another type, this
389 // function returns kInvalidStream. 391 // function returns kInvalidStream.
390 static SpdyStreamId GetControlFrameStreamId( 392 static SpdyStreamId GetControlFrameStreamId(
391 const SpdyControlFrame* control_frame); 393 const SpdyControlFrame* control_frame);
392 394
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
459 // Helpers for above internal breakouts from ProcessInput. 461 // Helpers for above internal breakouts from ProcessInput.
460 void ProcessControlFrameHeader(); 462 void ProcessControlFrameHeader();
461 bool ProcessSetting(const char* data); // Always passed exactly 8 bytes. 463 bool ProcessSetting(const char* data); // Always passed exactly 8 bytes.
462 464
463 // Get (and lazily initialize) the ZLib state. 465 // Get (and lazily initialize) the ZLib state.
464 z_stream* GetHeaderCompressor(); 466 z_stream* GetHeaderCompressor();
465 z_stream* GetHeaderDecompressor(); 467 z_stream* GetHeaderDecompressor();
466 z_stream* GetStreamDecompressor(SpdyStreamId id); 468 z_stream* GetStreamDecompressor(SpdyStreamId id);
467 469
468 // Compression helpers 470 // Compression helpers
469 SpdyControlFrame* CompressControlFrame(const SpdyControlFrame& frame);
470 void CleanupCompressorForStream(SpdyStreamId id); 471 void CleanupCompressorForStream(SpdyStreamId id);
471 void CleanupDecompressorForStream(SpdyStreamId id); 472 void CleanupDecompressorForStream(SpdyStreamId id);
472 void CleanupStreamCompressorsAndDecompressors(); 473 void CleanupStreamCompressorsAndDecompressors();
473 474
474 // Deliver the given control frame's compressed headers block to the visitor 475 // Deliver the given control frame's compressed headers block to the visitor
475 // in decompressed form, in chunks. Returns true if the visitor has 476 // in decompressed form, in chunks. Returns true if the visitor has
476 // accepted all of the chunks. 477 // accepted all of the chunks.
477 bool IncrementallyDecompressControlFrameHeaderData( 478 bool IncrementallyDecompressControlFrameHeaderData(
478 const SpdyControlFrame* frame, 479 const SpdyControlFrame* frame,
479 const char* data, 480 const char* data,
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
578 // starts with HTTP. If it does, we likely have an HTTP response. This 579 // starts with HTTP. If it does, we likely have an HTTP response. This
579 // isn't guaranteed though: we could have gotten a settings frame and then 580 // isn't guaranteed though: we could have gotten a settings frame and then
580 // corrupt data that just looks like HTTP, but deterministic checking requires 581 // corrupt data that just looks like HTTP, but deterministic checking requires
581 // a lot more state. 582 // a lot more state.
582 bool probable_http_response_; 583 bool probable_http_response_;
583 }; 584 };
584 585
585 } // namespace net 586 } // namespace net
586 587
587 #endif // NET_SPDY_SPDY_FRAMER_H_ 588 #endif // NET_SPDY_SPDY_FRAMER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698