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

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

Issue 2665283003: Improve memory estimate of SpdySessionPool in net/ MemoryDumpProvider. (Closed)
Patch Set: rebased Created 3 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
« no previous file with comments | « net/spdy/spdy_buffer_producer.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 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after
521 521
522 void SetEncoderHeaderTableDebugVisitor( 522 void SetEncoderHeaderTableDebugVisitor(
523 std::unique_ptr<HpackHeaderTable::DebugVisitorInterface> visitor); 523 std::unique_ptr<HpackHeaderTable::DebugVisitorInterface> visitor);
524 524
525 // For use in SpdyFramerDecoderAdapter implementations; returns a HPACK 525 // For use in SpdyFramerDecoderAdapter implementations; returns a HPACK
526 // decoder to be used. 526 // decoder to be used.
527 HpackDecoderInterface* GetHpackDecoderForAdapter() { 527 HpackDecoderInterface* GetHpackDecoderForAdapter() {
528 return GetHpackDecoder(); 528 return GetHpackDecoder();
529 } 529 }
530 530
531 // Returns the estimate of dynamically allocated memory in bytes.
532 size_t EstimateMemoryUsage() const;
533
531 protected: 534 protected:
532 friend class BufferedSpdyFramer; 535 friend class BufferedSpdyFramer;
533 friend class HttpNetworkLayer; // This is temporary for the server. 536 friend class HttpNetworkLayer; // This is temporary for the server.
534 friend class HttpNetworkTransactionTest; 537 friend class HttpNetworkTransactionTest;
535 friend class HttpProxyClientSocketPoolTest; 538 friend class HttpProxyClientSocketPoolTest;
536 friend class SpdyHttpStreamTest; 539 friend class SpdyHttpStreamTest;
537 friend class SpdyNetworkTransactionTest; 540 friend class SpdyNetworkTransactionTest;
538 friend class SpdyProxyClientSocketTest; 541 friend class SpdyProxyClientSocketTest;
539 friend class SpdySessionTest; 542 friend class SpdySessionTest;
540 friend class SpdyStreamTest; 543 friend class SpdyStreamTest;
541 friend class test::TestSpdyVisitor; 544 friend class test::TestSpdyVisitor;
542 friend class test::SpdyFramerPeer; 545 friend class test::SpdyFramerPeer;
543 546
544 private: 547 private:
545 class CharBuffer { 548 class CharBuffer {
546 public: 549 public:
547 explicit CharBuffer(size_t capacity); 550 explicit CharBuffer(size_t capacity);
548 ~CharBuffer(); 551 ~CharBuffer();
549 552
550 void CopyFrom(const char* data, size_t size); 553 void CopyFrom(const char* data, size_t size);
551 void Rewind(); 554 void Rewind();
552 555
553 const char* data() const { return buffer_.get(); } 556 const char* data() const { return buffer_.get(); }
554 size_t len() const { return len_; } 557 size_t len() const { return len_; }
555 558
559 size_t EstimateMemoryUsage() const;
560
556 private: 561 private:
557 std::unique_ptr<char[]> buffer_; 562 std::unique_ptr<char[]> buffer_;
558 size_t capacity_; 563 size_t capacity_;
559 size_t len_; 564 size_t len_;
560 }; 565 };
561 566
562 // Scratch space necessary for processing SETTINGS frames. 567 // Scratch space necessary for processing SETTINGS frames.
563 struct SpdySettingsScratch { 568 struct SpdySettingsScratch {
564 SpdySettingsScratch(); 569 SpdySettingsScratch();
565 void Reset(); 570 void Reset();
571 size_t EstimateMemoryUsage() const;
566 572
567 // Buffer contains up to one complete key/value pair. 573 // Buffer contains up to one complete key/value pair.
568 CharBuffer buffer; 574 CharBuffer buffer;
569 575
570 // The ID of the last setting that was processed in the current SETTINGS 576 // The ID of the last setting that was processed in the current SETTINGS
571 // frame. Used for detecting out-of-order or duplicate keys within a 577 // frame. Used for detecting out-of-order or duplicate keys within a
572 // settings frame. Set to -1 before first key/value pair is processed. 578 // settings frame. Set to -1 before first key/value pair is processed.
573 int last_setting_id; 579 int last_setting_id;
574 }; 580 };
575 581
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
744 // rather than reading all available input. 750 // rather than reading all available input.
745 bool process_single_input_frame_ = false; 751 bool process_single_input_frame_ = false;
746 752
747 // Latched value of FLAGS_chromium_http2_flag_remove_rewritelength. 753 // Latched value of FLAGS_chromium_http2_flag_remove_rewritelength.
748 bool skip_rewritelength_ = false; 754 bool skip_rewritelength_ = false;
749 }; 755 };
750 756
751 } // namespace net 757 } // namespace net
752 758
753 #endif // NET_SPDY_SPDY_FRAMER_H_ 759 #endif // NET_SPDY_SPDY_FRAMER_H_
OLDNEW
« no previous file with comments | « net/spdy/spdy_buffer_producer.cc ('k') | net/spdy/spdy_framer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698