Cronet: Disallow blocking I/O on the network thread with exception on init

Currently, the Cronet network thread allows blocking I/O. We would like to disable it unless it
is the initialization code that has to finish the creation of the prefs service before the thread
can be used to send network requests. That includes the creation of the storage directory and files.

This change is motivated by M63 blocking issue 770053. It assumes that blocking I/O is disabled
right after the thread creation. As the result, disallowing blocking I/O after Cronet
initialization doesn't solve the issue.

The CL makes use ScopedAllowBlocking class, which use is not public and discouraged.
However, it provides the simplest solution to the problem. The alternative solutions
either mimic ScopedAllowBlocking with an additional thread or require significant changes
to Cronet code, e.g. queuing all network request until the prefs service is initialized.

BUG=770053

Cq-Include-Trybots: master.tryserver.chromium.android:android_cronet_tester;master.tryserver.chromium.mac:ios-simulator-cronet
Change-Id: Ib97b8b727bcfb349050434858332342264e3737d
Reviewed-on: https://chromium-review.googlesource.com/705700
Reviewed-by: John Abd-El-Malek <jam@chromium.org>
Reviewed-by: Misha Efimov <mef@chromium.org>
Commit-Queue: Andrei Kapishnikov <kapishnikov@chromium.org>
Cr-Commit-Position: refs/heads/master@{#510740}

CrOS-Libchrome-Original-Commit: 46532f347d4a6799647e012df075789b52dac5d9
1 file changed
tree: bfa0f3d63d1253cb138799ba7e481034bbea51af
  1. base/
  2. build/
  3. components/
  4. dbus/
  5. device/
  6. ipc/
  7. mojo/
  8. testing/
  9. third_party/
  10. ui/