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

Side by Side Diff: net/disk_cache/net_log_parameters.cc

Issue 1059843002: Refactor NetLog::LogLevel --> NetLogCaptureMode. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase again to fix a merge conflict Created 5 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
« no previous file with comments | « net/disk_cache/memory/mem_entry_impl.cc ('k') | net/disk_cache/simple/simple_entry_impl.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 #include "net/disk_cache/net_log_parameters.h" 5 #include "net/disk_cache/net_log_parameters.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
10 #include "base/values.h" 10 #include "base/values.h"
11 #include "net/base/net_errors.h" 11 #include "net/base/net_errors.h"
12 #include "net/disk_cache/disk_cache.h" 12 #include "net/disk_cache/disk_cache.h"
13 13
14 namespace { 14 namespace {
15 15
16 base::Value* NetLogEntryCreationCallback( 16 base::Value* NetLogEntryCreationCallback(
17 const disk_cache::Entry* entry, 17 const disk_cache::Entry* entry,
18 bool created, 18 bool created,
19 net::NetLog::LogLevel /* log_level */) { 19 net::NetLogCaptureMode /* capture_mode */) {
20 base::DictionaryValue* dict = new base::DictionaryValue(); 20 base::DictionaryValue* dict = new base::DictionaryValue();
21 dict->SetString("key", entry->GetKey()); 21 dict->SetString("key", entry->GetKey());
22 dict->SetBoolean("created", created); 22 dict->SetBoolean("created", created);
23 return dict; 23 return dict;
24 } 24 }
25 25
26 base::Value* NetLogReadWriteDataCallback( 26 base::Value* NetLogReadWriteDataCallback(
27 int index, 27 int index,
28 int offset, 28 int offset,
29 int buf_len, 29 int buf_len,
30 bool truncate, 30 bool truncate,
31 net::NetLog::LogLevel /* log_level */) { 31 net::NetLogCaptureMode /* capture_mode */) {
32 base::DictionaryValue* dict = new base::DictionaryValue(); 32 base::DictionaryValue* dict = new base::DictionaryValue();
33 dict->SetInteger("index", index); 33 dict->SetInteger("index", index);
34 dict->SetInteger("offset", offset); 34 dict->SetInteger("offset", offset);
35 dict->SetInteger("buf_len", buf_len); 35 dict->SetInteger("buf_len", buf_len);
36 if (truncate) 36 if (truncate)
37 dict->SetBoolean("truncate", truncate); 37 dict->SetBoolean("truncate", truncate);
38 return dict; 38 return dict;
39 } 39 }
40 40
41 base::Value* NetLogReadWriteCompleteCallback( 41 base::Value* NetLogReadWriteCompleteCallback(
42 int bytes_copied, 42 int bytes_copied,
43 net::NetLog::LogLevel /* log_level */) { 43 net::NetLogCaptureMode /* capture_mode */) {
44 DCHECK_NE(bytes_copied, net::ERR_IO_PENDING); 44 DCHECK_NE(bytes_copied, net::ERR_IO_PENDING);
45 base::DictionaryValue* dict = new base::DictionaryValue(); 45 base::DictionaryValue* dict = new base::DictionaryValue();
46 if (bytes_copied < 0) { 46 if (bytes_copied < 0) {
47 dict->SetInteger("net_error", bytes_copied); 47 dict->SetInteger("net_error", bytes_copied);
48 } else { 48 } else {
49 dict->SetInteger("bytes_copied", bytes_copied); 49 dict->SetInteger("bytes_copied", bytes_copied);
50 } 50 }
51 return dict; 51 return dict;
52 } 52 }
53 53
54 base::Value* NetLogSparseOperationCallback( 54 base::Value* NetLogSparseOperationCallback(
55 int64 offset, 55 int64 offset,
56 int buff_len, 56 int buff_len,
57 net::NetLog::LogLevel /* log_level */) { 57 net::NetLogCaptureMode /* capture_mode */) {
58 base::DictionaryValue* dict = new base::DictionaryValue(); 58 base::DictionaryValue* dict = new base::DictionaryValue();
59 // Values can only be created with at most 32-bit integers. Using a string 59 // Values can only be created with at most 32-bit integers. Using a string
60 // instead circumvents that restriction. 60 // instead circumvents that restriction.
61 dict->SetString("offset", base::Int64ToString(offset)); 61 dict->SetString("offset", base::Int64ToString(offset));
62 dict->SetInteger("buff_len", buff_len); 62 dict->SetInteger("buff_len", buff_len);
63 return dict; 63 return dict;
64 } 64 }
65 65
66 base::Value* NetLogSparseReadWriteCallback( 66 base::Value* NetLogSparseReadWriteCallback(
67 const net::NetLog::Source& source, 67 const net::NetLog::Source& source,
68 int child_len, 68 int child_len,
69 net::NetLog::LogLevel /* log_level */) { 69 net::NetLogCaptureMode /* capture_mode */) {
70 base::DictionaryValue* dict = new base::DictionaryValue(); 70 base::DictionaryValue* dict = new base::DictionaryValue();
71 source.AddToEventParameters(dict); 71 source.AddToEventParameters(dict);
72 dict->SetInteger("child_len", child_len); 72 dict->SetInteger("child_len", child_len);
73 return dict; 73 return dict;
74 } 74 }
75 75
76 base::Value* NetLogGetAvailableRangeResultCallback( 76 base::Value* NetLogGetAvailableRangeResultCallback(
77 int64 start, 77 int64 start,
78 int result, 78 int result,
79 net::NetLog::LogLevel /* log_level */) { 79 net::NetLogCaptureMode /* capture_mode */) {
80 base::DictionaryValue* dict = new base::DictionaryValue(); 80 base::DictionaryValue* dict = new base::DictionaryValue();
81 if (result > 0) { 81 if (result > 0) {
82 dict->SetInteger("length", result); 82 dict->SetInteger("length", result);
83 dict->SetString("start", base::Int64ToString(start)); 83 dict->SetString("start", base::Int64ToString(start));
84 } else { 84 } else {
85 dict->SetInteger("net_error", result); 85 dict->SetInteger("net_error", result);
86 } 86 }
87 return dict; 87 return dict;
88 } 88 }
89 89
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 return base::Bind(&NetLogSparseReadWriteCallback, source, child_len); 124 return base::Bind(&NetLogSparseReadWriteCallback, source, child_len);
125 } 125 }
126 126
127 net::NetLog::ParametersCallback CreateNetLogGetAvailableRangeResultCallback( 127 net::NetLog::ParametersCallback CreateNetLogGetAvailableRangeResultCallback(
128 int64 start, 128 int64 start,
129 int result) { 129 int result) {
130 return base::Bind(&NetLogGetAvailableRangeResultCallback, start, result); 130 return base::Bind(&NetLogGetAvailableRangeResultCallback, start, result);
131 } 131 }
132 132
133 } // namespace disk_cache 133 } // namespace disk_cache
OLDNEW
« no previous file with comments | « net/disk_cache/memory/mem_entry_impl.cc ('k') | net/disk_cache/simple/simple_entry_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698