Add memory dump providers for LocalStorageSqlite and SessionStorageSqlite [chromium/src : main]

3 views
Skip to first unread message

Xiaohan Zhao (Gerrit)

unread,
Apr 2, 2026, 7:36:21 PMApr 2
to Steve Becker, Rahul Singh, AyeAye, Chromium LUCI CQ, Chromium Metrics Reviews, chromium...@chromium.org, tracing...@chromium.org, wfh+...@chromium.org, spang...@chromium.org, asvitkine...@chromium.org, dmurph+watching...@chromium.org, dmurph+watch...@chromium.org, edgesto...@microsoft.com, storage...@chromium.org
Attention needed from Rahul Singh and Steve Becker

Xiaohan Zhao added 1 comment

Patchset-level comments
File-level comment, Patchset 3 (Latest):
Xiaohan Zhao . resolved

Hi Steve, PTAL when you have a chance, thanks!

Open in Gerrit

Related details

Attention is currently required from:
  • Rahul Singh
  • Steve Becker
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: I1e37f1734e99eb3431932bd0ad397a9be6e8827e
Gerrit-Change-Number: 7720001
Gerrit-PatchSet: 3
Gerrit-Owner: Xiaohan Zhao <xiaoh...@microsoft.com>
Gerrit-Reviewer: Rahul Singh <rah...@microsoft.com>
Gerrit-Reviewer: Steve Becker <ste...@microsoft.com>
Gerrit-Reviewer: Xiaohan Zhao <xiaoh...@microsoft.com>
Gerrit-CC: Chromium Metrics Reviews <chromium-met...@google.com>
Gerrit-Attention: Rahul Singh <rah...@microsoft.com>
Gerrit-Attention: Steve Becker <ste...@microsoft.com>
Gerrit-Comment-Date: Thu, 02 Apr 2026 23:36:13 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Steve Becker (Gerrit)

unread,
Apr 6, 2026, 7:53:20 PMApr 6
to Xiaohan Zhao, Rahul Singh, AyeAye, Chromium LUCI CQ, Chromium Metrics Reviews, chromium...@chromium.org, tracing...@chromium.org, wfh+...@chromium.org, spang...@chromium.org, asvitkine...@chromium.org, dmurph+watching...@chromium.org, dmurph+watch...@chromium.org, edgesto...@microsoft.com, storage...@chromium.org
Attention needed from Rahul Singh and Xiaohan Zhao

Steve Becker added 7 comments

Patchset-level comments
Steve Becker . resolved

Thanks for adding this!

File base/trace_event/memory_infra_background_allowlist.cc
Line 348, Patchset 3 (Latest): "site_storage/sessionstorage/0x?/sqlite",
Steve Becker . unresolved

Not your change, but why is session storage missing an entry for leveldb?

File components/services/storage/dom_storage/local_storage_impl.cc
Line 389, Patchset 3 (Latest): const bool uses_sqlite =
base::FeatureList::IsEnabled(kDomStorageSqlite) ||
(in_memory_ && base::FeatureList::IsEnabled(kDomStorageSqliteInMemory));
Steve Becker . unresolved

Let's avoid duplicating this check, which will evolve over time. Instead, please re-use the `ShouldUseSqliteBackend()` helper function from dom_storage_database.cc. As part of this, you'll need to declare the function in the header while moving the function definition out of the anonymous namepsace.

Line 392, Patchset 3 (Latest): auto* db_mad = pmd->CreateAllocatorDump(
context_name + (uses_sqlite ? "/sqlite" : "/leveldb"));
// Specifies that the current context is responsible for keeping memory alive.
int kImportance = 2;
pmd->AddOwnershipEdge(db_mad->guid(), global_dump->guid(), kImportance);
Steve Becker . unresolved

Not your change, but I don't understand how this allocator dump links up to anything. It looks like LevelDB creates dumps with the name "leveldatabase/db_<ptr>". See DBTracker::MemoryDumpProvider::DumpAllDatabases().

As a sanity check, have you tried using chrome://tracing with the memory-infra category to compare the memory dumps for LevelDB and SQLite?

https://source.chromium.org/chromium/chromium/src/+/main:docs/memory-infra/README.md

File components/services/storage/dom_storage/sqlite/local_storage_sqlite.cc
Line 117, Patchset 3 (Latest): CHECK(!meta_table_);
Steve Becker . unresolved

nit: let's add a CHECK(!memory_dump_id_) to make sure we're not overwriting the dump id.

Line 133, Patchset 3 (Latest): this, "DOMStorageBackingStore",
Steve Becker . unresolved

Should we use separate names for local storage and session storage? Before the recent refactoring, local storage and session storage used the same database code.

