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

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

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

Powered by Google App Engine
This is Rietveld 408576698