New issue
Advanced search Search tips

Issue 709336 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner: ----
Closed: May 2017
Components:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 2
Type: Feature



Sign in to add a comment

Allow posting the CronetEngine UI Thread initialization on a custom Ui executor instead of the default Looper.getMainLooper()

Project Member Reported by sobrinho@google.com, Apr 7 2017

Issue description

If CronetEngine is initialized during the Application.onCreate() then the engine will be blocked until the end of the onCreate(). When posting to the Ui Handler, the next available "slot" will always happen after the Application.onCreate().

This means the engine will either be blocked until the onCreate() finished OR the developer must initialize the full CronetEngine on the Ui Thread.

By providing a custom Ui Executor, one can initialize the CronetEngine in a background thread and at the same time control when the Ui Thread initialization happens.

This is mostly useful if the Application.onCreate() is heavy and long.

A simple implementation of the executor could just "collect" these runnables and then "flush" them at a determinate time on the Ui Thread.
 
Components: Internals>Network>Library
Labels: -Cr-Internals-Network-Library Type-Feature
Discussing on CL: https://codereview.chromium.org/2805743003/
Project Member

Comment 2 by bugdroid1@chromium.org, May 5 2017

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

commit 6815aefeae88a9e62065ca8084075e3e98dec267
Author: pauljensen <pauljensen@chromium.org>
Date: Fri May 05 03:00:06 2017

[Cronet] Move initialization to a new thread rather than the UI thread.

The UI thread is generally overbooked (esp at app startup time) so
avoiding it can greatly improve Cronet startup time.  The UI thread
was used for initialization previously because it simplified the
NetworkChangeNotifierAutoDetect and ProxyChangeListener logic because
BroadcastReceiver onReceived callbacks always happen on the UI thread
so those classes could be completely single-threaded.  This change
leaves those classes single-threaded except for their onRecieved()
methods which now immediately post to the new initialization thread
and check whether their BroadcastReceivers are currently registered.

BUG= 709336 
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.android:android_cronet_tester

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

[modify] https://crrev.com/6815aefeae88a9e62065ca8084075e3e98dec267/components/cronet/android/cronet_library_loader.cc
[modify] https://crrev.com/6815aefeae88a9e62065ca8084075e3e98dec267/components/cronet/android/cronet_library_loader.h
[modify] https://crrev.com/6815aefeae88a9e62065ca8084075e3e98dec267/components/cronet/android/cronet_url_request_context_adapter.cc
[modify] https://crrev.com/6815aefeae88a9e62065ca8084075e3e98dec267/components/cronet/android/cronet_url_request_context_adapter.h
[modify] https://crrev.com/6815aefeae88a9e62065ca8084075e3e98dec267/components/cronet/android/java/src/org/chromium/net/impl/CronetLibraryLoader.java
[modify] https://crrev.com/6815aefeae88a9e62065ca8084075e3e98dec267/components/cronet/android/java/src/org/chromium/net/impl/CronetUrlRequestContext.java
[modify] https://crrev.com/6815aefeae88a9e62065ca8084075e3e98dec267/net/BUILD.gn
[modify] https://crrev.com/6815aefeae88a9e62065ca8084075e3e98dec267/net/android/BUILD.gn
[modify] https://crrev.com/6815aefeae88a9e62065ca8084075e3e98dec267/net/android/java/src/org/chromium/net/NetworkChangeNotifierAutoDetect.java
[modify] https://crrev.com/6815aefeae88a9e62065ca8084075e3e98dec267/net/android/java/src/org/chromium/net/ProxyChangeListener.java
[add] https://crrev.com/6815aefeae88a9e62065ca8084075e3e98dec267/net/android/javatests/src/org/chromium/net/AndroidProxyConfigServiceTestUtil.java
[modify] https://crrev.com/6815aefeae88a9e62065ca8084075e3e98dec267/net/android/javatests/src/org/chromium/net/NetworkChangeNotifierTest.java
[modify] https://crrev.com/6815aefeae88a9e62065ca8084075e3e98dec267/net/proxy/proxy_config_service_android_unittest.cc

Comment 3 by mef@chromium.org, May 26 2017

Is this fixed now?
Status: Fixed (was: Unconfirmed)
Will be available in cronet version 60?
A later fix was needed: crrev.com/472871

The patch and the fix are available in 60.0.3104.0

You can see this by pasting the git commit hash into the "Find Releases" box at https://omahaproxy.appspot.com/ 

Sign in to add a comment