From 8cbb823ec1887fb9397ada2ba5f3ba168f52f137 Mon Sep 17 00:00:00 2001 From: Alex Rudenko Date: Fri, 9 Jul 2021 07:54:12 +0000 Subject: [PATCH] Roll inspector-protocol to 32cf5f2bf4dc20c73ead291e68d2e2f6b638cd57 Includes: - https://chromium-review.googlesource.com/c/deps/inspector_protocol/+/3014475 - https://chromium-review.googlesource.com/c/deps/inspector_protocol/+/3006580 Bug: chromium:1187004, chromium:1187003, chromium:1187006, chromium:1187007 Change-Id: I6afbeb13d6c1f61a9fd7c890068f173b47beb252 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3013351 Reviewed-by: Yang Guo Commit-Queue: Alex Rudenko Cr-Commit-Position: refs/heads/master@{#75661} --- third_party/inspector_protocol/README.v8 | 2 +- .../lib/base_string_adapter_cc.template | 55 +++++++------------ 2 files changed, 20 insertions(+), 37 deletions(-) diff --git a/third_party/inspector_protocol/README.v8 b/third_party/inspector_protocol/README.v8 index cc5e083c6a..c2870d7a39 100644 --- a/third_party/inspector_protocol/README.v8 +++ b/third_party/inspector_protocol/README.v8 @@ -2,7 +2,7 @@ Name: inspector protocol Short Name: inspector_protocol URL: https://chromium.googlesource.com/deps/inspector_protocol/ Version: 0 -Revision: 35e8d2d89cb017d72cf905362672de77c978e1e6 +Revision: 32cf5f2bf4dc20c73ead291e68d2e2f6b638cd57 License: BSD License File: LICENSE Security Critical: no diff --git a/third_party/inspector_protocol/lib/base_string_adapter_cc.template b/third_party/inspector_protocol/lib/base_string_adapter_cc.template index 10488f2243..96a0c8e3f3 100644 --- a/third_party/inspector_protocol/lib/base_string_adapter_cc.template +++ b/third_party/inspector_protocol/lib/base_string_adapter_cc.template @@ -33,51 +33,32 @@ std::unique_ptr toProtocolValue( return nullptr; if (value->is_none()) return protocol::Value::null(); - if (value->is_bool()) { - bool inner; - value->GetAsBoolean(&inner); - return protocol::FundamentalValue::create(inner); - } - if (value->is_int()) { - int inner; - value->GetAsInteger(&inner); - return protocol::FundamentalValue::create(inner); - } - if (value->is_double()) { - double inner; - value->GetAsDouble(&inner); - return protocol::FundamentalValue::create(inner); - } - if (value->is_string()) { - std::string inner; - value->GetAsString(&inner); - return protocol::StringValue::create(inner); - } + if (value->is_bool()) + return protocol::FundamentalValue::create(value->GetBool()); + if (value->is_int()) + return protocol::FundamentalValue::create(value->GetInt()); + if (value->is_double()) + return protocol::FundamentalValue::create(value->GetDouble()); + if (value->is_string()) + return protocol::StringValue::create(value->GetString()); if (value->is_list()) { - const base::ListValue* list = nullptr; - value->GetAsList(&list); std::unique_ptr result = protocol::ListValue::create(); - for (size_t i = 0; i < list->GetSize(); i++) { - const base::Value* item = nullptr; - list->Get(i, &item); + for (const base::Value& item : value->GetList()) { std::unique_ptr converted = - toProtocolValue(item, depth - 1); + toProtocolValue(&item, depth - 1); if (converted) result->pushValue(std::move(converted)); } return result; } if (value->is_dict()) { - const base::DictionaryValue* dictionary = nullptr; - value->GetAsDictionary(&dictionary); std::unique_ptr result = protocol::DictionaryValue::create(); - for (base::DictionaryValue::Iterator it(*dictionary); - !it.IsAtEnd(); it.Advance()) { + for (const auto& it : value->DictItems()) { std::unique_ptr converted = - toProtocolValue(&it.value(), depth - 1); + toProtocolValue(&it.second, depth - 1); if (converted) - result->setValue(it.key(), std::move(converted)); + result->setValue(it.first, std::move(converted)); } return result; } @@ -111,24 +92,26 @@ std::unique_ptr toBaseValue(Value* value, int depth) { } if (value->type() == Value::TypeArray) { ListValue* list = ListValue::cast(value); - std::unique_ptr result(new base::ListValue()); + std::unique_ptr result(new base::Value( + base::Value::Type::LIST)); for (size_t i = 0; i < list->size(); i++) { std::unique_ptr converted = toBaseValue(list->at(i), depth - 1); if (converted) - result->Append(std::move(converted)); + result->Append(std::move(*converted)); } return result; } if (value->type() == Value::TypeObject) { DictionaryValue* dict = DictionaryValue::cast(value); - std::unique_ptr result(new base::DictionaryValue()); + std::unique_ptr result(new base::Value( + base::Value::Type::DICTIONARY)); for (size_t i = 0; i < dict->size(); i++) { DictionaryValue::Entry entry = dict->at(i); std::unique_ptr converted = toBaseValue(entry.second, depth - 1); if (converted) - result->SetWithoutPathExpansion(entry.first, std::move(converted)); + result->SetKey(entry.first, std::move(*converted)); } return result; }