Skip to content

Commit

Permalink
Remove base::Value::SetDoubleWithoutPathExpansion
Browse files Browse the repository at this point in the history
This change removes the deprecated SetDoubleWithoutPathExpansion from
base::Value. Existing usages are replaced by SetKey(key, Value(double)).

Bug: 646113
Change-Id: I883ab500633220f0eead7dba0309c48c1f4618a0
Reviewed-on: https://chromium-review.googlesource.com/591654
Commit-Queue: Jan Wilken Dörrie <jdoerrie@chromium.org>
Reviewed-by: Brett Wilson <brettw@chromium.org>
Cr-Commit-Position: refs/heads/master@{#494879}
  • Loading branch information
jdoerrie authored and Commit Bot committed Aug 16, 2017
1 parent 45a4172 commit 328810b
Show file tree
Hide file tree
Showing 14 changed files with 9 additions and 31 deletions.
2 changes: 1 addition & 1 deletion base/trace_event/trace_event_argument.cc
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ std::unique_ptr<base::Value> TracedValue::ToBaseValue() const {
double value;
CHECK(it.ReadDouble(&value));
if (cur_dict) {
cur_dict->SetDoubleWithoutPathExpansion(ReadKeyName(it), value);
cur_dict->SetKey(ReadKeyName(it), Value(value));
} else {
cur_list->AppendDouble(value);
}
Expand Down
5 changes: 0 additions & 5 deletions base/values.cc
Original file line number Diff line number Diff line change
Expand Up @@ -803,11 +803,6 @@ Value* DictionaryValue::SetWithoutPathExpansion(
return ((*dict_)[key.as_string()] = std::move(in_value)).get();
}

Value* DictionaryValue::SetDoubleWithoutPathExpansion(StringPiece path,
double in_value) {
return SetWithoutPathExpansion(path, MakeUnique<Value>(in_value));
}

Value* DictionaryValue::SetStringWithoutPathExpansion(StringPiece path,
StringPiece in_value) {
return SetWithoutPathExpansion(path, MakeUnique<Value>(in_value));
Expand Down
2 changes: 0 additions & 2 deletions base/values.h
Original file line number Diff line number Diff line change
Expand Up @@ -345,8 +345,6 @@ class BASE_EXPORT DictionaryValue : public Value {
std::unique_ptr<Value> in_value);

// Convenience forms of SetWithoutPathExpansion().
// DEPRECATED, use Value::SetKey(path, Value(double)) instead.
Value* SetDoubleWithoutPathExpansion(StringPiece path, double in_value);
// DEPRECATED, use Value::SetKey(path, Value(string)) instead.
Value* SetStringWithoutPathExpansion(StringPiece path, StringPiece in_value);
// DEPRECATED, use Value::SetKey(path, Value(string16)) instead.
Expand Down
7 changes: 0 additions & 7 deletions base/values_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -896,13 +896,6 @@ TEST(ValuesTest, DictionarySetReturnsPointer) {
EXPECT_EQ(3.142, double_ptr->GetDouble());
}

{
DictionaryValue dict;
Value* double_ptr = dict.SetDoubleWithoutPathExpansion("foo.bar", 2.718);
EXPECT_EQ(Value::Type::DOUBLE, double_ptr->type());
EXPECT_EQ(2.718, double_ptr->GetDouble());
}

{
DictionaryValue dict;
Value* string_ptr = dict.SetString("foo.bar", "foo");
Expand Down
3 changes: 1 addition & 2 deletions chrome/browser/ui/zoom/chrome_zoom_level_prefs.cc
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,7 @@ void ChromeZoomLevelPrefs::OnZoomLevelChanged(
if (modification_is_removal) {
host_zoom_dictionary_weak->RemoveWithoutPathExpansion(change.host, nullptr);
} else {
host_zoom_dictionary_weak->SetDoubleWithoutPathExpansion(change.host,
level);
host_zoom_dictionary_weak->SetKey(change.host, base::Value(level));
}
}

Expand Down
2 changes: 1 addition & 1 deletion dbus/values_util_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ TEST(ValuesUtilTest, PopDictionaryWithDottedStringKey) {
base::DictionaryValue dictionary_value;
dictionary_value.SetKey(kKey1, base::Value(kBoolValue));
dictionary_value.SetKey(kKey2, base::Value(kInt32Value));
dictionary_value.SetDoubleWithoutPathExpansion(kKey3, kDoubleValue);
dictionary_value.SetKey(kKey3, base::Value(kDoubleValue));

// Pop a dictinoary.
MessageReader reader(response.get());
Expand Down
2 changes: 1 addition & 1 deletion ipc/ipc_message_utils_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ TEST(IPCMessageUtilsTest, StackVector) {
TEST(IPCMessageUtilsTest, ValueSize) {
std::unique_ptr<base::DictionaryValue> value(new base::DictionaryValue);
value->SetKey("foo", base::Value(42));
value->SetDoubleWithoutPathExpansion("bar", 3.14);
value->SetKey("bar", base::Value(3.14));
value->SetStringWithoutPathExpansion("baz", "hello");
value->SetWithoutPathExpansion("qux", base::MakeUnique<base::Value>());

Expand Down
2 changes: 1 addition & 1 deletion media/base/video_frame_metadata.cc
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ void VideoFrameMetadata::SetInteger(Key key, int value) {
}

void VideoFrameMetadata::SetDouble(Key key, double value) {
dictionary_.SetDoubleWithoutPathExpansion(ToInternalKey(key), value);
dictionary_.SetKey(ToInternalKey(key), base::Value(value));
}

void VideoFrameMetadata::SetRotation(Key key, VideoRotation value) {
Expand Down
2 changes: 1 addition & 1 deletion services/preferences/pref_service_factory_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ TEST_F(PrefServiceFactoryTest, MultipleClients_SubPrefUpdates_Basic) {
EXPECT_EQ(3, out);
},
[](ScopedDictionaryPrefUpdate* update) {
(*update)->SetDoubleWithoutPathExpansion("key.for.double", 4);
(*update)->SetKey("key.for.double", base::Value(4.0));
double out = 0;
ASSERT_TRUE(
(*update)->GetDoubleWithoutPathExpansion("key.for.double", &out));
Expand Down
6 changes: 0 additions & 6 deletions services/preferences/public/cpp/dictionary_value_update.cc
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,6 @@ void DictionaryValueUpdate::SetWithoutPathExpansion(
value_->SetWithoutPathExpansion(key, std::move(in_value));
}

void DictionaryValueUpdate::SetDoubleWithoutPathExpansion(
base::StringPiece path,
double in_value) {
SetWithoutPathExpansion(path, base::MakeUnique<base::Value>(in_value));
}

void DictionaryValueUpdate::SetStringWithoutPathExpansion(
base::StringPiece path,
base::StringPiece in_value) {
Expand Down
1 change: 0 additions & 1 deletion services/preferences/public/cpp/dictionary_value_update.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ class DictionaryValueUpdate {
std::unique_ptr<base::Value> in_value);

// Convenience forms of SetWithoutPathExpansion().
void SetDoubleWithoutPathExpansion(base::StringPiece path, double in_value);
void SetStringWithoutPathExpansion(base::StringPiece path,
base::StringPiece in_value);
void SetStringWithoutPathExpansion(base::StringPiece path,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ TEST_F(PersistentPrefStoreClientTest,
TEST_F(PersistentPrefStoreClientTest, SubPrefUpdates_MultipleUpdates) {
{
ScopedDictionaryPrefUpdate update(pref_service(), kDictionaryKey);
update->SetDoubleWithoutPathExpansion("a.double", 1);
update->SetKey("a.double", base::Value(1.0));
}
{
ScopedDictionaryPrefUpdate update(pref_service(), kDictionaryKey);
Expand Down
2 changes: 1 addition & 1 deletion tools/ipc_fuzzer/fuzzer/fuzzer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -602,7 +602,7 @@ struct FuzzTraits<base::DictionaryValue> {
case base::Value::Type::DOUBLE: {
double tmp;
fuzzer->FuzzDouble(&tmp);
p->SetDoubleWithoutPathExpansion(property, tmp);
p->SetKey(property, base::Value(tmp));
break;
}
case base::Value::Type::STRING: {
Expand Down
2 changes: 1 addition & 1 deletion tools/json_schema_compiler/test/simple_api_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace {

static std::unique_ptr<base::DictionaryValue> CreateTestTypeDictionary() {
std::unique_ptr<base::DictionaryValue> value(new base::DictionaryValue());
value->SetDoubleWithoutPathExpansion("number", 1.1);
value->SetKey("number", base::Value(1.1));
value->SetKey("integer", base::Value(4));
value->SetStringWithoutPathExpansion("string", "bling");
value->SetKey("boolean", base::Value(true));
Expand Down

0 comments on commit 328810b

Please sign in to comment.