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

Issue 823703004: Tracking push events for lucid sleep (Closed)

Created:
6 years ago by Chirantan Ekbote
Modified:
5 years, 9 months ago
CC:
chromium-reviews, extensions-reviews_chromium.org, cbentzel+watch_chromium.org, nkostylev+watch_chromium.org, derat+watch_chromium.org, oshima+watch_chromium.org, chromium-apps-reviews_chromium.org, stevenjb+watch_chromium.org, davemoore+watch_chromium.org, Sameer Nanda
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Tracking push events for lucid sleep Phase 2 of lucid sleep involves allowing GCM-enabled apps and extensions to wake up the system to process push messages. This brings up the problem of knowing when those apps/extensions are done processing the event so that the system can go back to sleep. This CL introduces a new class whose responsibility is to monitor GCM-enabled apps and extensions and delay the system suspend while they are processing push messages. Additionally, network requests that are started while the app/extension is processing a push message are considered related to that message and can further delay the system suspend even after the push message itself has been acked by the extension. BUG=397328 Committed: https://crrev.com/79788f68a65e9f99eb23c19fa5ba52d1a52996bf Cr-Commit-Position: refs/heads/master@{#314219}

Patch Set 1 #

Patch Set 2 : Version 2 with NotificationService #

Total comments: 3

Patch Set 3 : Clean up #

Patch Set 4 : Observers are better. Now with tests! #

Total comments: 16

Patch Set 5 : Address comments #

Total comments: 6

Patch Set 6 : Validate message id from ipc #

Total comments: 14

Patch Set 7 : Kill renderer if it sends a bad message id #

Total comments: 7
Unified diffs Side-by-side diffs Delta from patch set Stats (+921 lines, -140 lines) Patch
M chrome/browser/chromeos/chrome_browser_main_chromeos.h View 1 2 3 4 5 2 chunks +0 lines, -2 lines 0 comments Download
M chrome/browser/chromeos/chrome_browser_main_chromeos.cc View 1 2 3 4 5 3 chunks +0 lines, -5 lines 0 comments Download
M chrome/browser/chromeos/net/wake_on_wifi_manager.h View 1 2 3 2 chunks +4 lines, -0 lines 0 comments Download
M chrome/browser/chromeos/net/wake_on_wifi_manager.cc View 1 2 3 4 2 chunks +5 lines, -2 lines 0 comments Download
A chrome/browser/chromeos/power/extension_event_observer.h View 1 2 3 4 1 chunk +136 lines, -0 lines 0 comments Download
A chrome/browser/chromeos/power/extension_event_observer.cc View 1 2 3 4 1 chunk +272 lines, -0 lines 0 comments Download
A chrome/browser/chromeos/power/extension_event_observer_unittest.cc View 1 2 3 4 1 chunk +319 lines, -0 lines 0 comments Download
D chrome/browser/chromeos/power/light_bar.h View 1 2 3 4 5 1 chunk +0 lines, -36 lines 0 comments Download
M chrome/browser/chromeos/power/light_bar.cc View 1 2 1 chunk +0 lines, -60 lines 0 comments Download
M chrome/browser/net/chrome_extensions_network_delegate.cc View 1 2 3 3 chunks +7 lines, -5 lines 0 comments Download
M chrome/chrome_browser_chromeos.gypi View 1 2 3 4 5 6 1 chunk +2 lines, -2 lines 0 comments Download
M chrome/chrome_tests_unit.gypi View 1 2 3 4 5 6 1 chunk +1 line, -0 lines 0 comments Download
M chrome/test/base/testing_profile_manager.cc View 1 2 3 4 5 1 chunk +2 lines, -0 lines 0 comments Download
M extensions/browser/event_router.cc View 1 2 3 4 5 6 4 chunks +35 lines, -17 lines 4 comments Download
M extensions/browser/extension_host.h View 1 2 3 4 5 6 chunks +25 lines, -1 line 0 comments Download
M extensions/browser/extension_host.cc View 1 2 3 4 5 6 4 chunks +44 lines, -1 line 3 comments Download
A extensions/browser/extension_host_observer.h View 1 2 3 1 chunk +43 lines, -0 lines 0 comments Download
M extensions/browser/process_manager.h View 1 2 3 1 chunk +4 lines, -2 lines 0 comments Download
M extensions/browser/process_manager.cc View 1 2 3 2 chunks +12 lines, -4 lines 0 comments Download
M extensions/browser/process_manager_observer.h View 1 2 3 1 chunk +4 lines, -0 lines 0 comments Download
M extensions/common/extension_messages.h View 1 2 3 4 5 1 chunk +1 line, -1 line 0 comments Download
M extensions/extensions.gyp View 1 2 3 4 5 6 1 chunk +1 line, -0 lines 0 comments Download
M extensions/renderer/dispatcher.cc View 1 2 3 4 5 1 chunk +4 lines, -2 lines 0 comments Download

