0

Use Value::Take...() in /content/renderer

Refactor to use the new base::Value
TakeString/TakeDict/TakeList methods that transfer ownership
in a clearer way and allow clang-tidy catch misuses.

This CL was uploaded by git cl split.

R=szager@chromium.org

Bug: 1360570
Change-Id: I1ed78145677c4b742f0bad01599d81bd33f30163
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3914212
Auto-Submit: Maksim Ivanov <emaxx@chromium.org>
Commit-Queue: Stefan Zager <szager@chromium.org>
Reviewed-by: Stefan Zager <szager@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1050702}
This commit is contained in:
Maksim Ivanov
2022-09-23 17:15:51 +00:00
committed by Chromium LUCI CQ
parent e2fa7e526b
commit ae1e9a5e3d
2 changed files with 2 additions and 2 deletions

@ -5685,7 +5685,7 @@ void RenderFrameImpl::BeginNavigationInternal(
absl::optional<base::Value> initiator_value =
base::JSONReader::Read(info->devtools_initiator_info.Utf8());
if (initiator_value && initiator_value->is_dict())
initiator = std::move(initiator_value->GetDict());
initiator = std::move(*initiator_value).TakeDict();
}
absl::optional<network::ResourceRequest::WebBundleTokenParams>

@ -149,7 +149,7 @@ void WebUIExtension::Send(gin::Arguments* args) {
V8ValueConverter::Create()->FromV8Value(
obj, frame->MainWorldScriptContext());
DCHECK(value->is_list());
content = std::move(value->GetList());
content = std::move(*value).TakeList();
// The conversion of |obj| could have triggered arbitrary JavaScript code,
// so check that the frame is still valid to avoid dereferencing a stale