@arthurs...@chromium.org, do you think we should split this CL? If so, do you have any suggestions, like split by folder?
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
**[Early Review]** This is an automated early review generated by an LLM. It is intended to help you catch obvious issues early and **potentially save a round of code review**.
If you find any suggestion irrelevant, please feel free to *ignore* or *close* it.
_I am going to do a manual code review when I wake up._
Please see suggestions below.
const std::vector<raw_ptr<ProjectsPanelThreadItemView>>**[Early Review]**
Returning `std::vector<raw_ptr<T>>` by value causes unnecessary copies of the vector and all its `raw_ptr` elements (which have non-trivial copy constructors/destructors due to MiraclePtr ref-counting). This is especially costly in `projects_panel_recent_threads_view_unittest.cc` where `item_views_for_testing()` is called inside a loop, resulting in O(N^2) copies of the vector. Consider returning by const reference instead: `const std::vector<raw_ptr<ProjectsPanelThreadItemView>>& item_views_for_testing() const`.
std::vector<raw_ptr<ProjectsPanelTabGroupsItemView>> item_views_for_testing()**[Early Review]**
Returning `std::vector<raw_ptr<T>>` by value causes unnecessary copies of the vector and all its `raw_ptr` elements. Since this just returns a member variable, consider returning by const reference instead: `const std::vector<raw_ptr<ProjectsPanelTabGroupsItemView>>& item_views_for_testing() const`.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
@arthurs...@chromium.org, do you think we should split this CL? If so, do you have any suggestions, like split by folder?
Me + @blun...@chromium.org would cover every files, except 1. So 3 reviewers would be enough here.
---
How many patches like this do you think we will be submitted?
Thanks!
const std::vector<raw_ptr<ProjectsPanelThreadItemView>>**[Early Review]**
Returning `std::vector<raw_ptr<T>>` by value causes unnecessary copies of the vector and all its `raw_ptr` elements (which have non-trivial copy constructors/destructors due to MiraclePtr ref-counting). This is especially costly in `projects_panel_recent_threads_view_unittest.cc` where `item_views_for_testing()` is called inside a loop, resulting in O(N^2) copies of the vector. Consider returning by const reference instead: `const std::vector<raw_ptr<ProjectsPanelThreadItemView>>& item_views_for_testing() const`.
Acknowledged
std::vector<raw_ptr<ProjectsPanelTabGroupsItemView>> item_views_for_testing()**[Early Review]**
Returning `std::vector<raw_ptr<T>>` by value causes unnecessary copies of the vector and all its `raw_ptr` elements. Since this just returns a member variable, consider returning by const reference instead: `const std::vector<raw_ptr<ProjectsPanelTabGroupsItemView>>& item_views_for_testing() const`.
Acknowledged
std::vector<raw_ptr<const contextual_search::FileInfo>> file_info_list;Seems unused. Maybe a preliminary CL removing this variable?
std::vector<raw_ptr<DemuxerStream>> ManifestDemuxer::GetAllStreams() {
DCHECK(media_task_runner_->RunsTasksInCurrentSequence());
// For each stream that ChunkDemuxer returns, we need to wrap it so that
// we can grab the timestamp. Chunk demuxer's streams live forever, so
// ours might as well also live forever, even if that leaks a small
// amount of memory.
// TODO(crbug.com/40057824): Rearchitect the demuxer stream ownership
// model to prevent long-lived streams from potentially leaking memory.
std::vector<raw_ptr<DemuxerStream>> streams;
for (DemuxerStream* chunk_demuxer_stream :
impl_->FilterDemuxerStreams(chunk_demuxer_->GetAllStreams())) {
auto it = streams_.find(chunk_demuxer_stream);
if (it != streams_.end()) {
streams.push_back(it->second.get());
continue;
}
auto wrapper = std::make_unique<ManifestDemuxerStream>(
chunk_demuxer_stream,
base::BindRepeating(&ManifestDemuxer::OnDemuxerStreamRead,
weak_factory_.GetWeakPtr()));
streams.push_back(wrapper.get());
streams_[chunk_demuxer_stream] = std::move(wrapper);
}
return streams;
}Formatting issue here. Could you please re-indent back to its original state?
decltype(demuxer->GetAllStreams()) streams;Can we use the real type here?
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
decltype(demuxer->GetAllStreams()) streams;Can we use the real type here?
The section "Pointers to unprotected memory (performance optimization)" in the file https://source.chromium.org/chromium/chromium/src/+/main:base/memory/raw_ptr.md states that `raw_ptr` is disallowed in `third_party/blink/renderer/core/`. So this change may be discarded
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
std::vector<raw_ptr<DemuxerStream>> ManifestDemuxer::GetAllStreams() {
DCHECK(media_task_runner_->RunsTasksInCurrentSequence());
// For each stream that ChunkDemuxer returns, we need to wrap it so that
// we can grab the timestamp. Chunk demuxer's streams live forever, so
// ours might as well also live forever, even if that leaks a small
// amount of memory.
// TODO(crbug.com/40057824): Rearchitect the demuxer stream ownership
// model to prevent long-lived streams from potentially leaking memory.
std::vector<raw_ptr<DemuxerStream>> streams;
for (DemuxerStream* chunk_demuxer_stream :
impl_->FilterDemuxerStreams(chunk_demuxer_->GetAllStreams())) {
auto it = streams_.find(chunk_demuxer_stream);
if (it != streams_.end()) {
streams.push_back(it->second.get());
continue;
}
auto wrapper = std::make_unique<ManifestDemuxerStream>(
chunk_demuxer_stream,
base::BindRepeating(&ManifestDemuxer::OnDemuxerStreamRead,
weak_factory_.GetWeakPtr()));
streams.push_back(wrapper.get());
streams_[chunk_demuxer_stream] = std::move(wrapper);
}
return streams;
}Formatting issue here. Could you please re-indent back to its original state?
Marked as resolved.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Commit-Queue | +1 |
std::vector<raw_ptr<const contextual_search::FileInfo>> file_info_list;Seems unused. Maybe a preliminary CL removing this variable?
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Arthur Sonzogni@arthurs...@chromium.org, do you think we should split this CL? If so, do you have any suggestions, like split by folder?
Me + @blun...@chromium.org would cover every files, except 1. So 3 reviewers would be enough here.
---
How many patches like this do you think we will be submitted?
by now this CL is the biggest one, but another remains to be worked and may increase its size is https://chromium-review.git.corp.google.com/c/chromium/src/+/7957993
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Arthur Sonzogni@arthurs...@chromium.org, do you think we should split this CL? If so, do you have any suggestions, like split by folder?
José Arturo BarreraMe + @blun...@chromium.org would cover every files, except 1. So 3 reviewers would be enough here.
---
How many patches like this do you think we will be submitted?
by now this CL is the biggest one, but another remains to be worked and may increase its size is https://chromium-review.git.corp.google.com/c/chromium/src/+/7957993
Done
decltype(demuxer->GetAllStreams()) streams;Can we use the real type here?
The section "Pointers to unprotected memory (performance optimization)" in the file https://source.chromium.org/chromium/chromium/src/+/main:base/memory/raw_ptr.md states that `raw_ptr` is disallowed in `third_party/blink/renderer/core/`. So this change may be discarded
definition modified to not include `raw_ptr`
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Thanks!
struct InitializeParams {If this is only parameters, we could add STACK_ALLOCATED and not have to use raw_ptr here. (The clang-plugin knows about STACK_ALLOCATED parameters)
// For each stream that ChunkDemuxer returns, we need to wrap it so that
// we can grab the timestamp. Chunk demuxer's streams live forever, so
// ours might as well also live forever, even if that leaks a small
// amount of memory.
// TODO(crbug.com/40057824): Rearchitect the demuxer stream ownership
// model to prevent long-lived streams from potentially leaking memory.Why was this comment updated? Can you please revert?
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
If this is only parameters, we could add STACK_ALLOCATED and not have to use raw_ptr here. (The clang-plugin knows about STACK_ALLOCATED parameters)
yes, it was really stack allocated. However, adding `STACK_ALLOCATED()` to the struct causes the compiler to throw errors, as the macro removes the aggregate status required for designated initializers. For such reason, the modifications on this file were reverted
// For each stream that ChunkDemuxer returns, we need to wrap it so that
// we can grab the timestamp. Chunk demuxer's streams live forever, so
// ours might as well also live forever, even if that leaks a small
// amount of memory.
// TODO(crbug.com/40057824): Rearchitect the demuxer stream ownership
// model to prevent long-lived streams from potentially leaking memory.Why was this comment updated? Can you please revert?
Appears it was updated due to the format tool. Reverting it.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Thanks!
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Code-Review | +1 |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Code-Review | +1 |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
[MiraclePtr] Rewrite templated container fields to raw_ptr
Automates the conversion of raw pointers within templated containers
(e.g., `std::vector`, `std::set`) to `raw_ptr` via the
`rewrite_templated_container_fields` tool, alongside necessary
manual build fixes.
This advances MiraclePtr's expansion to containers and preempts an
upcoming clang-plugin update that will strictly ban these un-rewritten
instances.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
**[Early Review]** This is an automated early review generated by an LLM. It is intended to help you catch obvious issues early and **potentially save a round of code review**.
If you find any suggestion irrelevant, please feel free to *ignore* or *close* it.
_I am going to take a look immediately._
Please see suggestions below.
std::erase_if(all_streams, [](raw_ptr<DemuxerStream> stream) {**[Early Review]**
Lambda parameters should use raw pointers (e.g., `DemuxerStream*`) instead of `raw_ptr<T>`. Passing `raw_ptr` by value incurs unnecessary ref-counting overhead under BackupRefPtr.
std::erase_if(all_streams, [](raw_ptr<DemuxerStream> stream) {**[Early Review]**
Lambda parameters should use raw pointers (e.g., `DemuxerStream*`) instead of `raw_ptr<T>`. Passing `raw_ptr` by value incurs unnecessary ref-counting overhead under BackupRefPtr.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Code-Review | +1 |
std::erase_if(all_streams, [](raw_ptr<DemuxerStream> stream) {**[Early Review]**
Lambda parameters should use raw pointers (e.g., `DemuxerStream*`) instead of `raw_ptr<T>`. Passing `raw_ptr` by value incurs unnecessary ref-counting overhead under BackupRefPtr.
Acknowledged
std::erase_if(all_streams, [](raw_ptr<DemuxerStream> stream) {**[Early Review]**
Lambda parameters should use raw pointers (e.g., `DemuxerStream*`) instead of `raw_ptr<T>`. Passing `raw_ptr` by value incurs unnecessary ref-counting overhead under BackupRefPtr.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |