|
|
Created:
4 years, 3 months ago by Changwan Ryu Modified:
4 years, 3 months ago Reviewers:
aelias_OOO_until_Jul13 CC:
chromium-reviews, darin-cc_chromium.org, jam Target Ref:
refs/pending/heads/master Project:
chromium Visibility:
Public. |
DescriptionAllow some InputConnection methods to be called on UI thread
Assertions are removed from some of the InputConnection methods that
merely post on UI thread. In doing so, mPendingAccent was changed to be
accessed only on UI thread.
However, beginBatchEdit() / endBatchEdit() implementations are quite
complicated and no evidence calling those on UI thread was found so far.
Also, for get* methods we return cached results.
BUG=643477
Committed: https://crrev.com/c8a5f86ac17908905756c36a9d4ff87439401994
Cr-Commit-Position: refs/heads/master@{#417499}
Patch Set 1 #
Total comments: 3
Patch Set 2 : leaves assertion for *BatchEdit() methods and returns null for get*() methods #
Total comments: 2
Patch Set 3 : bring back cache approach #
Messages
Total messages: 31 (19 generated)
The CQ bit was checked by changwan@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
changwan@chromium.org changed reviewers: + aelias@chromium.org
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
https://codereview.chromium.org/2299913003/diff/1/content/public/android/java... File content/public/android/java/src/org/chromium/content/browser/input/ThreadedInputConnection.java (right): https://codereview.chromium.org/2299913003/diff/1/content/public/android/java... content/public/android/java/src/org/chromium/content/browser/input/ThreadedInputConnection.java:94: private final AtomicInteger mNumNestedBatchEdits = new AtomicInteger(); Instead of making this atomic, I'd prefer to slap "synchronized" on the relevant methods in this class. I don't want to have to reason about interleaved execution. https://codereview.chromium.org/2299913003/diff/1/content/public/android/java... content/public/android/java/src/org/chromium/content/browser/input/ThreadedInputConnection.java:214: return mCachedTextInputState; Can we try returning an empty default one instead? I don't want this to even seem to work. I'd like to try breaking whatever minor feature relies on this, without crashing, so that users aren't overly disturbed, and LG is forced to stop doing this to fix their minor feature. And nobody ever tries to do this again.
https://codereview.chromium.org/2299913003/diff/1/content/public/android/java... File content/public/android/java/src/org/chromium/content/browser/input/ThreadedInputConnection.java (right): https://codereview.chromium.org/2299913003/diff/1/content/public/android/java... content/public/android/java/src/org/chromium/content/browser/input/ThreadedInputConnection.java:94: private final AtomicInteger mNumNestedBatchEdits = new AtomicInteger(); On 2016/09/03 at 08:22:31, aelias wrote: > Instead of making this atomic, I'd prefer to slap "synchronized" on the relevant methods in this class. I don't want to have to reason about interleaved execution. On second thought, I'd prefer that you simply keep the thread assertions on the batch edit methods. There is not evidence that there is existing use of them on the UI thread, so why loosen it? I'm cool with removing the assertion for all the methods that simply post an async task on the UI thread. But for those that do something more complicated, let's try and maintain the guarantees as tight as we can.
The CQ bit was checked by changwan@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
Description was changed from ========== Allow InputConnection methods to be called on UI thread Assertions are removed from all the InputConnection methods. This does not affect methods such as setSelection() which merely post on the UI thread. But I had to fix some implementations to make this work correctly as follows: - change mPendingAccent to be accessed only on UI thread - return cached results for get* methods - change mNumNestedBatchEdits to AtomicInteger and allow it to be accessed on multiple threads BUG=643477 ========== to ========== Allow some InputConnection methods to be called on UI thread Assertions are removed from some of the InputConnection methods. This does not affect methods such as setSelection() which merely post on the UI thread. To make this happen, we change mPendingAccent to be accessed only on UI thread. However, beginBatchEdit() / endBatchEdit() implementations are quite complicated and no evidence calling those on UI thread found so far. Also, get* methods cannot be accessed on UI thread. We simply return null. BUG=643477 ==========
On 2016/09/03 08:29:49, aelias wrote: > https://codereview.chromium.org/2299913003/diff/1/content/public/android/java... > File > content/public/android/java/src/org/chromium/content/browser/input/ThreadedInputConnection.java > (right): > > https://codereview.chromium.org/2299913003/diff/1/content/public/android/java... > content/public/android/java/src/org/chromium/content/browser/input/ThreadedInputConnection.java:94: > private final AtomicInteger mNumNestedBatchEdits = new AtomicInteger(); > On 2016/09/03 at 08:22:31, aelias wrote: > > Instead of making this atomic, I'd prefer to slap "synchronized" on the > relevant methods in this class. I don't want to have to reason about > interleaved execution. > > On second thought, I'd prefer that you simply keep the thread assertions on the > batch edit methods. There is not evidence that there is existing use of them on > the UI thread, so why loosen it? > > I'm cool with removing the assertion for all the methods that simply post an > async task on the UI thread. But for those that do something more complicated, > let's try and maintain the guarantees as tight as we can. Sounds good to me. Done as suggested.
Description was changed from ========== Allow some InputConnection methods to be called on UI thread Assertions are removed from some of the InputConnection methods. This does not affect methods such as setSelection() which merely post on the UI thread. To make this happen, we change mPendingAccent to be accessed only on UI thread. However, beginBatchEdit() / endBatchEdit() implementations are quite complicated and no evidence calling those on UI thread found so far. Also, get* methods cannot be accessed on UI thread. We simply return null. BUG=643477 ========== to ========== Allow some InputConnection methods to be called on UI thread Assertions are removed from some of the InputConnection methods that merely post on UI thread. In doing so, mPendingAccent was changed to be accessed only on UI thread. However, beginBatchEdit() / endBatchEdit() implementations are quite complicated and no evidence calling those on UI thread was found so far. Also, get* methods cannot be accessed on UI thread. We simply return null in this case. BUG=643477 ==========
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
https://codereview.chromium.org/2299913003/diff/20001/content/public/android/... File content/public/android/java/src/org/chromium/content/browser/input/ThreadedInputConnection.java (right): https://codereview.chromium.org/2299913003/diff/20001/content/public/android/... content/public/android/java/src/org/chromium/content/browser/input/ThreadedInputConnection.java:211: return null; OK, I think we can't get away with this after reading the LG crash stack and the description of what they're doing in http://crbug.com/637242#c14. The stack indicates their actionMode implementation is checking whether selection is nonempty in order to start cut/copy operation. The likely result of returning null here is that copy/cut stops doing anything at all, which is too serious a bug to ship. Please bring back the cached text for now. For the longer run, I've filed http://crbug.com/644590 to eliminate the need for LG to be doing this at all (and in medium run, maybe we can also discuss with them a better way to detect if selection exists).
The CQ bit was checked by changwan@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
https://codereview.chromium.org/2299913003/diff/20001/content/public/android/... File content/public/android/java/src/org/chromium/content/browser/input/ThreadedInputConnection.java (right): https://codereview.chromium.org/2299913003/diff/20001/content/public/android/... content/public/android/java/src/org/chromium/content/browser/input/ThreadedInputConnection.java:211: return null; On 2016/09/07 03:12:32, aelias wrote: > OK, I think we can't get away with this after reading the LG crash stack and the > description of what they're doing in http://crbug.com/637242#c14. The stack > indicates their actionMode implementation is checking whether selection is > nonempty in order to start cut/copy operation. The likely result of returning > null here is that copy/cut stops doing anything at all, which is too serious a > bug to ship. > > Please bring back the cached text for now. For the longer run, I've filed > http://crbug.com/644590 to eliminate the need for LG to be doing this at all > (and in medium run, maybe we can also discuss with them a better way to detect > if selection exists). Done.
Description was changed from ========== Allow some InputConnection methods to be called on UI thread Assertions are removed from some of the InputConnection methods that merely post on UI thread. In doing so, mPendingAccent was changed to be accessed only on UI thread. However, beginBatchEdit() / endBatchEdit() implementations are quite complicated and no evidence calling those on UI thread was found so far. Also, get* methods cannot be accessed on UI thread. We simply return null in this case. BUG=643477 ========== to ========== Allow some InputConnection methods to be called on UI thread Assertions are removed from some of the InputConnection methods that merely post on UI thread. In doing so, mPendingAccent was changed to be accessed only on UI thread. However, beginBatchEdit() / endBatchEdit() implementations are quite complicated and no evidence calling those on UI thread was found so far. Also, for get* methods we return cached results. BUG=643477 ==========
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
ping. Since we need a signed build to test against OEM apps, we may need to try different versions and identify problems asap. PTAL.
lgtm
The CQ bit was checked by changwan@chromium.org
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
Message was sent while issue was closed.
Description was changed from ========== Allow some InputConnection methods to be called on UI thread Assertions are removed from some of the InputConnection methods that merely post on UI thread. In doing so, mPendingAccent was changed to be accessed only on UI thread. However, beginBatchEdit() / endBatchEdit() implementations are quite complicated and no evidence calling those on UI thread was found so far. Also, for get* methods we return cached results. BUG=643477 ========== to ========== Allow some InputConnection methods to be called on UI thread Assertions are removed from some of the InputConnection methods that merely post on UI thread. In doing so, mPendingAccent was changed to be accessed only on UI thread. However, beginBatchEdit() / endBatchEdit() implementations are quite complicated and no evidence calling those on UI thread was found so far. Also, for get* methods we return cached results. BUG=643477 ==========
Message was sent while issue was closed.
Committed patchset #3 (id:40001)
Message was sent while issue was closed.
Description was changed from ========== Allow some InputConnection methods to be called on UI thread Assertions are removed from some of the InputConnection methods that merely post on UI thread. In doing so, mPendingAccent was changed to be accessed only on UI thread. However, beginBatchEdit() / endBatchEdit() implementations are quite complicated and no evidence calling those on UI thread was found so far. Also, for get* methods we return cached results. BUG=643477 ========== to ========== Allow some InputConnection methods to be called on UI thread Assertions are removed from some of the InputConnection methods that merely post on UI thread. In doing so, mPendingAccent was changed to be accessed only on UI thread. However, beginBatchEdit() / endBatchEdit() implementations are quite complicated and no evidence calling those on UI thread was found so far. Also, for get* methods we return cached results. BUG=643477 Committed: https://crrev.com/c8a5f86ac17908905756c36a9d4ff87439401994 Cr-Commit-Position: refs/heads/master@{#417499} ==========
Message was sent while issue was closed.
Patchset 3 (id:??) landed as https://crrev.com/c8a5f86ac17908905756c36a9d4ff87439401994 Cr-Commit-Position: refs/heads/master@{#417499} |