Fix unsafe buffer usage in dawn_platform.cc [chromium/src : main]

0 views
Skip to first unread message

Dibyajyoti Pal (Gerrit)

unread,
Dec 23, 2025, 1:49:18 PM (3 days ago) Dec 23
to Aditi Page, Vincent Scheib, Chromium LUCI CQ, chromium...@chromium.org
Attention needed from Aditi Page

Dibyajyoti Pal voted and added 3 comments

Votes added by Dibyajyoti Pal

Code-Review+1

3 comments

Patchset-level comments
File-level comment, Patchset 4 (Latest):
Dibyajyoti Pal . resolved

Rubber stamp LGTM!

File gpu/command_buffer/service/dawn_platform.cc
Line 186, Patchset 4 (Latest): static_assert(
std::is_trivially_copyable_v<base::trace_event::TraceEventHandle>,
"TraceEventHandle must be trivially copyable to be used with "
"base::byte_span_from_ref");
Dibyajyoti Pal . unresolved

`std::is_trivial_v` already includes the check that the type is `trivially copyable` and has a `trivial default constructor`, so let's remove this extra `static_assert` on L186?

Line 194, Patchset 4 (Latest):
base::byte_span_from_ref(result)
.first(sizeof(handle))
.copy_from(base::byte_span_from_ref(handle));
Dibyajyoti Pal . unresolved

I'll leave it to the OWNERs to realize if this can be done in a simpler way.

I'm not sure why we can't just do the following based on [1]. It seems like this change is JUST removing the `UNSAFE_TODO` instead of actually digging deep into why `memcpy` is being used and whether that can be replaced, but I don't have the historical context to make this decision, so rubber stamping this!

```
result = handle.dummy;
```

[1] https://source.chromium.org/chromium/chromium/src/+/main:base/trace_event/trace_event_impl.h;l=41

Open in Gerrit

Related details

Attention is currently required from:
  • Aditi Page
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I088f482de803811843db564e2bce5279d596c7b9
Gerrit-Change-Number: 7270305
Gerrit-PatchSet: 4
Gerrit-Owner: Aditi Page <adit...@google.com>
Gerrit-Reviewer: Aditi Page <adit...@google.com>
Gerrit-Reviewer: Dibyajyoti Pal <diby...@chromium.org>
Gerrit-CC: Vincent Scheib <sch...@chromium.org>
Gerrit-Attention: Aditi Page <adit...@google.com>
Gerrit-Comment-Date: Tue, 23 Dec 2025 18:49:02 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
satisfied_requirement
unsatisfied_requirement
open
diffy

Aditi Page (Gerrit)

unread,
Dec 23, 2025, 2:31:38 PM (3 days ago) Dec 23
to Dibyajyoti Pal, Vincent Scheib, Chromium LUCI CQ, chromium...@chromium.org
Attention needed from Dibyajyoti Pal

Aditi Page added 2 comments

File gpu/command_buffer/service/dawn_platform.cc
Line 186, Patchset 4 (Latest): static_assert(
std::is_trivially_copyable_v<base::trace_event::TraceEventHandle>,
"TraceEventHandle must be trivially copyable to be used with "
"base::byte_span_from_ref");
Dibyajyoti Pal . unresolved

`std::is_trivial_v` already includes the check that the type is `trivially copyable` and has a `trivial default constructor`, so let's remove this extra `static_assert` on L186?

Aditi Page
Initially, I thought it is redundant as well. However, if we remove the following static assert, I see flakiness with the bots [likely trybot flakes (WebCodecs)]: 
std::is_trivial_v<base::trace_event::TraceEventHandle> &&
std::is_standard_layout_v<base::trace_event::TraceEventHandle>,
"TraceEventHandle must be a plain old data type for byte-wise copy.");

Since I saw similar flakiness in patchset 1 and 3, I decided to keep both asserts ensuring redundancy but a more thorough check. If there's another way to go about it, I can explore it further.

