Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(136)

Issue 933523005: Push API: Fix thread safety of PushMessagingMessageFilter (Closed)

Created:
5 years, 10 months ago by johnme
Modified:
5 years, 10 months ago
CC:
chromium-reviews, darin-cc_chromium.org, jam
Base URL:
https://chromium.googlesource.com/chromium/src.git@snippet
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Push API: Fix thread safety of PushMessagingMessageFilter This addresses several issues: - Use of weak_factory_io_to_io_ was unsafe because PushMessagingMessageFilter could be destroyed on either IO or UI thread. Fixed by overriding OnDestruct to ensure it is always destroyed on IO thread. - Use of weak_factory_ui_to_ui_ was similarly unsafe. Fixed by splitting out the UI thread parts of PushMessagingMessageFilter into a new class, PushMessagingMessageFilterCore, which does all the UI thread work, and is destoyed on the UI thread. To preserve code clarity, the methods of both PushMessagingMessageFilter and PushMessagingMessageFilterCore remain interleaved in the .cc file, so that each of the flows triggered by incoming messages can be easily traced by reading the methods in order. - PushMessagingMessageFilter::service() was unsafe because it may be called after the Profile is destroyed, in which case the cached PushMessagingService would also have been destroyed. Fixed by removing caching. BUG=459231 Committed: https://crrev.com/3589edc60b2bf8fcd59abafa3a622bce05ecc368 Cr-Commit-Position: refs/heads/master@{#316897}

Patch Set 1 #

Total comments: 22

Patch Set 2 : Rebase #

Patch Set 3 : Add friend class BrowserThread/DeleteHelper #

Patch Set 4 : Addressed bauerb's review comments #

Total comments: 6

Patch Set 5 : Address bauerb's 2nd round review comments #

Patch Set 6 : Rebase #

Patch Set 7 : Fix tests in incognito #

Unified diffs Side-by-side diffs Delta from patch set Stats (+329 lines, -241 lines) Patch
M content/browser/push_messaging/push_messaging_message_filter.h View 1 2 3 4 5 6 5 chunks +36 lines, -69 lines 0 comments Download
M content/browser/push_messaging/push_messaging_message_filter.cc View 1 2 3 4 5 6 20 chunks +293 lines, -172 lines 0 comments Download

Messages

Total messages: 21 (7 generated)
johnme
5 years, 10 months ago (2015-02-17 16:12:44 UTC) #2
Bernhard Bauer
Very nice! https://codereview.chromium.org/933523005/diff/1/content/browser/push_messaging/push_messaging_message_filter.cc File content/browser/push_messaging/push_messaging_message_filter.cc (right): https://codereview.chromium.org/933523005/diff/1/content/browser/push_messaging/push_messaging_message_filter.cc#newcode44 content/browser/push_messaging/push_messaging_message_filter.cc:44: struct RegisterData { (See comment in the ...
5 years, 10 months ago (2015-02-17 16:40:38 UTC) #3
Bernhard Bauer
Another thing I just realized: The PushMessagingMessageFilter is now the only thing that keeps a ...
5 years, 10 months ago (2015-02-17 17:01:24 UTC) #4
johnme
Addressed bauerb@'s review comments - thanks! https://codereview.chromium.org/933523005/diff/1/content/browser/push_messaging/push_messaging_message_filter.cc File content/browser/push_messaging/push_messaging_message_filter.cc (right): https://codereview.chromium.org/933523005/diff/1/content/browser/push_messaging/push_messaging_message_filter.cc#newcode44 content/browser/push_messaging/push_messaging_message_filter.cc:44: struct RegisterData { ...
5 years, 10 months ago (2015-02-17 19:08:53 UTC) #5
Bernhard Bauer
https://codereview.chromium.org/933523005/diff/60001/content/browser/push_messaging/push_messaging_message_filter.cc File content/browser/push_messaging/push_messaging_message_filter.cc (right): https://codereview.chromium.org/933523005/diff/60001/content/browser/push_messaging/push_messaging_message_filter.cc#newcode169 content/browser/push_messaging/push_messaging_message_filter.cc:169: bool PushMessagingMessageFilter::OnMessageReceived(const IPC::Message& message) Break before the parameter declaration, ...
5 years, 10 months ago (2015-02-18 10:27:30 UTC) #6
johnme
Addressed bauerb@'s 2nd round review comments On 2015/02/17 17:01:24, Bernhard Bauer wrote: > Another thing ...
5 years, 10 months ago (2015-02-18 12:50:14 UTC) #7
Bernhard Bauer
LGTM, thanks!
5 years, 10 months ago (2015-02-18 13:26:32 UTC) #8
johnme
Rebase
5 years, 10 months ago (2015-02-18 13:58:54 UTC) #10
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/933523005/100001
5 years, 10 months ago (2015-02-18 13:59:46 UTC) #12
commit-bot: I haz the power
Try jobs failed on following builders: win8_chromium_rel on tryserver.chromium.win (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.win/builders/win8_chromium_rel/builds/55622)
5 years, 10 months ago (2015-02-18 14:46:08 UTC) #14
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/933523005/100001
5 years, 10 months ago (2015-02-18 18:41:24 UTC) #16
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/933523005/120001
5 years, 10 months ago (2015-02-18 20:11:37 UTC) #19
commit-bot: I haz the power
Committed patchset #7 (id:120001)
5 years, 10 months ago (2015-02-18 21:42:14 UTC) #20
commit-bot: I haz the power
5 years, 10 months ago (2015-02-18 21:42:46 UTC) #21
Message was sent while issue was closed.
Patchset 7 (id:??) landed as
https://crrev.com/3589edc60b2bf8fcd59abafa3a622bce05ecc368
Cr-Commit-Position: refs/heads/master@{#316897}

Powered by Google App Engine
This is Rietveld 408576698