← All issues

Introduce SharedTimebase and stop sending time updates every 100ms

1feeb18

WebKit의 multi-process 모델에서 미디어 디코딩은 GPU process가, JS 실행은 WebContent process가 각각 담당합니다. video.currentTime 조회는 IPC round-trip 없이 동기적으로 응답해야 합니다. 기존에는 GPU가 MediaTimeUpdateData anchor를 초당 약 4회 전송했고, TimeProgressEstimator가 이를 캐싱하여 보간하는 방식이었습니다. 새로 도입된 SharedTimebase는 소규모 SharedMemory 영역을 두 process에 매핑합니다. GPU 측은 writer를, WebContent 측은 SharedTimebaseReader를 각각 보유하며, 읽기는 SequenceLocked<T>(seqlock)를 통해 lock-free로 이루어집니다.

Source/WebCore/platform/SharedTimebase.h (new)

+struct Snapshot {
+ MediaTime currentTime;
+ double playbackRate;
+ MonotonicTime hostTime;
+};
+class SharedTimebase : public RefCounted<SharedTimebase> { ... };

Source/WebKit/WebProcess/GPU/media/AudioVideoRendererRemote.cpp

- TimeProgressEstimator m_timeEstimator;
+ std::unique_ptr<SharedTimebaseReader> m_sharedTimebaseReader;
+ std::optional<MediaTime> m_stallCap;

동일한 commit에서, AVFoundation이 rate를 0→nonzero로 잘못 보고하는 문제도 함께 처리되었습니다. 세분화된 time observer를 source 단에 적용하여 이를 마스킹했습니다. 또한 stall cap은 삭제된 TimeProgressEstimator 내부 클래스에서 m_lock 하의 AudioVideoRendererRemote 자체로 이동되었습니다.

활성 media element마다 발생하던 지속적인 IPC noise가 제거됩니다. 동시에 WebContent process가 IPC message validation 없이 직접 읽는 새로운 cross-process shared-memory 인터페이스가 도입되었으며, 이는 성능 향상에 더해 신뢰 경계에 의미 있는 변화를 가져옵니다.

🔒

New cross-process shared-memory path with lock-free reads and conditional stall-cap logic — several edge cases across the trust boundary are worth security investigation.

더 확인하려면 구독해 주세요