fix: clang-tidy performance-inefficient-vector-operation
warnings (32-x-y backport) (#44848)
fix: clang-tidy `performance-inefficient-vector-operation` warnings (#44743) * fix: performance-inefficient-vector-operation warning in Clipboard::WriteFilesForTesting() * fix: performance-inefficient-vector-operation warning in GetUploadedReports()
This commit is contained in:
parent
4a3b3a6aee
commit
e9da87822f
2 changed files with 14 additions and 18 deletions
|
@ -10,8 +10,7 @@
|
|||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "base/command_line.h"
|
||||
#include "base/functional/bind.h"
|
||||
#include "base/containers/to_vector.h"
|
||||
#include "base/no_destructor.h"
|
||||
#include "base/path_service.h"
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
|
@ -223,18 +222,17 @@ v8::Local<v8::Value> GetUploadedReports(v8::Isolate* isolate) {
|
|||
list->LoadSync();
|
||||
}
|
||||
|
||||
auto to_obj = [isolate](const UploadList::UploadInfo* upload) {
|
||||
return gin::DataObjectBuilder{isolate}
|
||||
.Set("date", upload->upload_time)
|
||||
.Set("id", upload->upload_id)
|
||||
.Build();
|
||||
};
|
||||
|
||||
constexpr size_t kMaxUploadReportsToList = std::numeric_limits<size_t>::max();
|
||||
const std::vector<const UploadList::UploadInfo*> uploads =
|
||||
list->GetUploads(kMaxUploadReportsToList);
|
||||
std::vector<v8::Local<v8::Object>> result;
|
||||
for (auto* const upload : uploads) {
|
||||
result.push_back(gin::DataObjectBuilder(isolate)
|
||||
.Set("date", upload->upload_time)
|
||||
.Set("id", upload->upload_id)
|
||||
.Build());
|
||||
}
|
||||
v8::Local<v8::Value> v8_result = gin::ConvertToV8(isolate, result);
|
||||
return v8_result;
|
||||
return gin::ConvertToV8(
|
||||
isolate,
|
||||
base::ToVector(list->GetUploads(kMaxUploadReportsToList), to_obj));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue