Introduce Inline Script Cache [chromium/src : main]

0 views
Skip to first unread message

Takashi Nakayama (Gerrit)

unread,
Mar 2, 2026, 6:34:01 AM (11 days ago) Mar 2
to Kouhei Ueno, Hiroshige Hayashizaki, Leszek Swirski, Rakina Zata Amni, Yoshisato Yanagisawa, Hiroki Nakagawa, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin, blink-...@chromium.org, gavinp...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org
Attention needed from Hiroshige Hayashizaki, Kouhei Ueno, Leszek Swirski and Rakina Zata Amni

New activity on the change

Open in Gerrit

Related details

Attention is currently required from:
  • Hiroshige Hayashizaki
  • Kouhei Ueno
  • Leszek Swirski
  • Rakina Zata Amni
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not 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: I8f54a88c25879d47ae374f26a3d207a2b6537d70
Gerrit-Change-Number: 7622052
Gerrit-PatchSet: 5
Gerrit-Owner: Takashi Nakayama <tn...@chromium.org>
Gerrit-Reviewer: Hiroshige Hayashizaki <hiro...@chromium.org>
Gerrit-Reviewer: Kouhei Ueno <kou...@chromium.org>
Gerrit-Reviewer: Leszek Swirski <les...@chromium.org>
Gerrit-Reviewer: Rakina Zata Amni <rak...@chromium.org>
Gerrit-Reviewer: Takashi Nakayama <tn...@chromium.org>
Gerrit-CC: Hiroki Nakagawa <nhi...@chromium.org>
Gerrit-CC: Nate Chapin <jap...@chromium.org>
Gerrit-CC: Yoshisato Yanagisawa <yyana...@chromium.org>
Gerrit-Attention: Hiroshige Hayashizaki <hiro...@chromium.org>
Gerrit-Attention: Kouhei Ueno <kou...@chromium.org>
Gerrit-Attention: Leszek Swirski <les...@chromium.org>
Gerrit-Attention: Rakina Zata Amni <rak...@chromium.org>
Gerrit-Comment-Date: Mon, 02 Mar 2026 11:33:29 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Hiroshige Hayashizaki (Gerrit)

unread,
Mar 3, 2026, 8:08:12 PM (9 days ago) Mar 3
to Takashi Nakayama, Kouhei Ueno, Leszek Swirski, Rakina Zata Amni, Yoshisato Yanagisawa, Hiroki Nakagawa, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin, blink-...@chromium.org, gavinp...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org
Attention needed from Kouhei Ueno, Leszek Swirski, Rakina Zata Amni and Takashi Nakayama

Hiroshige Hayashizaki added 6 comments

Patchset-level comments
File-level comment, Patchset 8 (Latest):
Hiroshige Hayashizaki . resolved

Basically looks good.

File third_party/blink/renderer/core/script/classic_pending_script.cc
Line 555, Patchset 8 (Latest): if (auto* cache_host = loader->GetCodeCacheHost(); cache_host) {
Hiroshige Hayashizaki . unresolved

nit: `if (auto* cache_host = loader->GetCodeCacheHost()) {`

Line 558, Patchset 8 (Latest): code_cache = cache_host->FetchInlineScriptCacheSync(
Hiroshige Hayashizaki . unresolved

Probably "empty `mojo_base::BigBuffer`" instead of "valid null"?
(assuming this means https://source.chromium.org/chromium/chromium/src/+/main:mojo/public/cpp/base/big_buffer.h;drc=c409e7c1320a2ab19e4820a19d1378bf0306ddcc;l=94)

---
Not a strong opinion, but I suspect we should return `std::nullopt` (in other words `cached_metadata_handler->SetSerializedCachedMetadata()` shouldn't be called).

Anyway the behavior is the same (its `cached_metadata_` should be nullptr anyway, because `CachedMetadata::CreateFromSerializedData()` returns nullptr for empty vector), but perhaps not relying the validation at `CreateFromSerializedData ` and directly distinguishing non-existing cache entry (`std::nullopt`) and existing but invalid empty cache entry (empty `BigBuffer`) is a little clearer.

File third_party/blink/renderer/platform/loader/fetch/script_cached_metadata_handler.h
Line 192, Patchset 8 (Latest): uint8_t source_hash_[kStringDigestSize] = {};
Hiroshige Hayashizaki . unresolved

Can this be `SecureStringDigest`?

File third_party/blink/renderer/platform/loader/fetch/script_cached_metadata_handler.cc
Line 252, Patchset 8 (Latest): DCHECK(!cached_metadata_);
Hiroshige Hayashizaki . unresolved
Line 308, Patchset 8 (Latest): return (cached_metadata_) ? cached_metadata_->SerializedData().size() : 0;
Hiroshige Hayashizaki . unresolved

nit: `(cached_metadata_)` -> `cached_metadata_`

Open in Gerrit

Related details

Attention is currently required from:
  • Kouhei Ueno
  • Leszek Swirski
  • Rakina Zata Amni
  • Takashi Nakayama
Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Owners
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • 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: I8f54a88c25879d47ae374f26a3d207a2b6537d70
    Gerrit-Change-Number: 7622052
    Gerrit-PatchSet: 8
    Gerrit-Owner: Takashi Nakayama <tn...@chromium.org>
    Gerrit-Reviewer: Hiroshige Hayashizaki <hiro...@chromium.org>
    Gerrit-Reviewer: Kouhei Ueno <kou...@chromium.org>
    Gerrit-Reviewer: Leszek Swirski <les...@chromium.org>
    Gerrit-Reviewer: Rakina Zata Amni <rak...@chromium.org>
    Gerrit-Reviewer: Takashi Nakayama <tn...@chromium.org>
    Gerrit-CC: Hiroki Nakagawa <nhi...@chromium.org>
    Gerrit-CC: Nate Chapin <jap...@chromium.org>
    Gerrit-CC: Yoshisato Yanagisawa <yyana...@chromium.org>
    Gerrit-Attention: Takashi Nakayama <tn...@chromium.org>
    Gerrit-Attention: Kouhei Ueno <kou...@chromium.org>
    Gerrit-Attention: Leszek Swirski <les...@chromium.org>
    Gerrit-Attention: Rakina Zata Amni <rak...@chromium.org>
    Gerrit-Comment-Date: Wed, 04 Mar 2026 01:08:04 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Takashi Nakayama (Gerrit)

    unread,
    4:15 AM (17 hours ago) 4:15 AM
    to Kouhei Ueno, Hiroshige Hayashizaki, Leszek Swirski, Rakina Zata Amni, Yoshisato Yanagisawa, Hiroki Nakagawa, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin, blink-...@chromium.org, gavinp...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org
    Attention needed from Hiroshige Hayashizaki

    Takashi Nakayama added 5 comments

    File third_party/blink/renderer/core/script/classic_pending_script.cc
    Line 555, Patchset 8: if (auto* cache_host = loader->GetCodeCacheHost(); cache_host) {
    Hiroshige Hayashizaki . resolved

    nit: `if (auto* cache_host = loader->GetCodeCacheHost()) {`

    Takashi Nakayama

    Done

    Line 558, Patchset 8: code_cache = cache_host->FetchInlineScriptCacheSync(
    Hiroshige Hayashizaki . unresolved

    Probably "empty `mojo_base::BigBuffer`" instead of "valid null"?
    (assuming this means https://source.chromium.org/chromium/chromium/src/+/main:mojo/public/cpp/base/big_buffer.h;drc=c409e7c1320a2ab19e4820a19d1378bf0306ddcc;l=94)

    ---
    Not a strong opinion, but I suspect we should return `std::nullopt` (in other words `cached_metadata_handler->SetSerializedCachedMetadata()` shouldn't be called).

    Anyway the behavior is the same (its `cached_metadata_` should be nullptr anyway, because `CachedMetadata::CreateFromSerializedData()` returns nullptr for empty vector), but perhaps not relying the validation at `CreateFromSerializedData ` and directly distinguishing non-existing cache entry (`std::nullopt`) and existing but invalid empty cache entry (empty `BigBuffer`) is a little clearer.

    Takashi Nakayama

    Done; Changed `FetchInlineScriptCacheSync()` to return `std::nullopt` when cache fetch timed out in the parent CL while keeping an empty `BigBuffer` is still passed to `SetSerializedCachedMetadata()` to align with other caches. PTAL

    File third_party/blink/renderer/platform/loader/fetch/script_cached_metadata_handler.h
    Line 192, Patchset 8: uint8_t source_hash_[kStringDigestSize] = {};
    Hiroshige Hayashizaki . resolved

    Can this be `SecureStringDigest`?

    Takashi Nakayama

    Done

    File third_party/blink/renderer/platform/loader/fetch/script_cached_metadata_handler.cc
    Line 252, Patchset 8: DCHECK(!cached_metadata_);
    Hiroshige Hayashizaki . resolved
    Takashi Nakayama

    Done

    Line 308, Patchset 8: return (cached_metadata_) ? cached_metadata_->SerializedData().size() : 0;
    Hiroshige Hayashizaki . resolved

    nit: `(cached_metadata_)` -> `cached_metadata_`

    Takashi Nakayama

    Done

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Hiroshige Hayashizaki
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Owners
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • 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: I8f54a88c25879d47ae374f26a3d207a2b6537d70
    Gerrit-Change-Number: 7622052
    Gerrit-PatchSet: 10
    Gerrit-Owner: Takashi Nakayama <tn...@chromium.org>
    Gerrit-Reviewer: Hiroshige Hayashizaki <hiro...@chromium.org>
    Gerrit-Reviewer: Kouhei Ueno <kou...@chromium.org>
    Gerrit-Reviewer: Leszek Swirski <les...@chromium.org>
    Gerrit-Reviewer: Rakina Zata Amni <rak...@chromium.org>
    Gerrit-Reviewer: Takashi Nakayama <tn...@chromium.org>
    Gerrit-CC: Hiroki Nakagawa <nhi...@chromium.org>
    Gerrit-CC: Nate Chapin <jap...@chromium.org>
    Gerrit-CC: Yoshisato Yanagisawa <yyana...@chromium.org>
    Gerrit-Attention: Hiroshige Hayashizaki <hiro...@chromium.org>
    Gerrit-Comment-Date: Thu, 12 Mar 2026 08:15:01 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Hiroshige Hayashizaki <hiro...@chromium.org>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy
    Reply all
    Reply to author
    Forward
    0 new messages