Line 194, Patchset 4 (Latest):
base::byte_span_from_ref(result)
.first(sizeof(handle))
.copy_from(base::byte_span_from_ref(handle));
Dibyajyoti Pal . unresolved

I'll leave it to the OWNERs to realize if this can be done in a simpler way.

I'm not sure why we can't just do the following based on [1]. It seems like this change is JUST removing the `UNSAFE_TODO` instead of actually digging deep into why `memcpy` is being used and whether that can be replaced, but I don't have the historical context to make this decision, so rubber stamping this!

```
result = handle.dummy;
```

[1] https://source.chromium.org/chromium/chromium/src/+/main:base/trace_event/trace_event_impl.h;l=41

Aditi Page

Since this work falls under the Spanification umbrella, my primary goal was to replace the raw memcpy and remove the UNSAFE_TODO by using modern, bounds-checked abstractions.

I definitely appreciate the suggestion to use result = handle.dummy; as it would be much simpler for the current definition in src/. Just out of curiosity: would a direct member assignment be robust enough across all build configurations?

Open in Gerrit

Related details

Attention is currently required from:
  • Dibyajyoti Pal
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I088f482de803811843db564e2bce5279d596c7b9
Gerrit-Change-Number: 7270305
Gerrit-PatchSet: 4
Gerrit-Owner: Aditi Page <adit...@google.com>
Gerrit-Reviewer: Aditi Page <adit...@google.com>
Gerrit-Reviewer: Dibyajyoti Pal <diby...@chromium.org>
Gerrit-CC: Vincent Scheib <sch...@chromium.org>
Gerrit-Attention: Dibyajyoti Pal <diby...@chromium.org>
Gerrit-Comment-Date: Tue, 23 Dec 2025 19:31:24 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Dibyajyoti Pal <diby...@chromium.org>
satisfied_requirement
unsatisfied_requirement
open
diffy

Dibyajyoti Pal (Gerrit)

unread,
Dec 23, 2025, 4:03:53 PM (3 days ago) Dec 23
to Aditi Page, Kai Ninomiya, Vincent Scheib, Chromium LUCI CQ, chromium...@chromium.org
Attention needed from Aditi Page and Kai Ninomiya

Dibyajyoti Pal added 2 comments

File gpu/command_buffer/service/dawn_platform.cc
Line 186, Patchset 4 (Latest): static_assert(
std::is_trivially_copyable_v<base::trace_event::TraceEventHandle>,
"TraceEventHandle must be trivially copyable to be used with "
"base::byte_span_from_ref");
Dibyajyoti Pal . unresolved

`std::is_trivial_v` already includes the check that the type is `trivially copyable` and has a `trivial default constructor`, so let's remove this extra `static_assert` on L186?

Aditi Page
Initially, I thought it is redundant as well. However, if we remove the following static assert, I see flakiness with the bots [likely trybot flakes (WebCodecs)]: 
std::is_trivial_v<base::trace_event::TraceEventHandle> &&
std::is_standard_layout_v<base::trace_event::TraceEventHandle>,
"TraceEventHandle must be a plain old data type for byte-wise copy.");

Since I saw similar flakiness in patchset 1 and 3, I decided to keep both asserts ensuring redundancy but a more thorough check. If there's another way to go about it, I can explore it further.

Dibyajyoti Pal

Hmmm interesting, are we sure that the failure was because of this code, or was that just a fluke that the test passed in this code?

Looking at the [flaky test logs](https://ci.chromium.org/ui/p/chromium/builders/try/win_optional_gpu_tests_rel/198733/test-results?view=legacy&q=ID%3A%3A%2F%2Fchrome%2Ftest%5C%3Atelemetry_gpu_integration_test%21flat%3A%3A%23gpu_tests.webcodecs_integration_test.WebCodecsIntegrationTest.WebCodecs_MixedSourceEncoding_av01.0.04M.08_prefer-software+VHash%3A9e8f0240a873a463), it seems like the failure is happening during the destruction of `~CanvasResourceProvider`, which in turn causes `surface_` to be [destructed](https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/platform/graphics/canvas_resource_provider.h;l=308;bpv=1;bpt=1?q=CanvasResourceProvider). The error is also a `MEMORY_ACCESS_VIOLATION`, which happens when a memory location cannot be accessed. Without more context, I don't know if that code is hit because of the changes, or if the flake is because of other reasons.

I'm not sure that adding the first `static_assert` here will fix that, unless there's some C++ magic happening that I'm unaware of, as the check is redundant. Both `static_asserts` will pass and fail for the same condition, and since `std::is_trivial_v` already checks for ` std::is_trivially_copyable_v` under the hood, so the redundancy might make it confusing [1].

[1] https://source.chromium.org/chromium/chromium/src/+/main:third_party/libc++/src/include/__type_traits/is_trivial.h;l=23;drc=0f12de6de16216019438777c04a2b202ffa35126

Line 194, Patchset 4 (Latest):
base::byte_span_from_ref(result)
.first(sizeof(handle))
.copy_from(base::byte_span_from_ref(handle));
Dibyajyoti Pal . unresolved

I'll leave it to the OWNERs to realize if this can be done in a simpler way.

I'm not sure why we can't just do the following based on [1]. It seems like this change is JUST removing the `UNSAFE_TODO` instead of actually digging deep into why `memcpy` is being used and whether that can be replaced, but I don't have the historical context to make this decision, so rubber stamping this!

```
result = handle.dummy;
```

[1] https://source.chromium.org/chromium/chromium/src/+/main:base/trace_event/trace_event_impl.h;l=41

Aditi Page

Since this work falls under the Spanification umbrella, my primary goal was to replace the raw memcpy and remove the UNSAFE_TODO by using modern, bounds-checked abstractions.

I definitely appreciate the suggestion to use result = handle.dummy; as it would be much simpler for the current definition in src/. Just out of curiosity: would a direct member assignment be robust enough across all build configurations?

Dibyajyoti Pal

Gotcha, if spanification is the goal then this might make sense.

To answer your second question, I don't see why this would not work, atleast from a coding perspective, since we're moving a value of type `uint64_t` into another. I don't have more context than that here, so would refer to a code owner here for more information.

Open in Gerrit

Related details

Attention is currently required from:
  • Aditi Page
  • Kai Ninomiya
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I088f482de803811843db564e2bce5279d596c7b9
Gerrit-Change-Number: 7270305
Gerrit-PatchSet: 4
Gerrit-Owner: Aditi Page <adit...@google.com>
Gerrit-Reviewer: Aditi Page <adit...@google.com>
Gerrit-Reviewer: Dibyajyoti Pal <diby...@chromium.org>
Gerrit-Reviewer: Kai Ninomiya <kai...@chromium.org>
Gerrit-CC: Vincent Scheib <sch...@chromium.org>
Gerrit-Attention: Kai Ninomiya <kai...@chromium.org>
Gerrit-Attention: Aditi Page <adit...@google.com>
Gerrit-Comment-Date: Tue, 23 Dec 2025 21:03:42 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Dibyajyoti Pal <diby...@chromium.org>
Comment-In-Reply-To: Aditi Page <adit...@google.com>
satisfied_requirement
unsatisfied_requirement
open
diffy

Kai Ninomiya (Gerrit)

unread,
Dec 23, 2025, 7:34:54 PM (3 days ago) Dec 23
to Aditi Page, Vincent Scheib, Chromium LUCI CQ, chromium...@chromium.org
Attention needed from Aditi Page

Kai Ninomiya voted and added 2 comments

Votes added by Kai Ninomiya

Code-Review+1

2 comments

File gpu/command_buffer/service/dawn_platform.cc
Line 186, Patchset 4 (Latest): static_assert(
std::is_trivially_copyable_v<base::trace_event::TraceEventHandle>,
"TraceEventHandle must be trivially copyable to be used with "
"base::byte_span_from_ref");
Dibyajyoti Pal . unresolved

`std::is_trivial_v` already includes the check that the type is `trivially copyable` and has a `trivial default constructor`, so let's remove this extra `static_assert` on L186?

Aditi Page
Initially, I thought it is redundant as well. However, if we remove the following static assert, I see flakiness with the bots [likely trybot flakes (WebCodecs)]: 
std::is_trivial_v<base::trace_event::TraceEventHandle> &&
std::is_standard_layout_v<base::trace_event::TraceEventHandle>,
"TraceEventHandle must be a plain old data type for byte-wise copy.");

