Skip to content

Commit

Permalink
[CodeHealth] Remove uses of ListValue::begin()/end() in /content/brow…
Browse files Browse the repository at this point in the history
…ser/webrtc.

This CL removes calls to these deprecated member functions. It also
converts to the newer "for" loop syntax when possible, along with
other minor cleanup.

This CL was uploaded by git cl split.

R=emircan@chromium.org

Bug: 1187107
Change-Id: Ibfa5eae4f008bc6cfb4b9ca6234e360f300ac726
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2876099
Auto-Submit: David Bertoni <dbertoni@chromium.org>
Reviewed-by: Emircan Uysaler <emircan@chromium.org>
Commit-Queue: David Bertoni <dbertoni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#880441}
  • Loading branch information
David Bertoni authored and Chromium LUCI CQ committed May 7, 2021
1 parent 10b58cd commit feb36b8
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions content/browser/webrtc/webrtc_getusermedia_browsertest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -143,11 +143,11 @@ class WebRtcGetUserMediaBrowserTest : public WebRtcContentBrowserTestBase {
base::ListValue* values;
ASSERT_TRUE(parsed_json.value->GetAsList(&values));

for (auto it = values->begin(); it != values->end(); ++it) {
for (const auto& entry : values->GetList()) {
const base::DictionaryValue* dict;
std::string kind;
std::string device_id;
ASSERT_TRUE(it->GetAsDictionary(&dict));
ASSERT_TRUE(entry.GetAsDictionary(&dict));
ASSERT_TRUE(dict->GetString("kind", &kind));
ASSERT_TRUE(dict->GetString("id", &device_id));
ASSERT_FALSE(device_id.empty());
Expand Down
4 changes: 2 additions & 2 deletions content/browser/webrtc/webrtc_internals.cc
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ void WebRTCInternals::RemoveObserver(WebRTCInternalsUIObserver* observer) {
DisableLocalEventLogRecordings();

// TODO(tommi): Consider removing all the peer_connection_data_.
for (auto& dictionary : peer_connection_data_)
for (auto& dictionary : peer_connection_data_.GetList())
FreeLogList(&dictionary);
}

Expand All @@ -359,7 +359,7 @@ void WebRTCInternals::UpdateObserver(WebRTCInternalsUIObserver* observer) {
if (peer_connection_data_.GetSize() > 0)
observer->OnUpdate("update-all-peer-connections", &peer_connection_data_);

for (const auto& request : get_user_media_requests_) {
for (const auto& request : get_user_media_requests_.GetList()) {
observer->OnUpdate("add-get-user-media", &request);
}
}
Expand Down
10 changes: 5 additions & 5 deletions content/browser/webrtc/webrtc_internals_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ TEST_F(WebRtcInternalsTest, EnsureNoLogWhenNoObserver) {
ASSERT_TRUE(observer.event_data()->GetAsList(&list));
EXPECT_EQ(1U, list->GetSize());
base::DictionaryValue* dict = nullptr;
ASSERT_TRUE((*list->begin()).GetAsDictionary(&dict));
ASSERT_TRUE((*list->GetList().begin()).GetAsDictionary(&dict));
base::ListValue* log = nullptr;
ASSERT_FALSE(dict->GetList("log", &log));

Expand Down Expand Up @@ -239,7 +239,7 @@ TEST_F(WebRtcInternalsTest, EnsureLogIsRemovedWhenObserverIsRemoved) {
ASSERT_TRUE(observer.event_data()->GetAsList(&list));
EXPECT_EQ(1U, list->GetSize());
base::DictionaryValue* dict = nullptr;
ASSERT_TRUE((*list->begin()).GetAsDictionary(&dict));
ASSERT_TRUE((*list->GetList().begin()).GetAsDictionary(&dict));
base::ListValue* log = nullptr;
ASSERT_TRUE(dict->GetList("log", &log));

Expand All @@ -250,7 +250,7 @@ TEST_F(WebRtcInternalsTest, EnsureLogIsRemovedWhenObserverIsRemoved) {

ASSERT_TRUE(observer.event_data()->GetAsList(&list));
EXPECT_EQ(1U, list->GetSize());
ASSERT_TRUE((*list->begin()).GetAsDictionary(&dict));
ASSERT_TRUE((*list->GetList().begin()).GetAsDictionary(&dict));
ASSERT_FALSE(dict->GetList("log", &log));

webrtc_internals.OnPeerConnectionRemoved(kFrameId, kLid);
Expand Down Expand Up @@ -410,7 +410,7 @@ TEST_F(WebRtcInternalsTest, SendAllUpdatesWithPeerConnectionUpdate) {
EXPECT_EQ(1U, list->GetSize());

base::DictionaryValue* dict = nullptr;
EXPECT_TRUE((*list->begin()).GetAsDictionary(&dict));
EXPECT_TRUE((*list->GetList().begin()).GetAsDictionary(&dict));

VerifyInt(dict, "rid", kFrameId.child_id);
VerifyInt(dict, "lid", kLid);
Expand All @@ -423,7 +423,7 @@ TEST_F(WebRtcInternalsTest, SendAllUpdatesWithPeerConnectionUpdate) {
ASSERT_TRUE(dict->GetList("log", &log));
EXPECT_EQ(1U, log->GetSize());

EXPECT_TRUE((*log->begin()).GetAsDictionary(&dict));
EXPECT_TRUE((*log->GetList().begin()).GetAsDictionary(&dict));
VerifyString(dict, "type", update_type);
VerifyString(dict, "value", update_value);
std::string time;
Expand Down

0 comments on commit feb36b8

Please sign in to comment.