Some manual change to for-ranged loop.
Use "const auto&" where possible.
This commit is contained in:
Родитель
2717b96310
Коммит
4ac4dacffe
|
@ -241,7 +241,7 @@ void OnGetBackend(disk_cache::Backend** backend_ptr,
|
|||
} else if (action == Session::CacheAction::STATS) {
|
||||
base::StringPairs stats;
|
||||
(*backend_ptr)->GetStats(&stats);
|
||||
for (auto& stat : stats) {
|
||||
for (const auto& stat : stats) {
|
||||
if (stat.first == "Current size") {
|
||||
int current_size;
|
||||
base::StringToInt(stat.second, ¤t_size);
|
||||
|
|
|
@ -435,7 +435,7 @@ void CommonWebContentsDelegate::DevToolsRequestFileSystems() {
|
|||
}
|
||||
|
||||
base::ListValue file_system_value;
|
||||
for (auto& file_system : file_systems)
|
||||
for (const auto& file_system : file_systems)
|
||||
file_system_value.Append(CreateFileSystemValue(file_system));
|
||||
web_contents_->CallClientFunction("DevToolsAPI.fileSystemsLoaded",
|
||||
&file_system_value, nullptr, nullptr);
|
||||
|
|
|
@ -30,7 +30,7 @@ bool StringToAccelerator(const std::string& shortcut,
|
|||
// Now, parse it into an accelerator.
|
||||
int modifiers = ui::EF_NONE;
|
||||
ui::KeyboardCode key = ui::VKEY_UNKNOWN;
|
||||
for (auto& token : tokens) {
|
||||
for (const auto& token : tokens) {
|
||||
bool shifted = false;
|
||||
ui::KeyboardCode code = atom::KeyboardCodeFromStr(token, &shifted);
|
||||
if (shifted)
|
||||
|
|
|
@ -70,7 +70,7 @@ void WindowList::RemoveObserver(WindowListObserver* observer) {
|
|||
// static
|
||||
void WindowList::CloseAllWindows() {
|
||||
WindowVector windows = GetInstance()->windows_;
|
||||
for (auto& window : windows)
|
||||
for (const auto& window : windows)
|
||||
window->Close();
|
||||
}
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@ float GetScaleFactorFromPath(const base::FilePath& path) {
|
|||
|
||||
// We don't try to convert string to float here because it is very very
|
||||
// expensive.
|
||||
for (auto& kScaleFactorPair : kScaleFactorPairs) {
|
||||
for (const auto& kScaleFactorPair : kScaleFactorPairs) {
|
||||
if (base::EndsWith(filename, kScaleFactorPair.name,
|
||||
base::CompareCase::INSENSITIVE_ASCII))
|
||||
return kScaleFactorPair.scale;
|
||||
|
|
|
@ -54,7 +54,8 @@ void NodeBindingsMac::PollEvents() {
|
|||
// Wait for new libuv events.
|
||||
int r;
|
||||
do {
|
||||
r = select(fd + 1, &readset, nullptr, nullptr, timeout == -1 ? nullptr : &tv);
|
||||
r = select(fd + 1, &readset, nullptr, nullptr,
|
||||
timeout == -1 ? nullptr : &tv);
|
||||
} while (r == -1 && errno == EINTR);
|
||||
}
|
||||
|
||||
|
|
|
@ -132,7 +132,7 @@ void AtomRenderViewObserver::DraggableRegionsChanged(blink::WebFrame* frame) {
|
|||
blink::WebVector<blink::WebDraggableRegion> webregions =
|
||||
frame->document().draggableRegions();
|
||||
std::vector<DraggableRegion> regions;
|
||||
for (auto& webregion : webregions) {
|
||||
for (const auto& webregion : webregions) {
|
||||
DraggableRegion region;
|
||||
region.bounds = webregion.bounds;
|
||||
region.draggable = webregion.draggable;
|
||||
|
|
|
@ -58,7 +58,7 @@ bool AtomContentUtilityClient::OnMessageReceived(
|
|||
IPC_MESSAGE_UNHANDLED(handled = false)
|
||||
IPC_END_MESSAGE_MAP()
|
||||
|
||||
for (auto it = handlers_.begin(); !handled && it != handlers_.end(); ++it) {
|
||||
for (auto it = handlers_.begin(); !handled && it != handlers_.end(); ++it) {
|
||||
handled = (*it)->OnMessageReceived(message);
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче