|
|
Created:
6 years, 3 months ago by jdduke (slow) Modified:
6 years, 3 months ago CC:
chromium-reviews, erikwright+watch_chromium.org, K Chandrasekhar Omkar, Sami Base URL:
https://chromium.googlesource.com/chromium/src.git@master Project:
chromium Visibility:
Public. |
Description[Android] Mark posted UI thread tasks as asynchronous
Chromium shares a message loop with Android on the browser UI thread.
This can cause problems when the associated Looper has a sync barrier,
preventing posted Chromium tasks from being dispatched until the
barrier is removed. Make this sharing more fair by marking all Chromium
Message tasks as asynchronous, avoiding stalls when there is a sync
barrier.
Note: This change is for gathering data about the perf impact and we'll
revert it before cutting a release branch.
BUG=407149, 380781, 407133
Committed: https://crrev.com/feabeebb3ac5810f896ac8303a77ee695acaf9d4
Cr-Commit-Position: refs/heads/master@{#292551}
Patch Set 1 #Patch Set 2 : Compile... #Patch Set 3 : Comment #
Total comments: 6
Patch Set 4 : Code review #Messages
Total messages: 17 (0 generated)
jdduke@chromium.org changed reviewers: + aelias@chromium.org, epenner@chromium.org, sievers@chromium.org
There may be some side effects here, but they better be pretty nasty for us to not go ahead with this. It definitely fixes all the nasty stalls we've noticed when the UI is invalidated out-of-concert with the compositor.
skyostil@chromium.org changed reviewers: + skyostil@chromium.org
Are async messages processed out of order w.r.t. sync messages? I'm wondering if this could introduce some subtle ordering bugs. I'm also wondering if we could emulate this with postAtFrontOfQueue(), which is another hairy API but at least it's public.
On 2014/08/28 18:01:50, Sami wrote: > Are async messages processed out of order w.r.t. sync messages? I'm wondering if > this could introduce some subtle ordering bugs. > > I'm also wondering if we could emulate this with postAtFrontOfQueue(), which is > another hairy API but at least it's public. postAtFrontOfQueue() would probably end up starving the view system in some cases. But it's possible that our msg pump could be reworked entirely to make it work somehow. We also noticed that there is a bit of overhead with calling into Java and inserting a task there for every native postTask() (see AlwaysNotifyPump() hack). You could say that what we really want is to have our native msg queue be pumped as part of the outer system loop somehow (and somewhat regularly with low latency) . We currently achieve this by queuing a whole lot of tasks, but maybe there is another way.
On 2014/08/28 18:14:05, sievers wrote: > On 2014/08/28 18:01:50, Sami wrote: > > Are async messages processed out of order w.r.t. sync messages? I'm wondering > if > > this could introduce some subtle ordering bugs. > > I don't think anyone should make assumptions about ordering between tasks posted from Java to the looper and tasks posted natively to the Chrome queue. So as long as we don't break ordering within Chrome tasks, it is probably ok.
jdduke@chromium.org changed reviewers: + nyquist@chromium.org
nyquist: PTAL for owner review. We'd like to land this for a few days and gauge the performance/stability impact, after which we'll likely revert it. If we gather sufficient evidence for this change, we'll use it to motivate Android to make public the corresponding asynchronous API.
rubberstamp lgtm https://codereview.chromium.org/512333002/diff/40001/base/android/java/src/or... File base/android/java/src/org/chromium/base/SystemMessageHandler.java (right): https://codereview.chromium.org/512333002/diff/40001/base/android/java/src/or... base/android/java/src/org/chromium/base/SystemMessageHandler.java:42: } catch (Exception e) { Why is this not catching RuntimeException? https://codereview.chromium.org/512333002/diff/40001/base/android/java/src/or... base/android/java/src/org/chromium/base/SystemMessageHandler.java:84: } catch (Exception e) { Why is this not catching IllegalAccessException, IllegalArgumentException, InvocationTargetException? If you really need to catch RuntimeException, you can specify that separately.
Thanks for review. https://codereview.chromium.org/512333002/diff/40001/base/android/java/src/or... File base/android/java/src/org/chromium/base/SystemMessageHandler.java (right): https://codereview.chromium.org/512333002/diff/40001/base/android/java/src/or... base/android/java/src/org/chromium/base/SystemMessageHandler.java:42: } catch (Exception e) { On 2014/08/28 23:27:27, nyquist wrote: > Why is this not catching RuntimeException? Is there anything to gain from catching that in addition to Exception? ClassNotFound and NoSuchMethod are illustrative, but what does Runtime add to the plain old Exception? https://codereview.chromium.org/512333002/diff/40001/base/android/java/src/or... base/android/java/src/org/chromium/base/SystemMessageHandler.java:84: } catch (Exception e) { On 2014/08/28 23:27:27, nyquist wrote: > Why is this not catching IllegalAccessException, IllegalArgumentException, > InvocationTargetException? If you really need to catch RuntimeException, you can > specify that separately. In practice, I'm not sure that we care, and I don't think we'd change the reaction. If you think that would be helpful to differentiate, I'd be happy to add them.
https://codereview.chromium.org/512333002/diff/40001/base/android/java/src/or... File base/android/java/src/org/chromium/base/SystemMessageHandler.java (right): https://codereview.chromium.org/512333002/diff/40001/base/android/java/src/or... base/android/java/src/org/chromium/base/SystemMessageHandler.java:42: } catch (Exception e) { On 2014/08/28 23:37:03, jdduke wrote: > On 2014/08/28 23:27:27, nyquist wrote: > > Why is this not catching RuntimeException? > > Is there anything to gain from catching that in addition to Exception? > ClassNotFound and NoSuchMethod are illustrative, but what does Runtime add to > the plain old Exception? N/m, I have seen the error of my ways, done! https://codereview.chromium.org/512333002/diff/40001/base/android/java/src/or... base/android/java/src/org/chromium/base/SystemMessageHandler.java:84: } catch (Exception e) { On 2014/08/28 23:37:03, jdduke wrote: > On 2014/08/28 23:27:27, nyquist wrote: > > Why is this not catching IllegalAccessException, IllegalArgumentException, > > InvocationTargetException? If you really need to catch RuntimeException, you > can > > specify that separately. > > In practice, I'm not sure that we care, and I don't think we'd change the > reaction. If you think that would be helpful to differentiate, I'd be happy to > add them. Ditto above.
The CQ bit was checked by jdduke@chromium.org
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/jdduke@chromium.org/512333002/60001
FYI, CQ is re-trying this CL (attempt #1). The failing builders are: android_dbg_tests_recipe on tryserver.chromium.linux (http://build.chromium.org/p/tryserver.chromium.linux/builders/android_dbg_tes...)
Message was sent while issue was closed.
Committed patchset #4 (id:60001) as 6a100f5a90bf045a4508c9d5df0af6cca0aa2084
Message was sent while issue was closed.
Patchset 4 (id:??) landed as https://crrev.com/feabeebb3ac5810f896ac8303a77ee695acaf9d4 Cr-Commit-Position: refs/heads/master@{#292551}
Message was sent while issue was closed.
A revert of this CL (patchset #4 id:60001) has been created in https://codereview.chromium.org/564373005/ by jdduke@chromium.org. The reason for reverting is: This patch was purely experimental, and the experiment has expired.. |