Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(544)

Issue 2788813002: Try to flush DOMStorage too when ending the browsing session.

Created:
3 years, 8 months ago by michaeln
Modified:
3 years, 8 months ago
CC:
chromium-reviews, darin-cc_chromium.org, jam, wjmaclean
Target Ref:
refs/heads/master
Project:
chromium
Visibility:
Public.

Description

Try to flush DOMStorage too when ending the browsing session. Call Flush() and add DOMStorage task runners to the RundownTaskCounter in EndSession(). Provided the time taken does not exceed the timeout imposed by EndSession, waiting on these task runners should ensure that DOMStorage data is written to the filesystem. BUG=418627, 485304

Patch Set 1 #

Patch Set 2 : RundownSerially #

Patch Set 3 : compile (doh!) #

Total comments: 1

Patch Set 4 : last #

Patch Set 5 : compile #

Patch Set 6 : compile some more #

Patch Set 7 : fixes #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+87 lines, -19 lines) Patch
M chrome/browser/browser_process_impl.cc View 1 2 3 4 5 6 8 chunks +54 lines, -8 lines 0 comments Download
M chrome/browser/browsing_data/browsing_data_remover_impl_unittest.cc View 1 2 1 chunk +3 lines, -1 line 0 comments Download
M content/browser/dom_storage/dom_storage_context_wrapper.h View 1 2 3 4 5 6 2 chunks +6 lines, -1 line 0 comments Download
M content/browser/dom_storage/dom_storage_context_wrapper.cc View 1 2 3 4 5 6 1 chunk +12 lines, -3 lines 1 comment Download
M content/browser/storage_partition_impl.h View 1 chunk +1 line, -1 line 0 comments Download
M content/browser/storage_partition_impl.cc View 1 2 3 4 5 6 1 chunk +6 lines, -3 lines 0 comments Download
M content/public/browser/storage_partition.h View 3 chunks +5 lines, -2 lines 0 comments Download

Messages

