refactor: apply some 'clang-tidy -fix' changes (#20172)

* refactor: fix clang-tidy vector operation warnings

Fix vector population performance-inefficient-vector-operation warnings
generated by clang-tidy

* refactor: fix clang-tidy emplace_back warnings

In cases where a temporary is created to be passed
to push_back(), replace it with emplace_back().

Warning: modernize-use-emplace

* refactor: fix clang-tidy loop iteration warnings

When practical, use range-based for loops instead of C-style for loops.

clang-tiny check: modernize-loop-convert

* refactor: fix clang-tidy string initialize warning

Remove redundant empty string initialization.

clang-tidy check: readability-redundant-string-init
This commit is contained in:
Charles Kerr 2019-09-13 10:26:59 -04:00 committed by GitHub
parent 3ec17a88ba
commit b2652beceb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 62 additions and 69 deletions

View file

@ -170,19 +170,19 @@ void MediaStreamDevicesController::HandleUserMediaRequest() {
if (request_.audio_type ==
blink::mojom::MediaStreamType::GUM_TAB_AUDIO_CAPTURE) {
devices.push_back(blink::MediaStreamDevice(
blink::mojom::MediaStreamType::GUM_TAB_AUDIO_CAPTURE, "", ""));
devices.emplace_back(blink::mojom::MediaStreamType::GUM_TAB_AUDIO_CAPTURE,
"", "");
}
if (request_.video_type ==
blink::mojom::MediaStreamType::GUM_TAB_VIDEO_CAPTURE) {
devices.push_back(blink::MediaStreamDevice(
blink::mojom::MediaStreamType::GUM_TAB_VIDEO_CAPTURE, "", ""));
devices.emplace_back(blink::mojom::MediaStreamType::GUM_TAB_VIDEO_CAPTURE,
"", "");
}
if (request_.audio_type ==
blink::mojom::MediaStreamType::GUM_DESKTOP_AUDIO_CAPTURE) {
devices.push_back(blink::MediaStreamDevice(
devices.emplace_back(
blink::mojom::MediaStreamType::GUM_DESKTOP_AUDIO_CAPTURE, "loopback",
"System Audio"));
"System Audio");
}
if (request_.video_type ==
blink::mojom::MediaStreamType::GUM_DESKTOP_VIDEO_CAPTURE) {
@ -197,9 +197,9 @@ void MediaStreamDevicesController::HandleUserMediaRequest() {
content::DesktopMediaID::Parse(request_.requested_video_device_id);
}
devices.push_back(blink::MediaStreamDevice(
devices.emplace_back(
blink::mojom::MediaStreamType::GUM_DESKTOP_VIDEO_CAPTURE,
screen_id.ToString(), "Screen"));
screen_id.ToString(), "Screen");
}
std::move(callback_).Run(