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

Issue 2843353003: Move ownership of PowerSaveBlocker from WakeLockServiceContext to WakeLockServiceImpl (Closed)

Created:
3 years, 7 months ago by ke.he
Modified:
3 years, 7 months ago
CC:
Aaron Boodman, abarth-chromium, chromium-reviews, creis+watch_chromium.org, darin (slow to review), darin-cc_chromium.org, jam, nasko+codewatch_chromium.org, qsr+mojo_chromium.org, viettrungluu+watch_chromium.org, yzshen+watch_chromium.org
Target Ref:
refs/heads/master
Project:
chromium
Visibility:
Public.

Description

Move ownership of PowerSaveBlocker from WakeLockServiceContext to WakeLockServiceImpl This is the first step of "Allowing WakeLock to Serve Browser Process Clients" Design doc by blundell@chromium.org: https://docs.google.com/document/d/1AEmiwtEj1nfTCmqSneht0xad2k3huxZQsIRHvVz0S8c In this CL: 1) Move ownership of PowerSaveBlocker from WakeLockServiceContext to WakeLockServiceImpl. 2) Refactor WakeLockServiceImpl, one WakeLockServiceImpl supports managing multiple client bindings. 3) Make WebContentsImpl coalesce multiple client requests into one WakeLockServiceImpl. The concrete motivation for this move is to make it trivial to implement a generalization of the GetWakeLock() API that passes in the parameters for the PowerSaveBlocker (needed by browser process clients). That interface extension would be complex to implement in the current architecture, which is multiplexing one PowerSaveBlocker for multiple WakeLockServiceImpl instances. BUG=689410 CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_site_isolation Review-Url: https://codereview.chromium.org/2843353003 Cr-Commit-Position: refs/heads/master@{#470241} Committed: https://chromium.googlesource.com/chromium/src/+/98b761e7e4ffdfa7344bd3de7e3203d2bec235f0

Patch Set 1 #

Patch Set 2 : android gn fix #

Patch Set 3 : webkit_unit_tests pass #

Patch Set 4 : error fix, non-frame client. #

Total comments: 16

Patch Set 5 : 1)Use bindingset manage all bindings. 2)Move test interface from WakeLockContext to WakeLockService. #

Patch Set 6 : code rebase #

Patch Set 7 : Allowing WakeLock to Serve Browser Process Clients #

Patch Set 8 : seperate this CL into 2CLs #

Total comments: 14

Patch Set 9 : RemoveBinding() and |binding_ids| are not necessary in WakeLockServiceImpl. #

Patch Set 10 : Use std::unique_ptr<bool> as the context of bindingSet. #

Patch Set 11 : correct some trivial #includes #

Total comments: 17

Patch Set 12 : Addressed Colin's comments. #

Patch Set 13 : Move ownership of PowerSaveBlocker from WakeLockServiceContext to WakeLockServiceImpl #

Total comments: 6

Patch Set 14 : Addressed Ken's comments. #

Patch Set 15 : code rebase #

Total comments: 3
Unified diffs Side-by-side diffs Delta from patch set Stats (+231 lines, -179 lines) Patch
M content/browser/frame_host/render_frame_host_delegate.h View 1 2 3 4 3 chunks +3 lines, -6 lines 0 comments Download
M content/browser/frame_host/render_frame_host_delegate.cc View 1 2 3 4 1 chunk +1 line, -2 lines 0 comments Download
M content/browser/frame_host/render_frame_host_impl.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 chunk +4 lines, -4 lines 0 comments Download
M content/browser/wake_lock/wake_lock_browsertest.cc View 1 2 3 4 1 chunk +3 lines, -3 lines 0 comments Download
M content/browser/web_contents/web_contents_impl.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 3 chunks +5 lines, -2 lines 0 comments Download
M content/browser/web_contents/web_contents_impl.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 chunk +15 lines, -1 line 0 comments Download
M content/public/browser/BUILD.gn View 1 2 1 chunk +1 line, -0 lines 0 comments Download
M content/public/browser/DEPS View 1 chunk +1 line, -0 lines 0 comments Download
M content/public/browser/web_contents.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 2 chunks +9 lines, -0 lines 0 comments Download
M device/wake_lock/DEPS View 1 chunk +1 line, -0 lines 0 comments Download
M device/wake_lock/public/interfaces/wake_lock_context.mojom View 1 2 3 4 5 6 7 1 chunk +0 lines, -4 lines 0 comments Download
M device/wake_lock/public/interfaces/wake_lock_service.mojom View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +17 lines, -0 lines 0 comments Download
M device/wake_lock/wake_lock_context_provider.cc View 1 2 3 4 5 6 7 8 1 chunk +4 lines, -4 lines 0 comments Download
M device/wake_lock/wake_lock_service_context.h View 1 2 3 4 5 6 7 8 9 10 1 chunk +2 lines, -51 lines 0 comments Download
M device/wake_lock/wake_lock_service_context.cc View 1 2 3 4 5 6 7 8 9 10 1 chunk +11 lines, -84 lines 0 comments Download
M device/wake_lock/wake_lock_service_impl.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +46 lines, -7 lines 0 comments Download
M device/wake_lock/wake_lock_service_impl.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +104 lines, -11 lines 3 comments Download
M third_party/WebKit/Source/web/tests/ScreenWakeLockTest.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 chunk +4 lines, -0 lines 0 comments Download

Messages