Messages

Total messages: 41 (6 generated)
Chirantan Ekbote
Hi Ken, this is my rough attempt at using the lazy_keepalive_count for extensions to determine ...
6 years ago (2014-12-23 02:37:36 UTC) #2
Ken Rockot(use gerrit already)
Ah, OK. Having a separate count for outstanding GCM events SGTM.
5 years, 11 months ago (2015-01-05 18:40:55 UTC) #3
Chirantan Ekbote
Hi Ken, Here is a rough version 2. I ended up using a NotificationService for ...
5 years, 11 months ago (2015-01-07 22:32:22 UTC) #4
Ken Rockot(use gerrit already)
On 2015/01/07 22:32:22, Chirantan Ekbote wrote: > Hi Ken, > > Here is a rough ...
5 years, 11 months ago (2015-01-07 23:14:26 UTC) #5
Chirantan Ekbote
On 2015/01/07 23:14:26, Ken Rockot wrote: > On 2015/01/07 22:32:22, Chirantan Ekbote wrote: > > ...
5 years, 11 months ago (2015-01-07 23:33:35 UTC) #6
Ken Rockot(use gerrit already)
I think this would be an OK approach. You do have a BrowserContext handle in ...
5 years, 11 months ago (2015-01-08 01:24:02 UTC) #7
Ken Rockot(use gerrit already)
https://codereview.chromium.org/823703004/diff/20001/extensions/browser/event_router.cc File extensions/browser/event_router.cc (right): https://codereview.chromium.org/823703004/diff/20001/extensions/browser/event_router.cc#newcode144 extensions/browser/event_router.cc:144: content::NotificationService::current()->Notify( On 2015/01/08 01:24:02, Ken Rockot wrote: > This ...
5 years, 11 months ago (2015-01-08 01:25:58 UTC) #8
Chirantan Ekbote
On 2015/01/08 01:24:02, Ken Rockot wrote: > I think this would be an OK approach. ...
5 years, 11 months ago (2015-01-08 01:56:07 UTC) #9
Chirantan Ekbote
PTAL. Ken, please review extensions/. Dan, please review chromeos/. Lei, please review chrome/browser/net and chrome/test. ...
5 years, 11 months ago (2015-01-13 23:02:59 UTC) #11
Daniel Erat
lgtm for c/b/chromeos after comments are addressed (approving now since i'll be ooo; please find ...
5 years, 11 months ago (2015-01-13 23:49:10 UTC) #12
Lei Zhang
On 2015/01/13 23:02:59, Chirantan Ekbote wrote: > Lei, please review chrome/browser/net and chrome/test. LGTM
5 years, 11 months ago (2015-01-14 00:05:54 UTC) #13
Ken Rockot(use gerrit already)
lgtm, not sure where the failures are coming from
5 years, 11 months ago (2015-01-14 20:23:01 UTC) #14
Chirantan Ekbote
On 2015/01/14 20:23:01, Ken Rockot wrote: > lgtm, not sure where the failures are coming ...
5 years, 11 months ago (2015-01-14 20:26:05 UTC) #15
Chirantan Ekbote
https://codereview.chromium.org/823703004/diff/60001/chrome/browser/chromeos/power/extension_event_observer.cc File chrome/browser/chromeos/power/extension_event_observer.cc (right): https://codereview.chromium.org/823703004/diff/60001/chrome/browser/chromeos/power/extension_event_observer.cc#newcode68 chrome/browser/chromeos/power/extension_event_observer.cc:68: for (Profile* profile : active_profiles_) { On 2015/01/13 23:49:09, ...
5 years, 11 months ago (2015-01-15 05:06:36 UTC) #16
jln (very slow on Chromium)
https://chromiumcodereview.appspot.com/823703004/diff/80001/extensions/browser/extension_host.cc File extensions/browser/extension_host.cc (right): https://chromiumcodereview.appspot.com/823703004/diff/80001/extensions/browser/extension_host.cc#newcode388 extensions/browser/extension_host.cc:388: FOR_EACH_OBSERVER(ExtensionHostObserver, observer_list_, Would there be a way to validate ...
5 years, 11 months ago (2015-01-15 20:19:11 UTC) #17
Chirantan Ekbote
https://codereview.chromium.org/823703004/diff/80001/extensions/browser/extension_host.cc File extensions/browser/extension_host.cc (right): https://codereview.chromium.org/823703004/diff/80001/extensions/browser/extension_host.cc#newcode388 extensions/browser/extension_host.cc:388: FOR_EACH_OBSERVER(ExtensionHostObserver, observer_list_, On 2015/01/15 20:19:11, jln wrote: > Would ...
5 years, 11 months ago (2015-01-15 21:53:27 UTC) #18
Chirantan Ekbote
https://codereview.chromium.org/823703004/diff/80001/extensions/browser/extension_host.cc File extensions/browser/extension_host.cc (right): https://codereview.chromium.org/823703004/diff/80001/extensions/browser/extension_host.cc#newcode388 extensions/browser/extension_host.cc:388: FOR_EACH_OBSERVER(ExtensionHostObserver, observer_list_, On 2015/01/15 21:53:27, Chirantan Ekbote wrote: > ...
5 years, 11 months ago (2015-01-20 23:55:43 UTC) #19
jln (very slow on Chromium)
https://codereview.chromium.org/823703004/diff/80001/extensions/browser/extension_host.cc File extensions/browser/extension_host.cc (right): https://codereview.chromium.org/823703004/diff/80001/extensions/browser/extension_host.cc#newcode388 extensions/browser/extension_host.cc:388: FOR_EACH_OBSERVER(ExtensionHostObserver, observer_list_, On 2015/01/15 21:53:27, Chirantan Ekbote wrote: > ...
5 years, 11 months ago (2015-01-22 00:16:35 UTC) #20
Chirantan Ekbote
ptal. I added validation for the message id and some comments explaining the potential risk.
5 years, 11 months ago (2015-01-26 22:08:25 UTC) #21
jln (very slow on Chromium)
This looks good, thanks! Could an extension owner (rockot?) please take another look? https://chromiumcodereview.appspot.com/823703004/diff/100001/extensions/browser/extension_host.cc File ...
5 years, 10 months ago (2015-01-28 01:18:28 UTC) #23
Chirantan Ekbote
https://chromiumcodereview.appspot.com/823703004/diff/100001/extensions/browser/extension_host.cc File extensions/browser/extension_host.cc (right): https://chromiumcodereview.appspot.com/823703004/diff/100001/extensions/browser/extension_host.cc#newcode397 extensions/browser/extension_host.cc:397: } On 2015/01/28 01:18:27, jln wrote: > We should ...
5 years, 10 months ago (2015-01-28 22:11:52 UTC) #24
jln (very slow on Chromium)
extensions/common/extension_messages.h lgtm I would love if rockot could take another quick look.
5 years, 10 months ago (2015-01-28 22:18:53 UTC) #25
Ken Rockot(use gerrit already)
lgtm somehow i was dropped from the reviewer list and this CL disappeared from my ...
5 years, 10 months ago (2015-02-02 22:49:46 UTC) #27
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/823703004/120001
5 years, 10 months ago (2015-02-02 23:10:44 UTC) #29
commit-bot: I haz the power
Committed patchset #7 (id:120001)
5 years, 10 months ago (2015-02-02 23:57:57 UTC) #30
commit-bot: I haz the power
Patchset 7 (id:??) landed as https://crrev.com/79788f68a65e9f99eb23c19fa5ba52d1a52996bf Cr-Commit-Position: refs/heads/master@{#314219}
5 years, 10 months ago (2015-02-02 23:58:59 UTC) #31
not at google - send to devlin
This CL was brought to my attention, sorry for this, but I believe it's caused ...
5 years, 9 months ago (2015-02-26 23:24:32 UTC) #33
not at google - send to devlin
https://codereview.chromium.org/823703004/diff/120001/extensions/browser/extension_host.cc File extensions/browser/extension_host.cc (right): https://codereview.chromium.org/823703004/diff/120001/extensions/browser/extension_host.cc#newcode401 extensions/browser/extension_host.cc:401: render_process_host()->ReceivedBadMessage(); Also as I mentioned in the bug, please ...
5 years, 9 months ago (2015-02-26 23:32:36 UTC) #34
Chirantan Ekbote
https://codereview.chromium.org/823703004/diff/100001/extensions/browser/event_router.cc File extensions/browser/event_router.cc (right): https://codereview.chromium.org/823703004/diff/100001/extensions/browser/event_router.cc#newcode126 extensions/browser/event_router.cc:126: g_message_id_lock.Get().Release(); On 2015/02/26 23:24:32, kalman wrote: > It looks ...
5 years, 9 months ago (2015-02-26 23:38:57 UTC) #35
not at google - send to devlin
https://codereview.chromium.org/823703004/diff/100001/extensions/browser/event_router.cc File extensions/browser/event_router.cc (right): https://codereview.chromium.org/823703004/diff/100001/extensions/browser/event_router.cc#newcode135 extensions/browser/event_router.cc:135: args.Set(3, new base::FundamentalValue(message_id)); On 2015/02/26 23:38:57, Chirantan Ekbote wrote: ...
5 years, 9 months ago (2015-02-26 23:52:33 UTC) #36
Chirantan Ekbote
https://codereview.chromium.org/823703004/diff/100001/extensions/browser/event_router.cc File extensions/browser/event_router.cc (right): https://codereview.chromium.org/823703004/diff/100001/extensions/browser/event_router.cc#newcode135 extensions/browser/event_router.cc:135: args.Set(3, new base::FundamentalValue(message_id)); On 2015/02/26 23:52:33, kalman wrote: > ...
5 years, 9 months ago (2015-02-27 00:15:00 UTC) #37
not at google - send to devlin
https://codereview.chromium.org/823703004/diff/100001/extensions/browser/extension_host.cc File extensions/browser/extension_host.cc (right): https://codereview.chromium.org/823703004/diff/100001/extensions/browser/extension_host.cc#newcode221 extensions/browser/extension_host.cc:221: unacked_messages_.insert(message_id); On 2015/02/27 00:15:00, Chirantan Ekbote wrote: > On ...
5 years, 9 months ago (2015-02-27 01:00:50 UTC) #38
not at google - send to devlin
https://codereview.chromium.org/823703004/diff/120001/extensions/browser/event_router.cc File extensions/browser/event_router.cc (right): https://codereview.chromium.org/823703004/diff/120001/extensions/browser/event_router.cc#newcode80 extensions/browser/event_router.cc:80: ProcessManager::Get(context)->GetBackgroundHostForExtension(extension_id); On 2015/02/27 01:00:50, kalman wrote: > This looks ...
5 years, 9 months ago (2015-02-27 01:09:42 UTC) #39
Chirantan Ekbote
https://codereview.chromium.org/823703004/diff/120001/extensions/browser/event_router.cc File extensions/browser/event_router.cc (right): https://codereview.chromium.org/823703004/diff/120001/extensions/browser/event_router.cc#newcode80 extensions/browser/event_router.cc:80: ProcessManager::Get(context)->GetBackgroundHostForExtension(extension_id); On 2015/02/27 01:00:50, kalman wrote: > This looks ...
5 years, 9 months ago (2015-03-02 22:27:31 UTC) #40
not at google - send to devlin
5 years, 9 months ago (2015-03-02 22:38:27 UTC) #41
Message was sent while issue was closed.
https://codereview.chromium.org/823703004/diff/120001/extensions/browser/even...
File extensions/browser/event_router.cc (right):

https://codereview.chromium.org/823703004/diff/120001/extensions/browser/even...
extensions/browser/event_router.cc:80:
ProcessManager::Get(context)->GetBackgroundHostForExtension(extension_id);
> If this is the case then isn't it a bigger concern that an IPC message was
sent
> to an extension that doesn't have a corresponding ExtensionHost?

Correction: corresponding *background* hosts. There are many types of
ExtensionHosts, including background pages. In theory there should always be a
background host active if any other ExtensionHost is active, but I'm not aware
of that being an official invariant.

The odd part about all of this is that a IPC is sent somewhere, then the
notification is sent to the background page.

> I'm a little wary about doing this since we would need to post a task to the
UI
> thread to access the EventRouter for the profile where the event is being
> dispatched, which adds more asynchronous steps to this process.  Even after
> that, we would be invoking the observers on every event dispatch.  The nice
> things about the way things work now is that observers figure out whether they
> care about a particular ExtensionHost when it is created and are then only
> notified when an event for that ExtensionHost is dispatched.

I've paged out this code over the weekend, but I find it weird that an IPC is
sent from one place, then the Ack for that IPC handled in the other. What is the
problem with things being asynchronous?

Powered by Google App Engine
This is Rietveld 408576698