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

Side by Side Diff: net/base/capturing_net_log.cc

Issue 11885009: Improve performance of proxy resolver by tracing DNS dependencies. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: re-upload due to failure last time Created 7 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/base/capturing_net_log.h ('k') | net/base/mock_host_resolver.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 (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 #include "net/base/capturing_net_log.h" 5 #include "net/base/capturing_net_log.h"
6 6
7 #include "base/json/json_writer.h"
7 #include "base/logging.h" 8 #include "base/logging.h"
8 #include "base/values.h" 9 #include "base/values.h"
9 10
10 namespace net { 11 namespace net {
11 12
12 CapturingNetLog::CapturedEntry::CapturedEntry( 13 CapturingNetLog::CapturedEntry::CapturedEntry(
13 EventType type, 14 EventType type,
14 const base::TimeTicks& time, 15 const base::TimeTicks& time,
15 Source source, 16 Source source,
16 EventPhase phase, 17 EventPhase phase,
(...skipping 10 matching lines...) Expand all
27 } 28 }
28 29
29 CapturingNetLog::CapturedEntry::~CapturedEntry() {} 30 CapturingNetLog::CapturedEntry::~CapturedEntry() {}
30 31
31 CapturingNetLog::CapturedEntry& 32 CapturingNetLog::CapturedEntry&
32 CapturingNetLog::CapturedEntry::operator=(const CapturedEntry& entry) { 33 CapturingNetLog::CapturedEntry::operator=(const CapturedEntry& entry) {
33 type = entry.type; 34 type = entry.type;
34 time = entry.time; 35 time = entry.time;
35 source = entry.source; 36 source = entry.source;
36 phase = entry.phase; 37 phase = entry.phase;
37 params.reset(entry.params.get() ? entry.params->DeepCopy() : NULL); 38 params.reset(entry.params ? entry.params->DeepCopy() : NULL);
38 return *this; 39 return *this;
39 } 40 }
40 41
41 bool CapturingNetLog::CapturedEntry::GetStringValue( 42 bool CapturingNetLog::CapturedEntry::GetStringValue(
42 const std::string& name, 43 const std::string& name,
43 std::string* value) const { 44 std::string* value) const {
44 if (!params.get()) 45 if (!params)
45 return false; 46 return false;
46 return params->GetString(name, value); 47 return params->GetString(name, value);
47 } 48 }
48 49
49 bool CapturingNetLog::CapturedEntry::GetIntegerValue( 50 bool CapturingNetLog::CapturedEntry::GetIntegerValue(
50 const std::string& name, 51 const std::string& name,
51 int* value) const { 52 int* value) const {
52 if (!params.get()) 53 if (!params)
53 return false; 54 return false;
54 return params->GetInteger(name, value); 55 return params->GetInteger(name, value);
55 } 56 }
56 57
57 bool CapturingNetLog::CapturedEntry::GetNetErrorCode(int* value) const { 58 bool CapturingNetLog::CapturedEntry::GetNetErrorCode(int* value) const {
58 return GetIntegerValue("net_error", value); 59 return GetIntegerValue("net_error", value);
59 } 60 }
60 61
62 std::string CapturingNetLog::CapturedEntry::GetParamsJson() const {
63 if (!params)
64 return std::string();
65 std::string json;
66 base::JSONWriter::Write(params.get(), &json);
67 return json;
68 }
69
61 CapturingNetLog::CapturingNetLog() 70 CapturingNetLog::CapturingNetLog()
62 : last_id_(0), 71 : last_id_(0),
63 log_level_(LOG_ALL_BUT_BYTES) { 72 log_level_(LOG_ALL_BUT_BYTES) {
64 } 73 }
65 74
66 CapturingNetLog::~CapturingNetLog() {} 75 CapturingNetLog::~CapturingNetLog() {}
67 76
68 void CapturingNetLog::GetEntries(CapturedEntryList* entry_list) const { 77 void CapturingNetLog::GetEntries(CapturedEntryList* entry_list) const {
69 base::AutoLock lock(lock_); 78 base::AutoLock lock(lock_);
70 *entry_list = captured_entries_; 79 *entry_list = captured_entries_;
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 158
150 void CapturingBoundNetLog::Clear() { 159 void CapturingBoundNetLog::Clear() {
151 capturing_net_log_.Clear(); 160 capturing_net_log_.Clear();
152 } 161 }
153 162
154 void CapturingBoundNetLog::SetLogLevel(NetLog::LogLevel log_level) { 163 void CapturingBoundNetLog::SetLogLevel(NetLog::LogLevel log_level) {
155 capturing_net_log_.SetLogLevel(log_level); 164 capturing_net_log_.SetLogLevel(log_level);
156 } 165 }
157 166
158 } // namespace net 167 } // namespace net
OLDNEW
« no previous file with comments | « net/base/capturing_net_log.h ('k') | net/base/mock_host_resolver.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698