Since I saw similar flakiness in patchset 1 and 3, I decided to keep both asserts ensuring redundancy but a more thorough check. If there's another way to go about it, I can explore it further.

Dibyajyoti Pal

Hmmm interesting, are we sure that the failure was because of this code, or was that just a fluke that the test passed in this code?

Looking at the [flaky test logs](https://ci.chromium.org/ui/p/chromium/builders/try/win_optional_gpu_tests_rel/198733/test-results?view=legacy&q=ID%3A%3A%2F%2Fchrome%2Ftest%5C%3Atelemetry_gpu_integration_test%21flat%3A%3A%23gpu_tests.webcodecs_integration_test.WebCodecsIntegrationTest.WebCodecs_MixedSourceEncoding_av01.0.04M.08_prefer-software+VHash%3A9e8f0240a873a463), it seems like the failure is happening during the destruction of `~CanvasResourceProvider`, which in turn causes `surface_` to be [destructed](https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/platform/graphics/canvas_resource_provider.h;l=308;bpv=1;bpt=1?q=CanvasResourceProvider). The error is also a `MEMORY_ACCESS_VIOLATION`, which happens when a memory location cannot be accessed. Without more context, I don't know if that code is hit because of the changes, or if the flake is because of other reasons.

I'm not sure that adding the first `static_assert` here will fix that, unless there's some C++ magic happening that I'm unaware of, as the check is redundant. Both `static_asserts` will pass and fail for the same condition, and since `std::is_trivial_v` already checks for ` std::is_trivially_copyable_v` under the hood, so the redundancy might make it confusing [1].

[1] https://source.chromium.org/chromium/chromium/src/+/main:third_party/libc++/src/include/__type_traits/is_trivial.h;l=23;drc=0f12de6de16216019438777c04a2b202ffa35126

Kai Ninomiya

Agree, I don't think a `static_assert` shouldn't change anything at runtime (unless there is undefined behavior).

Line 194, Patchset 4 (Latest):
base::byte_span_from_ref(result)
.first(sizeof(handle))
.copy_from(base::byte_span_from_ref(handle));
Dibyajyoti Pal . resolved

I'll leave it to the OWNERs to realize if this can be done in a simpler way.

I'm not sure why we can't just do the following based on [1]. It seems like this change is JUST removing the `UNSAFE_TODO` instead of actually digging deep into why `memcpy` is being used and whether that can be replaced, but I don't have the historical context to make this decision, so rubber stamping this!

```
result = handle.dummy;
```

[1] https://source.chromium.org/chromium/chromium/src/+/main:base/trace_event/trace_event_impl.h;l=41

Aditi Page

Since this work falls under the Spanification umbrella, my primary goal was to replace the raw memcpy and remove the UNSAFE_TODO by using modern, bounds-checked abstractions.

I definitely appreciate the suggestion to use result = handle.dummy; as it would be much simpler for the current definition in src/. Just out of curiosity: would a direct member assignment be robust enough across all build configurations?

Dibyajyoti Pal

Gotcha, if spanification is the goal then this might make sense.

To answer your second question, I don't see why this would not work, atleast from a coding perspective, since we're moving a value of type `uint64_t` into another. I don't have more context than that here, so would refer to a code owner here for more information.

Kai Ninomiya

TraceEventHandle was more nontrivial until recently:
https://chromium-review.googlesource.com/c/chromium/src/+/6163823/6/base/trace_event/trace_event_impl.h
and did this in order to serialize it into something non-Chromium libraries could represent. We copied the method from V8, Skia, and ANGLE: https://chromium-review.googlesource.com/c/chromium/src/+/1745494/comment/77dc7705_e7e5bcb1/

I'd love to simplify this, but that would need to be either done by or reviewed by that team. I have filed https://crbug.com/471224082. If the tracing team is in support of the idea, you might be interested to take it on - it will result in the removal of several `memcpy`s.

Open in Gerrit

Related details

Attention is currently required from:
  • Aditi Page
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement satisfiedCode-Owners
  • requirement satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I088f482de803811843db564e2bce5279d596c7b9
Gerrit-Change-Number: 7270305
Gerrit-PatchSet: 4
Gerrit-Owner: Aditi Page <adit...@google.com>
Gerrit-Reviewer: Aditi Page <adit...@google.com>
Gerrit-Reviewer: Dibyajyoti Pal <diby...@chromium.org>
Gerrit-Reviewer: Kai Ninomiya <kai...@chromium.org>
Gerrit-CC: Vincent Scheib <sch...@chromium.org>
Gerrit-Attention: Aditi Page <adit...@google.com>
Gerrit-Comment-Date: Wed, 24 Dec 2025 00:34:46 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
satisfied_requirement
unsatisfied_requirement
open
diffy

Aditi Page (Gerrit)

unread,
5:52 PM (5 hours ago) 5:52 PM
to Kai Ninomiya, Dibyajyoti Pal, Vincent Scheib, Chromium LUCI CQ, chromium...@chromium.org
Attention needed from Dibyajyoti Pal and Kai Ninomiya

Aditi Page added 1 comment

File gpu/command_buffer/service/dawn_platform.cc
Line 186, Patchset 4: static_assert(

std::is_trivially_copyable_v<base::trace_event::TraceEventHandle>,
"TraceEventHandle must be trivially copyable to be used with "
"base::byte_span_from_ref");
Dibyajyoti Pal . resolved

`std::is_trivial_v` already includes the check that the type is `trivially copyable` and has a `trivial default constructor`, so let's remove this extra `static_assert` on L186?

Aditi Page
Initially, I thought it is redundant as well. However, if we remove the following static assert, I see flakiness with the bots [likely trybot flakes (WebCodecs)]: 
std::is_trivial_v<base::trace_event::TraceEventHandle> &&
std::is_standard_layout_v<base::trace_event::TraceEventHandle>,
"TraceEventHandle must be a plain old data type for byte-wise copy.");

