Closed Bug 1668506 Opened 4 years ago Closed 4 years ago

Use PBackground instead of PContent for syncing SessionStorage to reduce main thread parent process usage

Categories

(Core :: Storage: localStorage & sessionStorage, enhancement)

enhancement

Tracking

()

RESOLVED DUPLICATE of bug 1654080

People

(Reporter: tt, Assigned: tt)

References

Details

Attachments

(1 obsolete file)

No description provided.

This patch does:

  • Move IPC from PContent to PBackground (SessionStorageManager{Child, Parent}).
  • Change SessionStorageManager and BrowsingContext's relationship.
  • Expose a getter function to get a manager for top context id on the parent.
  • Make SessionStorageManagerParent maintain (originAttrs, originKeys) table. So
    that we don't need to traverse whole originRecord table in manager while it's
    destoryed.

Follow-up work:

  • Maybe write SSCache in to disk if it's not loaded after a certain time rather
    than keeping it as in-memory objects until shuting down.

IPC

  • Before this patch:
    • Copy from parent while loading a document.
      • Mark cache entry on the parent process as loaded by the child id.
    • Update change on checkpoint.
    • Unmark cache entry on the parent process as unloaded for the child id while
      the parent actor is destorying.
  • After this patch:
    • Sync IPC load in the first SessionStorage operation.
      • Mark cache entry on the parent process as loaded by the parent actor
        pointer.
    • Update change on checkpoint
    • Unmark cache entry on the parent process as loaded by the parent actor
      pointer while parent actor is destorying.

SessionStorageManager's lifecycle on the parent process.

  • Before this patch:
    • Lives on the main thread
    • Create a cycle for SessionStorageManager and BrowsingContext pair (bc is
      also held by SessionStorageManager) while a content process shutdowns.
    • IIUC, destory during the parent process shutdowns (CC)
  • After this patch:
    • On the parent process, lives on the background thread.
    • Create SessionStorageManager that held by static global mananger list
      sManagers.
    • Destory on the background thread after receiving profile-before-change
      topic.
    • Note that there are SessionStorageManager that live on the main thread.
      However their sessionStorages are not used and thus are not registered on
      the manager list.
Status: NEW → ASSIGNED
Attachment #9179506 - Attachment is obsolete: true

Discussed with Jan and we decided to fold the remaining patches together to make it easier to be review.

Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Status: RESOLVED → REOPENED
Resolution: FIXED → ---

The patch has been merged to bug 1654080.

Status: REOPENED → RESOLVED
Closed: 4 years ago4 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: