New issue
Advanced search Search tips

Issue 740584 link

Starred by 2 users

Issue metadata

Status: Fixed
Owner:
Closed: Oct 2017
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug
Proj-Servicification

Blocked on:
issue 744774

Blocking:
issue 611935



Sign in to add a comment

[mojo-blobs] Transfer bytes on correct thread in renderer

Project Member Reported by mek@chromium.org, Jul 10 2017

Issue description

Currently bytes are transferred on the thread that created a blob (main or worker thread), but that thread can block trying to read the same blob, so blob transfer has to be moved to a different thread.
This should also make sure that a blob can transfer correctly if the worker that created the blob stops before transfer is complete.
 

Comment 1 by mek@chromium.org, Jul 10 2017

Two options:

- simplest: just run all blob bytes transfer related code on a dedicated MayBlock SequencedTaskRunner.

- more complicated: run the main BytesProvider implementation on the IPC thread (like in the IPC based codebase), and switch to a different MayBlock task runner for file operations (old code uses FileThreadTaskRunner, but dedicated (Sequenced)TaskRunner is probably preferred now.

Benefits of the more complicated approach would be that some thread hops can be avoided for the DataPipe and Reply cases (as incoming mojo messages always pass through the IPC thread), but it's unclear if the added complexity actually makes a real impact on performance.

Comment 2 by mek@chromium.org, Jul 17 2017

Blockedon: 744774
Project Member

Comment 3 by bugdroid1@chromium.org, Jul 29 2017

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

commit 8c2764154c196bf55a141141914255ff866b1c12
Author: Marijn Kruisselbrink <mek@chromium.org>
Date: Sat Jul 29 06:11:21 2017

Move BlobBytesProvider to a File task runner.

Move it off the main/worker thread to prevent deadlock when the main or
worker thread tries to synchronously read the blob (using XHR or
FileReaderSync). Additionally BlobBytesProvider might do blocking
file operations, which shouldn't be done on the main thread anyway, so
this moves the code to always run on the File thread. In the future it
might make sense to have part of BlobBytesProvider on the IO thread with
only the file operations on the File thread (matching the old IPC based
implementation), but for now doing all its work on the File thread should
work just fine.

This also required actually exposing a File task runner in blink::Platform.
This file task runner is not shared with the file thread in content, but
then the content one is only created on demand (for ppapi and MHTML saving)
anyway, so in most cases this should not result in extra threads.

Also add a virtual test suite to enable FileAPI (blob) layout and WPT tests
with mojo blobs, now that creating blobs works.

Bug:  740584 ,  744774 
Change-Id: Icc1e22f662dea895e1d1b2f1a1cc79c885e6706e
Reviewed-on: https://chromium-review.googlesource.com/565641
Reviewed-by: Kentaro Hara <haraken@chromium.org>
Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
Reviewed-by: Daniel Murphy <dmurph@chromium.org>
Commit-Queue: Marijn Kruisselbrink <mek@chromium.org>
Cr-Commit-Position: refs/heads/master@{#490636}
[modify] https://crrev.com/8c2764154c196bf55a141141914255ff866b1c12/content/renderer/render_thread_impl.cc
[modify] https://crrev.com/8c2764154c196bf55a141141914255ff866b1c12/content/renderer/render_thread_impl.h
[modify] https://crrev.com/8c2764154c196bf55a141141914255ff866b1c12/third_party/WebKit/LayoutTests/NeverFixTests
[modify] https://crrev.com/8c2764154c196bf55a141141914255ff866b1c12/third_party/WebKit/LayoutTests/VirtualTestSuites
[add] https://crrev.com/8c2764154c196bf55a141141914255ff866b1c12/third_party/WebKit/LayoutTests/virtual/mojo-blobs/external/wpt/FileAPI/README.txt
[add] https://crrev.com/8c2764154c196bf55a141141914255ff866b1c12/third_party/WebKit/LayoutTests/virtual/mojo-blobs/fast/files/README.txt
[modify] https://crrev.com/8c2764154c196bf55a141141914255ff866b1c12/third_party/WebKit/Source/platform/CrossThreadCopier.h
[modify] https://crrev.com/8c2764154c196bf55a141141914255ff866b1c12/third_party/WebKit/Source/platform/blob/BlobBytesProvider.cpp
[modify] https://crrev.com/8c2764154c196bf55a141141914255ff866b1c12/third_party/WebKit/Source/platform/blob/BlobData.cpp
[modify] https://crrev.com/8c2764154c196bf55a141141914255ff866b1c12/third_party/WebKit/Source/platform/exported/Platform.cpp
[modify] https://crrev.com/8c2764154c196bf55a141141914255ff866b1c12/third_party/WebKit/public/platform/Platform.h

Comment 4 by mek@chromium.org, Oct 2 2017

Status: Fixed (was: Started)

Comment 5 by laforge@google.com, Nov 7 2017

Components: Internals>Network>Service

Comment 6 by laforge@google.com, Nov 7 2017

Components: -Internals>Network>Service Internals>Services>Network
Apologies, applied the wrong component in bulk.

Comment 7 by laforge@google.com, Nov 8 2017

Components: Internals>Services>Storage
Setting Internals>Services>Storage to all children of issue 611935

Sign in to add a comment