Since I saw similar flakiness in patchset 1 and 3, I decided to keep both asserts ensuring redundancy but a more thorough check. If there's another way to go about it, I can explore it further.

Dibyajyoti Pal

Hmmm interesting, are we sure that the failure was because of this code, or was that just a fluke that the test passed in this code?

Looking at the [flaky test logs](https://ci.chromium.org/ui/p/chromium/builders/try/win_optional_gpu_tests_rel/198733/test-results?view=legacy&q=ID%3A%3A%2F%2Fchrome%2Ftest%5C%3Atelemetry_gpu_integration_test%21flat%3A%3A%23gpu_tests.webcodecs_integration_test.WebCodecsIntegrationTest.WebCodecs_MixedSourceEncoding_av01.0.04M.08_prefer-software+VHash%3A9e8f0240a873a463), it seems like the failure is happening during the destruction of `~CanvasResourceProvider`, which in turn causes `surface_` to be [destructed](https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/platform/graphics/canvas_resource_provider.h;l=308;bpv=1;bpt=1?q=CanvasResourceProvider). The error is also a `MEMORY_ACCESS_VIOLATION`, which happens when a memory location cannot be accessed. Without more context, I don't know if that code is hit because of the changes, or if the flake is because of other reasons.

I'm not sure that adding the first `static_assert` here will fix that, unless there's some C++ magic happening that I'm unaware of, as the check is redundant. Both `static_asserts` will pass and fail for the same condition, and since `std::is_trivial_v` already checks for ` std::is_trivially_copyable_v` under the hood, so the redundancy might make it confusing [1].

[1] https://source.chromium.org/chromium/chromium/src/+/main:third_party/libc++/src/include/__type_traits/is_trivial.h;l=23;drc=0f12de6de16216019438777c04a2b202ffa35126

Kai Ninomiya

Agree, I don't think a `static_assert` shouldn't change anything at runtime (unless there is undefined behavior).

Aditi Page

Done

Open in Gerrit

Related details

Attention is currently required from:
  • Dibyajyoti Pal
  • Kai Ninomiya
Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement satisfiedCode-Owners
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: I088f482de803811843db564e2bce5279d596c7b9
    Gerrit-Change-Number: 7270305
    Gerrit-PatchSet: 4
    Gerrit-Owner: Aditi Page <adit...@google.com>
    Gerrit-Reviewer: Aditi Page <adit...@google.com>
    Gerrit-Reviewer: Dibyajyoti Pal <diby...@chromium.org>
    Gerrit-Reviewer: Kai Ninomiya <kai...@chromium.org>
    Gerrit-CC: Vincent Scheib <sch...@chromium.org>
    Gerrit-Attention: Dibyajyoti Pal <diby...@chromium.org>
    Gerrit-Attention: Kai Ninomiya <kai...@chromium.org>
    Gerrit-Comment-Date: Fri, 26 Dec 2025 22:52:24 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Dibyajyoti Pal <diby...@chromium.org>
    Comment-In-Reply-To: Kai Ninomiya <kai...@chromium.org>
    Comment-In-Reply-To: Aditi Page <adit...@google.com>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Aditi Page (Gerrit)

    unread,
    6:55 PM (4 hours ago) 6:55 PM
    to Kai Ninomiya, Dibyajyoti Pal, Vincent Scheib, Chromium LUCI CQ, chromium...@chromium.org
    Attention needed from Dibyajyoti Pal and Kai Ninomiya

    Aditi Page added 1 comment

    File gpu/command_buffer/service/dawn_platform.cc
    Line 186, Patchset 4: static_assert(
    std::is_trivially_copyable_v<base::trace_event::TraceEventHandle>,
    "TraceEventHandle must be trivially copyable to be used with "
    "base::byte_span_from_ref");
    Dibyajyoti Pal . resolved

    `std::is_trivial_v` already includes the check that the type is `trivially copyable` and has a `trivial default constructor`, so let's remove this extra `static_assert` on L186?

    Aditi Page
    Initially, I thought it is redundant as well. However, if we remove the following static assert, I see flakiness with the bots [likely trybot flakes (WebCodecs)]: 
    std::is_trivial_v<base::trace_event::TraceEventHandle> &&
    std::is_standard_layout_v<base::trace_event::TraceEventHandle>,
    "TraceEventHandle must be a plain old data type for byte-wise copy.");

    Since I saw similar flakiness in patchset 1 and 3, I decided to keep both asserts ensuring redundancy but a more thorough check. If there's another way to go about it, I can explore it further.

    Dibyajyoti Pal

    Hmmm interesting, are we sure that the failure was because of this code, or was that just a fluke that the test passed in this code?

    Looking at the [flaky test logs](https://ci.chromium.org/ui/p/chromium/builders/try/win_optional_gpu_tests_rel/198733/test-results?view=legacy&q=ID%3A%3A%2F%2Fchrome%2Ftest%5C%3Atelemetry_gpu_integration_test%21flat%3A%3A%23gpu_tests.webcodecs_integration_test.WebCodecsIntegrationTest.WebCodecs_MixedSourceEncoding_av01.0.04M.08_prefer-software+VHash%3A9e8f0240a873a463), it seems like the failure is happening during the destruction of `~CanvasResourceProvider`, which in turn causes `surface_` to be [destructed](https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/platform/graphics/canvas_resource_provider.h;l=308;bpv=1;bpt=1?q=CanvasResourceProvider). The error is also a `MEMORY_ACCESS_VIOLATION`, which happens when a memory location cannot be accessed. Without more context, I don't know if that code is hit because of the changes, or if the flake is because of other reasons.

    I'm not sure that adding the first `static_assert` here will fix that, unless there's some C++ magic happening that I'm unaware of, as the check is redundant. Both `static_asserts` will pass and fail for the same condition, and since `std::is_trivial_v` already checks for ` std::is_trivially_copyable_v` under the hood, so the redundancy might make it confusing [1].

    [1] https://source.chromium.org/chromium/chromium/src/+/main:third_party/libc++/src/include/__type_traits/is_trivial.h;l=23;drc=0f12de6de16216019438777c04a2b202ffa35126

    Kai Ninomiya

    Agree, I don't think a `static_assert` shouldn't change anything at runtime (unless there is undefined behavior).

    Aditi Page

    Done

    Aditi Page

    I have removed the static assert on L186 due to its redundancy. I see that the tests failing in previous patchsets, though on different platforms, are reported/known flakes. after re-running the tests, they seem to pass and are definitely not related to this change. Thank you for looking at this.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Dibyajyoti Pal
    • Kai Ninomiya
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement satisfiedCode-Owners
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: I088f482de803811843db564e2bce5279d596c7b9
    Gerrit-Change-Number: 7270305
    Gerrit-PatchSet: 5
    Gerrit-Owner: Aditi Page <adit...@google.com>
    Gerrit-Reviewer: Aditi Page <adit...@google.com>
    Gerrit-Reviewer: Dibyajyoti Pal <diby...@chromium.org>
    Gerrit-Reviewer: Kai Ninomiya <kai...@chromium.org>
    Gerrit-CC: Vincent Scheib <sch...@chromium.org>
    Gerrit-Attention: Dibyajyoti Pal <diby...@chromium.org>
    Gerrit-Attention: Kai Ninomiya <kai...@chromium.org>
    Gerrit-Comment-Date: Fri, 26 Dec 2025 23:54:51 +0000
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Kai Ninomiya (Gerrit)

    unread,
    7:26 PM (4 hours ago) 7:26 PM
    to Aditi Page, Dibyajyoti Pal, Vincent Scheib, Chromium LUCI CQ, chromium...@chromium.org
    Attention needed from Aditi Page and Dibyajyoti Pal

    Kai Ninomiya voted Code-Review+1

    Code-Review+1
    Open in Gerrit

    Related details

    Attention is currently required from:
    • Aditi Page
    • Dibyajyoti Pal
    Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement satisfiedCode-Owners
      • requirement is not satisfiedCode-Review
      • requirement satisfiedReview-Enforcement
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: chromium/src
      Gerrit-Branch: main
      Gerrit-Change-Id: I088f482de803811843db564e2bce5279d596c7b9
      Gerrit-Change-Number: 7270305
      Gerrit-PatchSet: 5
      Gerrit-Owner: Aditi Page <adit...@google.com>
      Gerrit-Reviewer: Aditi Page <adit...@google.com>
      Gerrit-Reviewer: Dibyajyoti Pal <diby...@chromium.org>
      Gerrit-Reviewer: Kai Ninomiya <kai...@chromium.org>
      Gerrit-CC: Vincent Scheib <sch...@chromium.org>
      Gerrit-Attention: Dibyajyoti Pal <diby...@chromium.org>
      Gerrit-Attention: Aditi Page <adit...@google.com>
      Gerrit-Comment-Date: Sat, 27 Dec 2025 00:26:36 +0000
      Gerrit-HasComments: No
      Gerrit-Has-Labels: Yes
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy
      Reply all
      Reply to author
      Forward
      0 new messages