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

Side by Side Diff: net/filter/sdch_source_stream.cc

Issue 2525743002: Make URLRequestContext a MemoryDumpProvider (Abandoned) (Closed)
Patch Set: self review Created 4 years 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/filter/sdch_source_stream.h" 5 #include "net/filter/sdch_source_stream.h"
6 6
7 #include "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/numerics/safe_conversions.h" 10 #include "base/numerics/safe_conversions.h"
11 #include "base/strings/stringprintf.h"
12 #include "base/trace_event/memory_allocator_dump.h"
13 #include "base/trace_event/process_memory_dump.h"
11 #include "base/values.h" 14 #include "base/values.h"
12 #include "net/base/io_buffer.h" 15 #include "net/base/io_buffer.h"
13 #include "net/log/net_log_capture_mode.h" 16 #include "net/log/net_log_capture_mode.h"
14 #include "sdch/open-vcdiff/src/google/vcdecoder.h" 17 #include "sdch/open-vcdiff/src/google/vcdecoder.h"
15 18
16 namespace net { 19 namespace net {
17 20
18 namespace { 21 namespace {
19 22
20 const size_t kServerIdLength = 9; 23 const size_t kServerIdLength = 9;
(...skipping 26 matching lines...) Expand all
47 decoding_not_finished); 50 decoding_not_finished);
48 } 51 }
49 52
50 std::string SdchSourceStream::GetTypeAsString() const { 53 std::string SdchSourceStream::GetTypeAsString() const {
51 if (type() == TYPE_SDCH) 54 if (type() == TYPE_SDCH)
52 return kSdch; 55 return kSdch;
53 DCHECK_EQ(TYPE_SDCH_POSSIBLE, type()); 56 DCHECK_EQ(TYPE_SDCH_POSSIBLE, type());
54 return kSdchPossible; 57 return kSdchPossible;
55 } 58 }
56 59
60 void SdchSourceStream::DumpMemoryStatsImpl(
61 base::trace_event::MemoryAllocatorDump* dump) const {
62 // Log pointer address to avoid duplication though in practice there is
63 // often only one SdchSourceStream per URLRequest.
64 base::trace_event::MemoryAllocatorDump* sdch_dump =
65 dump->process_memory_dump()->CreateAllocatorDump(base::StringPrintf(
66 "%s/sdch_%p", dump->absolute_name().c_str(), this));
67 sdch_dump->AddScalar(base::trace_event::MemoryAllocatorDump::kNameSize,
68 base::trace_event::MemoryAllocatorDump::kUnitsBytes,
69 buffered_output_.size());
70 }
71
57 int SdchSourceStream::FilterData(IOBuffer* output_buffer, 72 int SdchSourceStream::FilterData(IOBuffer* output_buffer,
58 int output_buffer_size, 73 int output_buffer_size,
59 IOBuffer* input_buffer, 74 IOBuffer* input_buffer,
60 int input_buffer_size, 75 int input_buffer_size,
61 int* consumed_bytes, 76 int* consumed_bytes,
62 bool /*upstream_end_reached*/) { 77 bool /*upstream_end_reached*/) {
63 DCHECK_LE(0, input_buffer_size); 78 DCHECK_LE(0, input_buffer_size);
64 int input_data_size = input_buffer_size; 79 int input_data_size = input_buffer_size;
65 char* input_data = input_buffer->data(); 80 char* input_data = input_buffer->data();
66 int bytes_out = 0; 81 int bytes_out = 0;
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 input_state_ = STATE_PASS_THROUGH; 201 input_state_ = STATE_PASS_THROUGH;
187 break; 202 break;
188 case Delegate::REPLACE_OUTPUT: 203 case Delegate::REPLACE_OUTPUT:
189 input_state_ = STATE_OUTPUT_REPLACE; 204 input_state_ = STATE_OUTPUT_REPLACE;
190 break; 205 break;
191 } 206 }
192 return true; 207 return true;
193 } 208 }
194 209
195 } // namespace net 210 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698