Total messages: 98 (69 generated)
ke.he
Hi, Colin, thanks very much for your help:) This is the core refactoring part. PTAL.
3 years, 7 months ago (2017-04-27 09:30:29 UTC) #16
ke.he
Sorry, errors are found in https://codereview.chromium.org/2846813002/ I should fix that error first. Sorry.
3 years, 7 months ago (2017-04-27 09:48:36 UTC) #17
ke.he
Hi, Colin, PTAL. Thanks :)
3 years, 7 months ago (2017-04-28 11:06:13 UTC) #22
blundell
Hi Ke He, This is a great start! This CL is necessarily pretty complex and ...
3 years, 7 months ago (2017-05-02 11:27:43 UTC) #23
ke.he
https://codereview.chromium.org/2843353003/diff/60001/device/wake_lock/wake_lock_service_impl.h File device/wake_lock/wake_lock_service_impl.h (right): https://codereview.chromium.org/2843353003/diff/60001/device/wake_lock/wake_lock_service_impl.h#newcode76 device/wake_lock/wake_lock_service_impl.h:76: mojo::BindingSet<mojom::WakeLockService, int> frames_binding_set_; On 2017/05/02 11:27:43, blundell wrote: > ...
3 years, 7 months ago (2017-05-03 06:25:37 UTC) #24
blundell
https://codereview.chromium.org/2843353003/diff/60001/device/wake_lock/wake_lock_service_impl.h File device/wake_lock/wake_lock_service_impl.h (right): https://codereview.chromium.org/2843353003/diff/60001/device/wake_lock/wake_lock_service_impl.h#newcode76 device/wake_lock/wake_lock_service_impl.h:76: mojo::BindingSet<mojom::WakeLockService, int> frames_binding_set_; On 2017/05/03 06:25:37, ke.he wrote: > ...
3 years, 7 months ago (2017-05-03 09:13:13 UTC) #25
ke.he
On 2017/05/03 09:13:13, blundell wrote: > https://codereview.chromium.org/2843353003/diff/60001/device/wake_lock/wake_lock_service_impl.h > File device/wake_lock/wake_lock_service_impl.h (right): > > https://codereview.chromium.org/2843353003/diff/60001/device/wake_lock/wake_lock_service_impl.h#newcode76 > ...
3 years, 7 months ago (2017-05-03 10:29:00 UTC) #26
blundell
On 2017/05/03 10:29:00, ke.he wrote: > On 2017/05/03 09:13:13, blundell wrote: > > > https://codereview.chromium.org/2843353003/diff/60001/device/wake_lock/wake_lock_service_impl.h ...
3 years, 7 months ago (2017-05-03 10:30:59 UTC) #27
ke.he
On 2017/05/03 10:30:59, blundell wrote: > On 2017/05/03 10:29:00, ke.he wrote: > > On 2017/05/03 ...
3 years, 7 months ago (2017-05-03 10:44:05 UTC) #28
ke.he
Colin, I split the "Generalize mojo interface" part out of this CL. PTAL. Thanks! https://codereview.chromium.org/2843353003/diff/60001/content/browser/frame_host/render_frame_host_delegate.h ...
3 years, 7 months ago (2017-05-04 11:54:14 UTC) #45
blundell
This is looking great! Thanks for all your hard work here! In addition to the ...
3 years, 7 months ago (2017-05-04 15:40:50 UTC) #46
ke.he
Colin, Thanks very much! CL is updated, PTAL. https://codereview.chromium.org/2843353003/diff/140001/content/browser/web_contents/web_contents_impl.cc File content/browser/web_contents/web_contents_impl.cc (right): https://codereview.chromium.org/2843353003/diff/140001/content/browser/web_contents/web_contents_impl.cc#newcode2620 content/browser/web_contents/web_contents_impl.cc:2620: if ...
3 years, 7 months ago (2017-05-05 08:58:01 UTC) #53
blundell
Looks great! Just a few more minor things. https://codereview.chromium.org/2843353003/diff/200001/device/wake_lock/public/interfaces/wake_lock_service.mojom File device/wake_lock/public/interfaces/wake_lock_service.mojom (right): https://codereview.chromium.org/2843353003/diff/200001/device/wake_lock/public/interfaces/wake_lock_service.mojom#newcode9 device/wake_lock/public/interfaces/wake_lock_service.mojom:9: // ...
3 years, 7 months ago (2017-05-05 12:49:38 UTC) #57
ke.he
Hi, Colin, Thanks very much for your help! PTAL:) https://codereview.chromium.org/2843353003/diff/200001/device/wake_lock/public/interfaces/wake_lock_service.mojom File device/wake_lock/public/interfaces/wake_lock_service.mojom (right): https://codereview.chromium.org/2843353003/diff/200001/device/wake_lock/public/interfaces/wake_lock_service.mojom#newcode9 device/wake_lock/public/interfaces/wake_lock_service.mojom:9: ...
3 years, 7 months ago (2017-05-05 14:56:36 UTC) #60
blundell
LGTM, thanks! +rockot@ for //device OWNERS +jam@ for //content OWNERS +tsepez@ for mojom changes https://codereview.chromium.org/2843353003/diff/240001/device/wake_lock/wake_lock_service_impl.cc ...
3 years, 7 months ago (2017-05-05 16:28:04 UTC) #64
Tom Sepez
lgtm
3 years, 7 months ago (2017-05-05 17:03:48 UTC) #67
Ken Rockot(use gerrit already)
device lgtm https://codereview.chromium.org/2843353003/diff/240001/device/wake_lock/public/interfaces/wake_lock_service.mojom File device/wake_lock/public/interfaces/wake_lock_service.mojom (right): https://codereview.chromium.org/2843353003/diff/240001/device/wake_lock/public/interfaces/wake_lock_service.mojom#newcode14 device/wake_lock/public/interfaces/wake_lock_service.mojom:14: // Cancels any outstanding wake lock request ...
3 years, 7 months ago (2017-05-05 17:55:31 UTC) #68
ke.he
Jam@, PTAL on the //content. Haraken@, PTAL on the "third_party/WebKit/Source/web/tests/ScreenWakeLockTest.cpp" Thanks all! https://codereview.chromium.org/2843353003/diff/240001/device/wake_lock/public/interfaces/wake_lock_service.mojom File device/wake_lock/public/interfaces/wake_lock_service.mojom ...
3 years, 7 months ago (2017-05-06 03:08:44 UTC) #78
haraken
WebKit LGTM
3 years, 7 months ago (2017-05-06 14:26:50 UTC) #79
jam
lgtm
3 years, 7 months ago (2017-05-08 15:10:46 UTC) #80
commit-bot: I haz the power
CQ is trying da patch. Follow status at: https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2843353003/260001
3 years, 7 months ago (2017-05-09 01:37:14 UTC) #83
commit-bot: I haz the power
Try jobs failed on following builders: android_clang_dbg_recipe on master.tryserver.chromium.android (JOB_FAILED, https://build.chromium.org/p/tryserver.chromium.android/builders/android_clang_dbg_recipe/builds/264383) android_compile_dbg on master.tryserver.chromium.android (JOB_FAILED, ...
3 years, 7 months ago (2017-05-09 01:46:11 UTC) #85
commit-bot: I haz the power
CQ is trying da patch. Follow status at: https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2843353003/280001
3 years, 7 months ago (2017-05-09 02:29:11 UTC) #88
commit-bot: I haz the power
Try jobs failed on following builders: win_chromium_x64_rel_ng on master.tryserver.chromium.win (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.win/builders/win_chromium_x64_rel_ng/builds/421475)
3 years, 7 months ago (2017-05-09 02:37:05 UTC) #90
commit-bot: I haz the power
CQ is trying da patch. Follow status at: https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2843353003/280001
3 years, 7 months ago (2017-05-09 03:42:29 UTC) #92
commit-bot: I haz the power
Committed patchset #15 (id:280001) as https://chromium.googlesource.com/chromium/src/+/98b761e7e4ffdfa7344bd3de7e3203d2bec235f0
3 years, 7 months ago (2017-05-09 05:59:33 UTC) #95
blundell
some final nits that I just saw for a followup. Thanks! https://codereview.chromium.org/2843353003/diff/280001/device/wake_lock/wake_lock_service_impl.cc File device/wake_lock/wake_lock_service_impl.cc (right): ...
3 years, 7 months ago (2017-05-09 08:22:43 UTC) #96
blundell
some final nits that I just saw for a followup. Thanks! https://codereview.chromium.org/2843353003/diff/280001/device/wake_lock/wake_lock_service_impl.cc File device/wake_lock/wake_lock_service_impl.cc (right): ...
3 years, 7 months ago (2017-05-09 08:22:44 UTC) #97
ke.he
3 years, 7 months ago (2017-05-09 08:52:28 UTC) #98
Message was sent while issue was closed.
On 2017/05/09 08:22:44, blundell wrote:
> some final nits that I just saw for a followup. Thanks!
> 
>
https://codereview.chromium.org/2843353003/diff/280001/device/wake_lock/wake_...
> File device/wake_lock/wake_lock_service_impl.cc (right):
> 
>
https://codereview.chromium.org/2843353003/diff/280001/device/wake_lock/wake_...
> device/wake_lock/wake_lock_service_impl.cc:66: if (num_lock_requests_ > 0) {
> This can be a DCHECK instead of an if statement, right? You've just verified
> above that at least one client (this one) has an outstanding request.
> 
>
https://codereview.chromium.org/2843353003/diff/280001/device/wake_lock/wake_...
> device/wake_lock/wake_lock_service_impl.cc:115:
> DCHECK(binding_set_.dispatch_context());
> We don't need this: It's a basic property of BindingSet that this DCHECK will
be
> true here, and the proper place to check it would be in tests of BindingSet
> itself. I think it's more confusing to the reader to have it here than not.
> 
>
https://codereview.chromium.org/2843353003/diff/280001/device/wake_lock/wake_...
> device/wake_lock/wake_lock_service_impl.cc:124: // If |binding_set_| is empty,
> WakeLockServiceImpl should delele itself.
> delete

Colin, I'll correct them soon, thanks!

Powered by Google App Engine
This is Rietveld 408576698