← All reports

[Site Isolation] Coalesce frame geometry updates into a single page-level message

Component: WebKit Site Isolation | f4bfa28

LayoutTests/http/tests/site-isolation/do-not-rebroadcast-unchanged-frame-geometry.html

+const countSentGeometryFor = action => countSentFor(() => internals.sentFrameGeometryCount(), action);
+const countSentViewportInfoFor = action => countSentFor(() => internals.sentFrameViewportInfoCount(), action);
...
+ assert_equals(await countSentGeometryFor(() => window.scrollTo(0, 350)), 1,
+ "a scroll that moves the edge of the viewport across the cross-site frame must send the frame geometry");
...
+ assert_equals(await countSentViewportInfoFor(() => {
+ window.scrollTo(0, 1200);
+ window.scrollTo(0, 1300);
+ window.scrollTo(0, 1400);
+ }), 1, "several scrolls in one task must send the viewport info once");

Site isolation 환경에서 각 WebContent process는 자신이 호스팅하지 않는 frame을 RemoteFrame이라는 대리 객체로 갖고 있습니다. 이 frame들의 위치, 크기, visible rect는 layout, IntersectionObserver, throttling 처리에 필요합니다. 한편 local frame의 geometry는 해당 frame을 담당하는 process가 소유하며, 이 값을 UIProcess에 보고합니다. UIProcess는 frame ID를 WebFrameProxy 객체에 매핑하는 신뢰된 broker입니다. 보고받은 geometry는 UIProcess를 거쳐 같은 page의 다른 process들로 중계됩니다.

기존에는 frame마다 broadcastFrameTreeSyncData geometry IPC가 전송되었습니다. 이번 commit에서 이 IPC가 page 단위의 단일 메시지인 WebPageProxy::HandleFrameGeometryUpdates로 변경되었습니다. 전송은 rendering update 시점에 WebPage::broadcastFrameGeometryUpdatesIfNeeded가 담당합니다. 먼저 UIProcess가 geometry를 각 WebFrameProxy에 저장한 뒤 다른 process로 전달하고, 수신 측은 WebPage::frameGeometryChangedInAnotherProcess에서 batch를 적용합니다. 중계 필터링 로직도 송신 측에서 UIProcess로 옮겨졌습니다. viewport 안에 frame이 없는 process에는 main frame scroll 업데이트를 보내지 않는 로직, 그리고 remote 하위 frame이 없는 frame을 건너뛰는 로직이 여기에 해당합니다.

이번 변경으로 IPC 전송량이 줄어듭니다. 동시에 UIProcess가 모든 frame의 최신 geometry를 보유하게 되는데, 이후 예정된 최적화가 이 정보를 필요로 합니다. 결과적으로 어떤 process가 어떤 frame geometry를 볼지 결정하는 policy 지점은 송신 측 WebProcess가 아니라 UIProcess가 됩니다.