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

Side by Side Diff: base/values.cc

Issue 1129083003: More base::Values-related bare pointer -> scoped_ptr conversions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 7 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
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 "base/values.h" 5 #include "base/values.h"
6 6
7 #include <string.h> 7 #include <string.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <cmath> 10 #include <cmath>
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 private: 78 private:
79 const Value* first_; 79 const Value* first_;
80 }; 80 };
81 81
82 } // namespace 82 } // namespace
83 83
84 Value::~Value() { 84 Value::~Value() {
85 } 85 }
86 86
87 // static 87 // static
88 Value* Value::CreateNullValue() { 88 scoped_ptr<Value> Value::CreateNullValue() {
89 return new Value(TYPE_NULL); 89 return make_scoped_ptr(new Value(TYPE_NULL));
90 } 90 }
91 91
92 bool Value::GetAsBinary(const BinaryValue** out_value) const { 92 bool Value::GetAsBinary(const BinaryValue** out_value) const {
93 return false; 93 return false;
94 } 94 }
95 95
96 bool Value::GetAsBoolean(bool* out_value) const { 96 bool Value::GetAsBoolean(bool* out_value) const {
97 return false; 97 return false;
98 } 98 }
99 99
(...skipping 26 matching lines...) Expand all
126 } 126 }
127 127
128 bool Value::GetAsDictionary(DictionaryValue** out_value) { 128 bool Value::GetAsDictionary(DictionaryValue** out_value) {
129 return false; 129 return false;
130 } 130 }
131 131
132 bool Value::GetAsDictionary(const DictionaryValue** out_value) const { 132 bool Value::GetAsDictionary(const DictionaryValue** out_value) const {
133 return false; 133 return false;
134 } 134 }
135 135
136 Value* Value::DeepCopy() const { 136 Value* Value::DeepCopy() const {
danakj 2015/05/08 18:07:26 TODO to return scoped_ptr?
Evan Stade 2015/05/08 18:32:09 See CreateDeepCopy below. There's a TODO in the he
137 // This method should only be getting called for null Values--all subclasses 137 // This method should only be getting called for null Values--all subclasses
138 // need to provide their own implementation;. 138 // need to provide their own implementation;.
139 DCHECK(IsType(TYPE_NULL)); 139 DCHECK(IsType(TYPE_NULL));
140 return CreateNullValue(); 140 return CreateNullValue().release();
141 } 141 }
142 142
143 scoped_ptr<Value> Value::CreateDeepCopy() const { 143 scoped_ptr<Value> Value::CreateDeepCopy() const {
144 return make_scoped_ptr(DeepCopy()); 144 return make_scoped_ptr(DeepCopy());
145 } 145 }
146 146
147 bool Value::Equals(const Value* other) const { 147 bool Value::Equals(const Value* other) const {
148 // This method should only be getting called for null Values--all subclasses 148 // This method should only be getting called for null Values--all subclasses
149 // need to provide their own implementation;. 149 // need to provide their own implementation;.
150 DCHECK(IsType(TYPE_NULL)); 150 DCHECK(IsType(TYPE_NULL));
(...skipping 1013 matching lines...) Expand 10 before | Expand all | Expand 10 after
1164 1164
1165 std::ostream& operator<<(std::ostream& out, const Value& value) { 1165 std::ostream& operator<<(std::ostream& out, const Value& value) {
1166 std::string json; 1166 std::string json;
1167 JSONWriter::WriteWithOptions(&value, 1167 JSONWriter::WriteWithOptions(&value,
1168 JSONWriter::OPTIONS_PRETTY_PRINT, 1168 JSONWriter::OPTIONS_PRETTY_PRINT,
1169 &json); 1169 &json);
1170 return out << json; 1170 return out << json;
1171 } 1171 }
1172 1172
1173 } // namespace base 1173 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698