Total messages: 51 (33 generated)
michaeln
I'd like to revisit what we were talking about a long time ago regarding this ...
3 years, 8 months ago (2017-03-31 02:16:54 UTC) #3
hashimoto
+gab@chromium.org who might be interested in disk IO during shutdown. I don't think this is ...
3 years, 8 months ago (2017-04-04 09:23:25 UTC) #18
gab
On 2017/04/04 09:23:25, hashimoto wrote: > https://mail.google.com/mail/?view=cm&fs=1&tf=1&to=+gab@chromium.org who might be interested in disk IO during ...
3 years, 8 months ago (2017-04-04 21:03:42 UTC) #19
michaeln
> I don't think this is what we want to have in EndSession(). > EndSession() ...
3 years, 8 months ago (2017-04-04 22:12:22 UTC) #20
hashimoto
On 2017/04/04 22:12:22, michaeln wrote: > > I don't think this is what we want ...
3 years, 8 months ago (2017-04-05 08:53:32 UTC) #21
michaeln
> In crbug.com/176727, I see a number of users complaining about the said problem, > ...
3 years, 8 months ago (2017-04-11 02:01:07 UTC) #38
hashimoto
On 2017/04/11 02:01:07, michaeln wrote: > > In crbug.com/176727, I see a number of users ...
3 years, 8 months ago (2017-04-12 09:33:47 UTC) #39
Marijn Kruisselbrink
https://codereview.chromium.org/2788813002/diff/120001/content/browser/dom_storage/dom_storage_context_wrapper.cc File content/browser/dom_storage/dom_storage_context_wrapper.cc (right): https://codereview.chromium.org/2788813002/diff/120001/content/browser/dom_storage/dom_storage_context_wrapper.cc#newcode257 content/browser/dom_storage/dom_storage_context_wrapper.cc:257: // TODO(michaeln): Add mojo impl task runners to flush_runners ...
3 years, 8 months ago (2017-04-12 21:55:58 UTC) #41
michaeln
I've attached a manual test page to crbug 485304, here's a link to it. https://bugs.chromium.org/p/chromium/issues/attachmentText?aid=279899 ...
3 years, 8 months ago (2017-04-13 03:27:22 UTC) #42
michaeln
> Is it assumed that all async tasks that are necesary to flush data to ...
3 years, 8 months ago (2017-04-18 01:13:36 UTC) #43
michaeln
@marijn, another issue with the mojo impl and the synchronous EndSession shutdown sequence here is ...
3 years, 8 months ago (2017-04-18 01:47:31 UTC) #44
Marijn Kruisselbrink
On 2017/04/18 at 01:47:31, michaeln wrote: > @marijn, another issue with the mojo impl and ...
3 years, 8 months ago (2017-04-18 19:06:27 UTC) #45
gab
Drive-by as you're discussing places to run tasks. Please consider a TaskScheduler-provided TaskRunner (base/task_scheduler/post_task.h). We're ...
3 years, 8 months ago (2017-04-18 19:10:47 UTC) #46
Marijn Kruisselbrink
On 2017/04/18 at 19:10:47, gab wrote: > Drive-by as you're discussing places to run tasks. ...
3 years, 8 months ago (2017-04-18 19:32:18 UTC) #47
gab
On 2017/04/18 19:32:18, Marijn Kruisselbrink wrote: > On 2017/04/18 at 19:10:47, gab wrote: > > ...
3 years, 8 months ago (2017-04-18 19:40:00 UTC) #48
Marijn Kruisselbrink
On 2017/04/18 at 19:40:00, gab wrote: > On 2017/04/18 19:32:18, Marijn Kruisselbrink wrote: > > ...
3 years, 8 months ago (2017-04-18 19:57:55 UTC) #49
michaeln
> Yeah, creating physical threads for every SingleThreadTaskRunner seems > unfortunate (but with the current ...
3 years, 8 months ago (2017-04-18 21:52:04 UTC) #50
gab
3 years, 8 months ago (2017-04-19 17:56:45 UTC) #51
On 2017/04/18 21:52:04, michaeln wrote:
> > Yeah, creating physical threads for every SingleThreadTaskRunner seems
> > unfortunate (but with the current API seems to be the only way to avoid
> > potential deadlocks, as there doesn't seem to be a way to specify which task
> > runners actually need to be independent of each other). "Fixing" mojo to not
> > require single threaded task runners would go a long way to getting id of
the
> > need for SingleThreadTaskRunners in my case. 
> 
> +1 "fixing" that aspect of mojo

Right, we're currently making core APIs sequence-friendly, we've gone through
most of //base and //net but we're still missing mojo (http://crbug.com/678155).

Once you can hold your mojo service on a sequence you'll be fine IMO. Sequences
are all independent (can't deadlock -- unless the pool is somehow flooded with
independent waiters but we have ways to prevent that from happening). They do
support waiting but you should really avoid it at all costs (prefer async
replies if you can at all help it) -- that's in Chromium overall not just
TaskScheduler.

> 
> > The reason the code then ends up using things like WaitableEvent is because
> > leveldb itself expects to make synchronous calls to methods implemented by
me
> > (from multiple threads/task runners), where those methods need to make
> > synchronous mojo calls (and those mojo calls have to all happen from the
same
> > thread due to mojo limitations). So currently I have three task runners:
> > 
> > DB Thread: 
> > - implements LevelDBDatabase mojo interface, calls out to actual leveldb
code,
> > needs to be able to block on file operations (which are scheduled on the
FILE
> > runner)
> > 
> > BG Runner:
> > - leveldb code can schedule tasks on this runner. order doesn't matter, but
> > tasks need to be able to block on file operations (which are scheduled on
the
> > FILE runner)
> > 
> > FILE Runner:
> > - calls out to mojo file service for actual file operations (where the mojo
> > service implementing those operations actually also lives on the FILE
thread,
> > but that's not required, just nice to avoid extra thread hops)
> 
> Does the DBThread block on the BGRunner too, there's a Mutex class in
> leveldatabase/port/port.h
> 
> leveldb logic primarily runs on the DBThread
> leveldb compaction logic runs on the BGRunner
> leveldb logic on both of those threads require synchronous file access

Powered by Google App Engine
This is Rietveld 408576698