New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 676078 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Dec 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 2
Type: Bug

Blocking:
issue 586194



Sign in to add a comment

LevelDBWrapper and LevelDBObserver for LocalStorage need to share the same MessagePipe

Project Member Reported by mek@chromium.org, Dec 20 2016

Issue description

The mojo version of LocalStorage relies heavily on relative ordering of messages it receives via the LevelDBObserver interface and messages it receives as replies to messages send on the LevelDBWrapper interface.

Currently however these two connections are completely separate, made over independent pipes. Two possible solutions I can see:
1) Change StoragePartitionService.OpenLocalStorage to pass both interfaces as associated interfaces. That way both will share the pipe with StoragePartitionService, and the expected ordering works outfine, or

2) Change how observers are added, by adding an AddObserver(associated LevelDBObserver observer); method to LevelDBWrapper (and removing the observer from the OpenLocalStorage call), or

3) Somehow rework the logic in LocalStorageCachedArea to not rely on relative ordering of observed events and async replies. Sort of possible: every async reply already sort of has a matching observable event, and we have the "source" blob we could extend with more random/sequential request IDs to try to match method calls with observed events. But tricky to get right, and needing request ids in the first place is something mojo is supposed to help us get rid of, so adding more of them feels going the wrong way.

Not sure what the best approach is going to be, but 1 and 2 aren't too different in practice. 

Somewhat related, the GetAllCompleted with its randomly generated request id that than is matched against feels really icky to me... I wonder if a neater solution would be to get rid of the "source" for GetAll and instead pass an (associated) interface whose sole purpose is to be notified when GetAll is completed. That would at least get rid of the random request ID masqueraded as a string. But well, that's a whole different story, unrelated to this bug.
 
Project Member

Comment 1 by bugdroid1@chromium.org, Dec 21 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/e80c2a1472bf8e7118e454bb8383d6046620007a

commit e80c2a1472bf8e7118e454bb8383d6046620007a
Author: mek <mek@chromium.org>
Date: Wed Dec 21 06:13:28 2016

Make LevelDBObserver an associated interface to LevelDBWrapper.

LocalStorageCachedArea relies on an accurate interleaving of observations and
replies to LevelDBWrapper method calls, so make observers associated interfaces
for LevelDBWrapper.

BUG= 676078 
BUG= 586194 

Review-Url: https://codereview.chromium.org/2596603002
Cr-Commit-Position: refs/heads/master@{#440039}

[modify] https://crrev.com/e80c2a1472bf8e7118e454bb8383d6046620007a/content/browser/dom_storage/dom_storage_context_wrapper.cc
[modify] https://crrev.com/e80c2a1472bf8e7118e454bb8383d6046620007a/content/browser/dom_storage/dom_storage_context_wrapper.h
[modify] https://crrev.com/e80c2a1472bf8e7118e454bb8383d6046620007a/content/browser/leveldb_wrapper_impl.cc
[modify] https://crrev.com/e80c2a1472bf8e7118e454bb8383d6046620007a/content/browser/leveldb_wrapper_impl.h
[modify] https://crrev.com/e80c2a1472bf8e7118e454bb8383d6046620007a/content/browser/storage_partition_impl.cc
[modify] https://crrev.com/e80c2a1472bf8e7118e454bb8383d6046620007a/content/browser/storage_partition_impl.h
[modify] https://crrev.com/e80c2a1472bf8e7118e454bb8383d6046620007a/content/common/leveldb_wrapper.mojom
[modify] https://crrev.com/e80c2a1472bf8e7118e454bb8383d6046620007a/content/common/storage_partition_service.mojom
[modify] https://crrev.com/e80c2a1472bf8e7118e454bb8383d6046620007a/content/renderer/dom_storage/local_storage_cached_area.cc
[modify] https://crrev.com/e80c2a1472bf8e7118e454bb8383d6046620007a/content/renderer/dom_storage/local_storage_cached_area.h

Comment 2 by mek@chromium.org, Dec 21 2016

Status: Fixed (was: Assigned)

Sign in to add a comment