Line 442, Patchset 3 (Latest): std::string dump_name = base::StringPrintf("sqlite/db_0x%" PRIXPTR,
Steve Becker . unresolved

Since we're creating this in feature code, should we add a more specific name? Following the conventions in local_storage_impl.cc, maybe something like "site_storage/localstorage/sqlite/db_0x%"?

Open in Gerrit

Related details

Attention is currently required from:
  • Rahul Singh
  • Xiaohan Zhao
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: I1e37f1734e99eb3431932bd0ad397a9be6e8827e
    Gerrit-Change-Number: 7720001
    Gerrit-PatchSet: 3
    Gerrit-Owner: Xiaohan Zhao <xiaoh...@microsoft.com>
    Gerrit-Reviewer: Rahul Singh <rah...@microsoft.com>
    Gerrit-Reviewer: Steve Becker <ste...@microsoft.com>
    Gerrit-Reviewer: Xiaohan Zhao <xiaoh...@microsoft.com>
    Gerrit-CC: Chromium Metrics Reviews <chromium-met...@google.com>
    Gerrit-Attention: Rahul Singh <rah...@microsoft.com>
    Gerrit-Attention: Xiaohan Zhao <xiaoh...@microsoft.com>
    Gerrit-Comment-Date: Mon, 06 Apr 2026 23:53:11 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Xiaohan Zhao (Gerrit)

    unread,
    Apr 16, 2026, 2:04:41 PM (10 days ago) Apr 16
    to Steve Becker, Rahul Singh, android-bu...@system.gserviceaccount.com, Chromium LUCI CQ, Chromium Metrics Reviews, chromium...@chromium.org, tracing...@chromium.org, wfh+...@chromium.org, spang...@chromium.org, asvitkine...@chromium.org, dmurph+watching...@chromium.org, dmurph+watch...@chromium.org, edgesto...@microsoft.com, storage...@chromium.org
    Attention needed from Rahul Singh and Steve Becker

    Xiaohan Zhao added 6 comments

    File base/trace_event/memory_infra_background_allowlist.cc
    Line 348, Patchset 3: "site_storage/sessionstorage/0x?/sqlite",
    Steve Becker . resolved

    Not your change, but why is session storage missing an entry for leveldb?

    Xiaohan Zhao

    Good catch. I'm not sure why it was missing either, but I've added the leveldb entry for session storage for consistency.

    File components/services/storage/dom_storage/local_storage_impl.cc
    Line 389, Patchset 3: const bool uses_sqlite =

    base::FeatureList::IsEnabled(kDomStorageSqlite) ||
    (in_memory_ && base::FeatureList::IsEnabled(kDomStorageSqliteInMemory));
    Steve Becker . resolved

    Let's avoid duplicating this check, which will evolve over time. Instead, please re-use the `ShouldUseSqliteBackend()` helper function from dom_storage_database.cc. As part of this, you'll need to declare the function in the header while moving the function definition out of the anonymous namepsace.

    Xiaohan Zhao

    Done

    Line 392, Patchset 3: auto* db_mad = pmd->CreateAllocatorDump(

    context_name + (uses_sqlite ? "/sqlite" : "/leveldb"));
    // Specifies that the current context is responsible for keeping memory alive.
    int kImportance = 2;
    pmd->AddOwnershipEdge(db_mad->guid(), global_dump->guid(), kImportance);
    Steve Becker . resolved

    Not your change, but I don't understand how this allocator dump links up to anything. It looks like LevelDB creates dumps with the name "leveldatabase/db_<ptr>". See DBTracker::MemoryDumpProvider::DumpAllDatabases().

    As a sanity check, have you tried using chrome://tracing with the memory-infra category to compare the memory dumps for LevelDB and SQLite?

    https://source.chromium.org/chromium/chromium/src/+/main:docs/memory-infra/README.md

    Xiaohan Zhao

    Done

    File components/services/storage/dom_storage/sqlite/local_storage_sqlite.cc
    Line 117, Patchset 3: CHECK(!meta_table_);
    Steve Becker . resolved

    nit: let's add a CHECK(!memory_dump_id_) to make sure we're not overwriting the dump id.

    Xiaohan Zhao

    Done

    Line 133, Patchset 3: this, "DOMStorageBackingStore",
    Steve Becker . resolved

    Should we use separate names for local storage and session storage? Before the recent refactoring, local storage and session storage used the same database code.

    Xiaohan Zhao

    Done

    Line 442, Patchset 3: std::string dump_name = base::StringPrintf("sqlite/db_0x%" PRIXPTR,
    Steve Becker . resolved

    Since we're creating this in feature code, should we add a more specific name? Following the conventions in local_storage_impl.cc, maybe something like "site_storage/localstorage/sqlite/db_0x%"?

    Xiaohan Zhao

    Done

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Rahul Singh
    • Steve Becker
    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: I1e37f1734e99eb3431932bd0ad397a9be6e8827e
      Gerrit-Change-Number: 7720001
      Gerrit-PatchSet: 5
      Gerrit-Owner: Xiaohan Zhao <xiaoh...@microsoft.com>
      Gerrit-Reviewer: Rahul Singh <rah...@microsoft.com>
      Gerrit-Reviewer: Steve Becker <ste...@microsoft.com>
      Gerrit-Reviewer: Xiaohan Zhao <xiaoh...@microsoft.com>
      Gerrit-CC: Chromium Metrics Reviews <chromium-met...@google.com>
      Gerrit-Attention: Rahul Singh <rah...@microsoft.com>
      Gerrit-Attention: Steve Becker <ste...@microsoft.com>
      Gerrit-Comment-Date: Thu, 16 Apr 2026 18:04:33 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      Comment-In-Reply-To: Steve Becker <ste...@microsoft.com>
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy
      Reply all
      Reply to author
      Forward
      0 new messages