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

Side by Side Diff: net/spdy/hpack/hpack_huffman_table.cc

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/hpack/hpack_huffman_table.h ('k') | net/spdy/hpack/hpack_output_stream.h » ('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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #include "net/spdy/hpack/hpack_huffman_table.h" 5 #include "net/spdy/hpack/hpack_huffman_table.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 #include <memory> 9 #include <memory>
10 10
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/numerics/safe_conversions.h" 12 #include "base/numerics/safe_conversions.h"
13 #include "net/spdy/hpack/hpack_input_stream.h" 13 #include "net/spdy/hpack/hpack_input_stream.h"
14 #include "net/spdy/hpack/hpack_output_stream.h" 14 #include "net/spdy/hpack/hpack_output_stream.h"
15 #include "net/spdy/platform/api/spdy_estimate_memory_usage.h"
15 16
16 namespace net { 17 namespace net {
17 18
18 using base::StringPiece; 19 using base::StringPiece;
19 using std::string; 20 using std::string;
20 21
21 namespace { 22 namespace {
22 23
23 // How many bits to index in the root decode table. 24 // How many bits to index in the root decode table.
24 const uint8_t kDecodeTableRootBits = 9; 25 const uint8_t kDecodeTableRootBits = 9;
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 in->ConsumeBits(entry.length); 312 in->ConsumeBits(entry.length);
312 bits = bits << entry.length; 313 bits = bits << entry.length;
313 bits_available -= entry.length; 314 bits_available -= entry.length;
314 } 315 }
315 peeked_success = in->PeekBits(&bits_available, &bits); 316 peeked_success = in->PeekBits(&bits_available, &bits);
316 } 317 }
317 NOTREACHED(); 318 NOTREACHED();
318 return false; 319 return false;
319 } 320 }
320 321
322 size_t HpackHuffmanTable::EstimateMemoryUsage() const {
323 return SpdyEstimateMemoryUsage(decode_tables_) +
324 SpdyEstimateMemoryUsage(decode_entries_) +
325 SpdyEstimateMemoryUsage(code_by_id_) +
326 SpdyEstimateMemoryUsage(length_by_id_);
327 }
328
321 } // namespace net 329 } // namespace net
OLDNEW
« no previous file with comments | « net/spdy/hpack/hpack_huffman_table.h ('k') | net/spdy/hpack/hpack_output_stream.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698