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

Issue 2710823003: NOCOMMIT prototype: GRC service plumbing and process priority

Created:
3 years, 10 months ago by oystein (OOO til 10th of July)
Modified:
3 years, 6 months ago
CC:
chromium-reviews
Target Ref:
refs/heads/master
Project:
chromium
Visibility:
Public.

Description

Global Resource Controller NOTE: This CL is just a prototype and shouldn't actually land; it needs to be split up and have tests added, after feedback. GRC parent doc (internal only): https://docs.google.com/document/d/1dx4KDbDFvP-GWwwrSPg8Gxx4kboIoPi8kDKTSXoTbC4/edit#heading=h.td4yhfm12fe3 This CL depends on https://codereview.chromium.org/2798713002 This thing should theoretically improve https://bugs.chromium.org/p/chromium/issues/detail?id=693054 once the kinks are worked out, by lowering process priority for background tabs even before they've started painting. Quick design tl;dr: The basic Mojo interface is a CoordinationUnit. This can be created by the browser process through a CoordinationUnitInterface, and can be duplicated on demand from other processes (there's an example in the CL of Blink hooking up to the frame-level CoordinationUnit). It can be used to send events through (currently just basic enums with no args), and can be used to set a callback if the client of the CoordinationUnit is interested in receiving resource policy updates (as shown by RenderProcessHostImpl, which receives a should_background policy). There's CoordinationUnits hooked up to three different levels in this CL: * WebContents-level * Process-level * Frame-level (Both Blink and browser-side; this is currently unused by the prototype but there for demonstration purposes). There's also a ResourceCoordinatorInterface helper class included, which wraps around the CoordinationUnit for easier usage, and has functionality to set up parent/child relationships between different units. CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_site_isolation

Patch Set 1 #

Patch Set 2 : WIP #

Patch Set 3 : WIP #

Patch Set 4 : WIP #

Patch Set 5 : WIP #

Patch Set 6 : WIP #

Patch Set 7 : Docs #

Patch Set 8 : Formatting #

Patch Set 9 : WIP #

Patch Set 10 : Rebase #

Patch Set 11 : WIP #

Patch Set 12 : WIP #

Patch Set 13 : WIP #

Patch Set 14 : WIP #

Patch Set 15 : WIP #

Patch Set 16 : WIP #

Patch Set 17 : WIP #

Patch Set 18 : WIP #

Patch Set 19 : Renamed FrameInterface to CoordinationUnit #

Patch Set 20 : Buildfixes #

Total comments: 3

Patch Set 21 : Formatting #

Patch Set 22 : Redundant includes #

Total comments: 4

Patch Set 23 : Rebase #

Patch Set 24 : Fixed ServiceRef propagation #

Patch Set 25 : rebase #

Patch Set 26 : Basic unittests #

Patch Set 27 : WIP #

Patch Set 28 : Refactorings #

Patch Set 29 : struct_traits for IDs and event types #

Patch Set 30 : WIP tests #

Patch Set 31 : First version done #

Patch Set 32 : Rebased on first CL #

Patch Set 33 : Rebase #

Patch Set 34 : Rebase #

Patch Set 35 : Rebase #

Patch Set 36 : Rebase #

Patch Set 37 : Rebase #

Patch Set 38 : Rebase #

Patch Set 39 : Rebase #

Patch Set 40 : Fixed bad merge leftovers #

Patch Set 41 : Rebase #

Unified diffs Side-by-side diffs Delta from patch set Stats (+224 lines, -18 lines) Patch
M chrome/browser/resource_coordinator/resource_coordinator_web_contents_observer.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 1 chunk +4 lines, -0 lines 0 comments Download
M chrome/browser/resource_coordinator/resource_coordinator_web_contents_observer.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 2 chunks +25 lines, -0 lines 0 comments Download
M content/browser/frame_host/render_frame_host_impl.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 3 chunks +6 lines, -0 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 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 4 chunks +24 lines, -0 lines 0 comments Download
M content/browser/renderer_host/render_process_host_impl.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 6 chunks +15 lines, -1 line 0 comments Download
M content/browser/renderer_host/render_process_host_impl.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 9 chunks +46 lines, -15 lines 0 comments Download
M content/public/app/mojo/content_browser_manifest.json View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 2 chunks +1 line, -1 line 0 comments Download
M content/public/browser/render_frame_host.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 2 chunks +7 lines, -0 lines 0 comments Download
M content/public/browser/render_process_host.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 2 chunks +8 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/frame/LocalFrame.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 3 chunks +5 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/frame/LocalFrame.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 3 chunks +5 lines, -1 line 0 comments Download
M third_party/WebKit/Source/platform/BUILD.gn View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 2 chunks +3 lines, -0 lines 0 comments Download
A third_party/WebKit/Source/platform/instrumentation/resource_coordinator/FrameResourceCoordinator.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 1 chunk +34 lines, -0 lines 0 comments Download
A third_party/WebKit/Source/platform/instrumentation/resource_coordinator/FrameResourceCoordinator.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 1 chunk +41 lines, -0 lines 0 comments Download

Messages

Total messages: 17 (12 generated)
oystein (OOO til 10th of July)
rockot: Has prototype. Unsure if remotely sane. Plx advice.
3 years, 9 months ago (2017-03-15 20:47:41 UTC) #5
Ken Rockot(use gerrit already)
Looks pretty good overall https://codereview.chromium.org/2710823003/diff/380001/services/resource_coordinator/public/interfaces/coordination_unit.mojom File services/resource_coordinator/public/interfaces/coordination_unit.mojom (right): https://codereview.chromium.org/2710823003/diff/380001/services/resource_coordinator/public/interfaces/coordination_unit.mojom#newcode35 services/resource_coordinator/public/interfaces/coordination_unit.mojom:35: AddChild(CoordinationUnitID child_id); I haven't fully ...
3 years, 9 months ago (2017-03-15 22:51:55 UTC) #9
oystein (OOO til 10th of July)
Thanks!! https://codereview.chromium.org/2710823003/diff/380001/services/resource_coordinator/public/interfaces/coordination_unit.mojom File services/resource_coordinator/public/interfaces/coordination_unit.mojom (right): https://codereview.chromium.org/2710823003/diff/380001/services/resource_coordinator/public/interfaces/coordination_unit.mojom#newcode35 services/resource_coordinator/public/interfaces/coordination_unit.mojom:35: AddChild(CoordinationUnitID child_id); On 2017/03/15 at 22:51:55, Ken Rockot ...
3 years, 9 months ago (2017-03-15 23:12:24 UTC) #10
r52537455
Actually i dont have any idea about the GRC service plumbing and process priority.Now i ...
3 years, 9 months ago (2017-03-22 12:39:11 UTC) #12
Sami
3 years, 9 months ago (2017-03-22 13:51:43 UTC) #14
I think this looks great! Left a few miscellaneous comments -- I'll reply to the
thread too.

https://codereview.chromium.org/2710823003/diff/420001/content/browser/render...
File content/browser/renderer_host/render_process_host_impl.cc (right):

https://codereview.chromium.org/2710823003/diff/420001/content/browser/render...
content/browser/renderer_host/render_process_host_impl.cc:1580:
resource_coordinator::mojom::EventType::ON_PROCESS_AUDIO_STARTED);
N.B. This notification is fine for what you're doing but in case it's useful
there's a separate audibility state that only triggers when the tab is playing
non-silent audio:
https://cs.chromium.org/chromium/src/content/browser/web_contents/web_content...
(we use this for policy decisions in the Blink scheduler)

https://codereview.chromium.org/2710823003/diff/420001/content/browser/render...
content/browser/renderer_host/render_process_host_impl.cc:2837: void
RenderProcessHostImpl::SetPolicy(
What's the latency of these updates? This is all in the browser so it should be
fairly low, but I assume there's still a task hop, right?

https://codereview.chromium.org/2710823003/diff/420001/services/resource_coor...
File services/resource_coordinator/coordination_unit.cc (right):

https://codereview.chromium.org/2710823003/diff/420001/services/resource_coor...
services/resource_coordinator/coordination_unit.cc:80: else if
(current_policy_->use_background_priority == background_priority)
I'm not sure how to enforce it, but we should probably encourage clients to
avoid sending redundant events if they can avoid it.

https://codereview.chromium.org/2710823003/diff/420001/services/resource_coor...
File services/resource_coordinator/public/cpp/resource_coordinator_interface.cc
(right):

https://codereview.chromium.org/2710823003/diff/420001/services/resource_coor...
services/resource_coordinator/public/cpp/resource_coordinator_interface.cc:28:
static int next_id = 0;
Do we need some locking here? I assume we'd eventually want to be able to access
the resource coordinator from any thread.

Powered by Google App Engine
This is Rietveld 408576698