diff --git a/data/contributions/8584057.md b/data/contributions/8584057.md new file mode 100644 index 000000000..35f8fb7e9 --- /dev/null +++ b/data/contributions/8584057.md @@ -0,0 +1,60 @@ +--- +title: "[blink] Use Blink containers in LayerTreeView" +date: 2026-10-15 # Gerrit CL upload date +author: Indigochi1d # github.com/Indigochi1d +contribution_url: https://crrev.com/c/8584057 +module: blink +kind: refactor +keywords: ["LayerTreeView", "presentation_callbacks_", "WTF Deque", "WTF Vector", "Blink style guide", "compositing"] +status: in review # Change to merged or abandoned after the Gerrit result is confirmed +# resolvedDate: YYYY-MM-DD # Add only when the exact Gerrit result date is verified +# externalLinks: +# - title: "WPT PR #12345" +# url: https://github.com/web-platform-tests/wpt/pull/12345 +# - title: "WPT PR #12345" +# url: https://github.com/web-platform-tests/wpt/pull/12345 +--- + +Blink `platform/widget/compositing`의 `LayerTreeView`가 프레임별 콜백 큐에 쓰던 `base::circular_deque`와 `std::vector`를 Blink 컨테이너인 `Deque`와 `Vector`로 바꾼 리팩터링입니다. + +## 문제 설명 + +- `LayerTreeView`는 Blink `platform/` 디렉터리에 있지만, frame token별 콜백을 쌓아 두는 `prcore_animation_error_code_callbacks_`(Apple 전용)가 `base::circular_deque>>`를 쓰고 있었습니다. +- Blink 스타일 가이드는 `platform/` 코드에서 STL이나 base 타입보다 Blink 타입을 쓰도록 권장합니다. +- 이 지적은 FrameToken 동작을 frame_index에 맞춘 CL(https://crrev.com/c/6892099)을 AI 리뷰어가 검토하면서 나왔고, 별도 이슈(crbug.com/441562389)로 등록되었습니다. + +## 해결 내용 + +1. `layer_tree_view.h`에서 `base/containers/circular_deque.h` include를 지우고 `wtf/deque.h`와 `wtf/vector.h`를 추가했습니다. +2. `presentation_callbacks_`와 `core_animation_error_code_callbacks_`의 타입을 `Deque>>`로 바꿨습니다. +3. 두 큐를 공통으로 다루는 `AddCallback()` 템플릿의 매개변수 타입과 내부 `new_callbacks` 타입도 맞춰 바꿨습니다. +4. 이슈 범위에 맞춰 컨테이너 타입만 바꾸고, `DidPresentCompositorFrame()`의 콜백 실행 루프 같은 로직은 건드리지 않았습니다. + +```cpp +// Before +base::circular_deque>>> + presentation_callbacks_; + +// After +Deque>>> + presentation_callbacks_; +``` + +## 테스트 방법 + +1. 동작 변화가 없는 타입 교체라서 새 테스트는 추가하지 않았습니다. +2. CQ dry run으로 컴파일(특히 Mac의 `IS_APPLE` 경로)과 기존 `LayerTreeView` 테스트를 확인합니다. +3. 업로드 전에 `git cl presubmit --upload`를 통과했습니다. +_tools도 같이 업데이트해야 presubmit이 깨지지 않습니다 (`CheckInclusiveLanguage()` 인자 불일치 오류를 겪었습니다). + +## 참고 자료 + +- [CL 8584057](https://crrev.com/c/8584057) +- [crbug.com/441562389](https://crbug.com/441562389) +- [원본 CL 6892099: Align FrameToken behavior with frame_index](https://crrev.com/c/6892099) +- [layer_tree_view.h](https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/platform/widget/compositing/layer_tree_view.h) +- [Blink C++ style guide](https://chromium.googlesource.com/chromium/src/+/main/styleguide/c++/blink-c++.md)