Chromium Code Reviews
[email protected] (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(354)

Issue 1899753002: Make InstanceIDBridge fully async to fix strict mode violations (Closed)

Created:
4 years, 8 months ago by johnme
Modified:
4 years, 7 months ago
Reviewers:
Peter Beverloo, jianli
CC:
chromium-reviews, Peter Beverloo, johnme+watch_chromium.org, zea+watch_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@iid3test
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Make InstanceIDBridge fully async to fix strict mode violations InstanceID.java's getInstance/getId/getCreationTime methods are not documented as needing to be called from a background thread (unlike getToken and deleteToken which are documented as "Do not call this function on the main thread.", or deleteInstanceID which is not documented but at least throws an IOException if you get this wrong). However it turns out that getInstance/getId/getCreationTime can all cause strict mode violations if called on the main thread, because they sometimes read from SharedPreferences (and hence from disk). This patch fixes these violations, by making InstanceIDBridge fully asynchronous. Its InstanceIDWithSubtype is now initialized lazily on a background thread. Part of a series of patches: 1. https://codereview.chromium.org/1832833002 adds InstanceIDWithSubtype 2. https://codereview.chromium.org/1830983002 adds JNI bindings 3. https://codereview.chromium.org/1829023002 adds fake and test 4. this patch 5. https://codereview.chromium.org/1854093002 enables InstanceID by default 6. https://codereview.chromium.org/1923953002 adds crypto integration 7. https://codereview.chromium.org/1851423003 switches Push to InstanceIDs BUG=589461 Committed: https://crrev.com/6ab9853acfbfae3e598004776c1d120805956038 Cr-Commit-Position: refs/heads/master@{#390139}

Patch Set 1 #

Total comments: 2

Patch Set 2 : Rebase #

Patch Set 3 : Fix DeleteID use after free #

Total comments: 2

Patch Set 4 : Rebase & tweak lifetime comments #

Total comments: 2

Patch Set 5 : Disallow synchronous delete from callbacks #

Total comments: 2

Patch Set 6 : |this| #

Messages

Total messages: 22 (7 generated)
johnme
4 years, 8 months ago (2016-04-18 14:22:02 UTC) #2
Peter Beverloo
lgtm https://codereview.chromium.org/1899753002/diff/1/components/gcm_driver/instance_id/android/javatests/src/org/chromium/components/gcm_driver/instance_id/FakeInstanceIDWithSubtype.java File components/gcm_driver/instance_id/android/javatests/src/org/chromium/components/gcm_driver/instance_id/FakeInstanceIDWithSubtype.java (right): https://codereview.chromium.org/1899753002/diff/1/components/gcm_driver/instance_id/android/javatests/src/org/chromium/components/gcm_driver/instance_id/FakeInstanceIDWithSubtype.java#newcode64 components/gcm_driver/instance_id/android/javatests/src/org/chromium/components/gcm_driver/instance_id/FakeInstanceIDWithSubtype.java:64: // thread, by reading from SharedPreferences. I don't ...
4 years, 8 months ago (2016-04-18 15:49:44 UTC) #3
johnme
https://codereview.chromium.org/1899753002/diff/1/components/gcm_driver/instance_id/android/javatests/src/org/chromium/components/gcm_driver/instance_id/FakeInstanceIDWithSubtype.java File components/gcm_driver/instance_id/android/javatests/src/org/chromium/components/gcm_driver/instance_id/FakeInstanceIDWithSubtype.java (right): https://codereview.chromium.org/1899753002/diff/1/components/gcm_driver/instance_id/android/javatests/src/org/chromium/components/gcm_driver/instance_id/FakeInstanceIDWithSubtype.java#newcode64 components/gcm_driver/instance_id/android/javatests/src/org/chromium/components/gcm_driver/instance_id/FakeInstanceIDWithSubtype.java:64: // thread, by reading from SharedPreferences. On 2016/04/18 15:49:44, ...
4 years, 8 months ago (2016-04-19 12:33:00 UTC) #4
johnme
Hey Peter, PTAL at last patch that fixes a use after free.
4 years, 8 months ago (2016-04-26 14:52:20 UTC) #5
Peter Beverloo
https://codereview.chromium.org/1899753002/diff/40001/components/gcm_driver/instance_id/instance_id_android.cc File components/gcm_driver/instance_id/instance_id_android.cc (right): https://codereview.chromium.org/1899753002/diff/40001/components/gcm_driver/instance_id/instance_id_android.cc#newcode216 components/gcm_driver/instance_id/instance_id_android.cc:216: DeleteTokenCallback* callback = delete_id_callbacks_.Lookup(request_id); Where does this happen? The ...
4 years, 8 months ago (2016-04-26 15:12:23 UTC) #6
johnme
https://codereview.chromium.org/1899753002/diff/40001/components/gcm_driver/instance_id/instance_id_android.cc File components/gcm_driver/instance_id/instance_id_android.cc (right): https://codereview.chromium.org/1899753002/diff/40001/components/gcm_driver/instance_id/instance_id_android.cc#newcode216 components/gcm_driver/instance_id/instance_id_android.cc:216: DeleteTokenCallback* callback = delete_id_callbacks_.Lookup(request_id); On 2016/04/26 15:12:23, Peter Beverloo ...
4 years, 8 months ago (2016-04-26 17:18:28 UTC) #7
Peter Beverloo
+jianli, would you mind being the tie-breaker? (relevant context in the following comment and instance_id_android.cc:216) ...
4 years, 8 months ago (2016-04-26 17:27:28 UTC) #9
johnme
On 2016/04/26 17:27:28, Peter Beverloo wrote: > +jianli, would you mind being the tie-breaker? > ...
4 years, 8 months ago (2016-04-26 17:31:32 UTC) #10
jianli
https://codereview.chromium.org/1899753002/diff/60001/components/gcm_driver/instance_id/instance_id_android.h File components/gcm_driver/instance_id/instance_id_android.h (right): https://codereview.chromium.org/1899753002/diff/60001/components/gcm_driver/instance_id/instance_id_android.h#newcode25 components/gcm_driver/instance_id/instance_id_android.h:25: // mustn't synchronously delete this (using InstanceIDDriver::RemoveInstanceID). I don't ...
4 years, 8 months ago (2016-04-26 20:50:56 UTC) #11
johnme
Addressed review comment - thanks! https://codereview.chromium.org/1899753002/diff/60001/components/gcm_driver/instance_id/instance_id_android.h File components/gcm_driver/instance_id/instance_id_android.h (right): https://codereview.chromium.org/1899753002/diff/60001/components/gcm_driver/instance_id/instance_id_android.h#newcode25 components/gcm_driver/instance_id/instance_id_android.h:25: // mustn't synchronously delete ...
4 years, 7 months ago (2016-04-27 09:41:56 UTC) #12
Peter Beverloo
lgtm, thank you :) https://codereview.chromium.org/1899753002/diff/80001/components/gcm_driver/instance_id/instance_id.h File components/gcm_driver/instance_id/instance_id.h (right): https://codereview.chromium.org/1899753002/diff/80001/components/gcm_driver/instance_id/instance_id.h#newcode44 components/gcm_driver/instance_id/instance_id.h:44: // Asynchronous callbacks. Must not ...
4 years, 7 months ago (2016-04-27 10:56:37 UTC) #13
johnme
https://codereview.chromium.org/1899753002/diff/80001/components/gcm_driver/instance_id/instance_id.h File components/gcm_driver/instance_id/instance_id.h (right): https://codereview.chromium.org/1899753002/diff/80001/components/gcm_driver/instance_id/instance_id.h#newcode44 components/gcm_driver/instance_id/instance_id.h:44: // Asynchronous callbacks. Must not synchronously delete this (using ...
4 years, 7 months ago (2016-04-27 18:03:57 UTC) #15
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1899753002/100001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1899753002/100001
4 years, 7 months ago (2016-04-27 18:04:28 UTC) #18
commit-bot: I haz the power
Committed patchset #6 (id:100001)
4 years, 7 months ago (2016-04-27 18:57:24 UTC) #20
commit-bot: I haz the power
4 years, 7 months ago (2016-04-30 17:11:37 UTC) #21
Message was sent while issue was closed.
Patchset 6 (id:??) landed as
https://crrev.com/6ab9853acfbfae3e598004776c1d120805956038
Cr-Commit-Position: refs/heads/master@{#390139}

Powered by Google App Engine
This is Rietveld 408576698