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

Issue 23694031: Fix race conditions in window snapshot code. (Closed)

Created:
7 years, 3 months ago by Ken Russell (switch to Gerrit)
Modified:
6 years, 11 months ago
CC:
chromium-reviews, chrome-speed-team+watch_google.com, yusukes+watch_chromium.org, penghuang+watch_chromium.org, apatrick_chromium, telemetry+watch_chromium.org, joi+watch-content_chromium.org, nona+watch_chromium.org, darin-cc_chromium.org, piman+watch_chromium.org, cc-bugs_chromium.org, James Su, miu+watch_chromium.org
Visibility:
Public.

Description

Fix race conditions in window snapshot code. Use LatencyInfo to track when a rendered frame reaches the screen. Only tested so far on Linux with single-threaded compositor. Must be tested with Telemetry's GpuTabTest.testScreenshot test on all of Windows, Mac and Linux with the compositor disabled, enabled and single-threaded, and enabled and multi-threaded. BUG=256848 Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=228652

Patch Set 1 #

Total comments: 3

Patch Set 2 : Incorporated enne and jbauman's feedback. #

Total comments: 1

Patch Set 3 : Addressing further feedback, added stress test for snapshots #

Total comments: 4

Patch Set 4 : Added screenshot sync test to telemetry unittests, updated cc unittest #

Total comments: 7

Patch Set 5 : Updated unittest again, attempted to address feedback from jamesr@ #

Total comments: 1

Patch Set 6 : Fixed int64 -> base::processId nit #

Patch Set 7 : Updated Screenshot sync test to match actual browser behavior #

Patch Set 8 : Rebase #

Patch Set 9 : Made software compositing path call CompositorFrameDrawn asynchronously #

Total comments: 1

Patch Set 10 : Addressed Nit #

Unified diffs Side-by-side diffs Delta from patch set Stats (+466 lines, -67 lines) Patch
M cc/test/layer_tree_test.h View 1 2 3 4 5 6 7 2 chunks +2 lines, -0 lines 0 comments Download
M cc/test/layer_tree_test.cc View 1 2 3 4 5 6 7 2 chunks +14 lines, -0 lines 0 comments Download
M cc/trees/layer_tree_host.h View 1 2 3 4 5 6 7 8 2 chunks +3 lines, -0 lines 0 comments Download
M cc/trees/layer_tree_host.cc View 1 2 3 4 5 6 7 8 3 chunks +12 lines, -1 line 0 comments Download
M cc/trees/layer_tree_host_unittest.cc View 1 2 3 4 5 6 7 1 chunk +93 lines, -0 lines 0 comments Download
M cc/trees/layer_tree_impl.h View 1 2 3 4 5 2 chunks +4 lines, -0 lines 0 comments Download
M cc/trees/layer_tree_impl.cc View 1 2 3 4 5 6 7 8 2 chunks +7 lines, -1 line 0 comments Download
M content/browser/aura/software_browser_compositor_output_surface.cc View 1 2 3 4 5 6 7 8 9 2 chunks +7 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 1 chunk +2 lines, -0 lines 0 comments Download
M content/browser/renderer_host/render_view_host_impl.h View 1 2 3 4 5 1 chunk +0 lines, -1 line 0 comments Download
M content/browser/renderer_host/render_view_host_impl.cc View 1 2 3 4 5 3 chunks +0 lines, -25 lines 0 comments Download
M content/browser/renderer_host/render_widget_host_impl.h View 1 2 3 4 5 6 7 8 1 chunk +2 lines, -0 lines 0 comments Download
M content/browser/renderer_host/render_widget_host_impl.cc View 1 2 3 4 5 6 7 8 5 chunks +52 lines, -10 lines 0 comments Download
M content/browser/renderer_host/render_widget_host_view_gtk.cc View 1 2 3 4 5 6 7 8 2 chunks +2 lines, -2 lines 0 comments Download
M content/common/view_messages.h View 1 2 3 4 5 6 7 2 chunks +5 lines, -4 lines 0 comments Download
M content/renderer/gpu/render_widget_compositor.h View 1 2 3 4 5 6 7 8 1 chunk +3 lines, -0 lines 0 comments Download
M content/renderer/gpu/render_widget_compositor.cc View 1 2 3 4 5 6 7 8 1 chunk +5 lines, -0 lines 0 comments Download
M content/renderer/render_thread_impl.h View 1 2 3 4 5 4 chunks +9 lines, -0 lines 0 comments Download
M content/renderer/render_thread_impl.cc View 1 2 3 4 5 4 chunks +11 lines, -0 lines 0 comments Download
M content/renderer/render_view_impl.h View 1 2 3 4 5 1 chunk +3 lines, -0 lines 0 comments Download
M content/renderer/render_view_impl.cc View 1 2 3 4 5 6 7 8 4 chunks +30 lines, -5 lines 0 comments Download
M content/renderer/render_widget.h View 1 2 3 4 5 2 chunks +4 lines, -0 lines 0 comments Download
M content/renderer/render_widget.cc View 1 2 3 4 5 6 7 8 2 chunks +29 lines, -12 lines 0 comments Download
M tools/telemetry/telemetry/core/tab_unittest.py View 1 2 3 4 5 6 4 chunks +19 lines, -5 lines 0 comments Download
A tools/telemetry/unittest_data/screenshot_sync.html View 1 2 3 4 5 6 1 chunk +145 lines, -0 lines 0 comments Download
M ui/events/latency_info.h View 1 2 3 4 5 6 7 8 1 chunk +3 lines, -0 lines 0 comments Download

Messages

Total messages: 46 (0 generated)
Ken Russell (switch to Gerrit)
Brandon/Mo, hoping you may be able to take over this work while I'm traveling this ...
7 years, 3 months ago (2013-09-10 02:55:00 UTC) #1
Zhenyao Mo
Enne, Nat, John, please take a look and provide some feedback before I move forward ...
7 years, 3 months ago (2013-09-11 17:08:05 UTC) #2
enne (OOO)
https://codereview.chromium.org/23694031/diff/1/cc/trees/thread_proxy.cc File cc/trees/thread_proxy.cc (right): https://codereview.chromium.org/23694031/diff/1/cc/trees/thread_proxy.cc#newcode517 cc/trees/thread_proxy.cc:517: void ThreadProxy::SetNextCommitForcesRedraw() { This isn't going to work. This ...
7 years, 3 months ago (2013-09-11 17:42:42 UTC) #3
jbauman
The latency info stuff mostly looks good, but just a couple of comments. https://codereview.chromium.org/23694031/diff/1/content/browser/renderer_host/render_widget_host_impl.cc File ...
7 years, 3 months ago (2013-09-13 22:33:24 UTC) #4
bajones
@enne, @jbauman: I've picked this code up from Ken and addressed your feedback. Please take ...
7 years, 3 months ago (2013-09-19 23:45:44 UTC) #5
bajones
@enne, @jbauman: Review ping?
7 years, 3 months ago (2013-09-20 23:34:45 UTC) #6
Ken Russell (switch to Gerrit)
This LGTM, but what kind of testing has been done? It needs to be tested ...
7 years, 3 months ago (2013-09-21 02:15:38 UTC) #7
jbauman
On 2013/09/20 23:34:45, bajones wrote: > @enne, @jbauman: Review ping? I can't see any response ...
7 years, 3 months ago (2013-09-21 02:18:13 UTC) #8
enne (OOO)
cc/ ⓛⓖⓣⓜ as soon as you add a layer_tree_host_unittest for this new conditional https://codereview.chromium.org/23694031/diff/8001/content/renderer/gpu/render_widget_compositor.cc File ...
7 years, 2 months ago (2013-09-24 17:22:25 UTC) #9
enne (OOO)
Er, s/new conditional/new flag/
7 years, 2 months ago (2013-09-24 17:23:26 UTC) #10
bajones
Apologies for the delay getting this updated! https://codereview.chromium.org/23694031/diff/21001/cc/trees/layer_tree_host_unittest.cc File cc/trees/layer_tree_host_unittest.cc (right): https://codereview.chromium.org/23694031/diff/21001/cc/trees/layer_tree_host_unittest.cc#newcode639 cc/trees/layer_tree_host_unittest.cc:639: class LayerTreeHostTestSetNextCommitForcesRedraw ...
7 years, 2 months ago (2013-09-26 22:27:22 UTC) #11
jbauman
lgtm
7 years, 2 months ago (2013-09-27 00:39:21 UTC) #12
enne (OOO)
https://codereview.chromium.org/23694031/diff/21001/cc/trees/layer_tree_host_unittest.cc File cc/trees/layer_tree_host_unittest.cc (right): https://codereview.chromium.org/23694031/diff/21001/cc/trees/layer_tree_host_unittest.cc#newcode670 cc/trees/layer_tree_host_unittest.cc:670: virtual void DrawLayersOnThread(LayerTreeHostImpl* host_impl) OVERRIDE { This test is ...
7 years, 2 months ago (2013-09-27 19:59:07 UTC) #13
bajones
https://codereview.chromium.org/23694031/diff/29001/cc/trees/layer_tree_host_unittest.cc File cc/trees/layer_tree_host_unittest.cc (right): https://codereview.chromium.org/23694031/diff/29001/cc/trees/layer_tree_host_unittest.cc#newcode640 cc/trees/layer_tree_host_unittest.cc:640: public: @enne: Is this what you had in mind? ...
7 years, 2 months ago (2013-09-27 20:50:10 UTC) #14
Ken Russell (switch to Gerrit)
LGTM https://codereview.chromium.org/23694031/diff/29001/tools/telemetry/telemetry/core/tab_unittest.py File tools/telemetry/telemetry/core/tab_unittest.py (right): https://codereview.chromium.org/23694031/diff/29001/tools/telemetry/telemetry/core/tab_unittest.py#newcode77 tools/telemetry/telemetry/core/tab_unittest.py:77: def testScreenshotSync(self): On 2013/09/27 20:50:11, bajones wrote: > ...
7 years, 2 months ago (2013-09-27 22:42:38 UTC) #15
bajones
enne@: ping? cevans@: Please review changes in content/common jamesr@: Please review changes in content/renderer ben@: ...
7 years, 2 months ago (2013-10-01 18:43:00 UTC) #16
enne (OOO)
https://codereview.chromium.org/23694031/diff/29001/cc/trees/layer_tree_host_unittest.cc File cc/trees/layer_tree_host_unittest.cc (right): https://codereview.chromium.org/23694031/diff/29001/cc/trees/layer_tree_host_unittest.cc#newcode677 cc/trees/layer_tree_host_unittest.cc:677: // Cycle through a couple of empty commits to ...
7 years, 2 months ago (2013-10-01 19:15:29 UTC) #17
Ben Goodger (Google)
ui/events lgtm
7 years, 2 months ago (2013-10-01 23:15:23 UTC) #18
jamesr
It looks like something's very amiss with the data flow required to use ui::LatencyInfo. The ...
7 years, 2 months ago (2013-10-01 23:42:13 UTC) #19
jbauman
On 2013/10/01 23:42:13, jamesr wrote: > It looks like something's very amiss with the data ...
7 years, 2 months ago (2013-10-01 23:49:27 UTC) #20
jamesr
Somehow this message is getting from the RenderWidget to the RenderWidgetHostImpl, so we're definitely routing ...
7 years, 2 months ago (2013-10-01 23:54:51 UTC) #21
jbauman
On 2013/10/01 23:54:51, jamesr wrote: > Somehow this message is getting from the RenderWidget to ...
7 years, 2 months ago (2013-10-01 23:57:56 UTC) #22
jamesr
https://codereview.chromium.org/23694031/diff/29001/content/renderer/gpu/render_widget_compositor.h File content/renderer/gpu/render_widget_compositor.h (right): https://codereview.chromium.org/23694031/diff/29001/content/renderer/gpu/render_widget_compositor.h#newcode58 content/renderer/gpu/render_widget_compositor.h:58: // any early-outs. is this the same as SetNeedsRedrawRect(...)? ...
7 years, 2 months ago (2013-10-02 00:06:40 UTC) #23
bajones
Updated. Thanks @enne for the help with the unit tests!
7 years, 2 months ago (2013-10-03 22:10:33 UTC) #24
enne (OOO)
cc/ lgtm. Thanks for making the unit test be more targeted.
7 years, 2 months ago (2013-10-03 23:18:38 UTC) #25
bajones
nduca@ or dtu@: Quick review of the Telemetry changes, please? cevans@, cdn@, jn@: Need a ...
7 years, 2 months ago (2013-10-04 21:43:49 UTC) #26
dtu
telemetry lgtm
7 years, 2 months ago (2013-10-04 23:57:41 UTC) #27
jln (very slow on Chromium)
content/common/view_messages.h lgtm with mandatory nit.
7 years, 2 months ago (2013-10-07 18:25:12 UTC) #28
jln (very slow on Chromium)
Err, forgot to send the nit in question https://codereview.chromium.org/23694031/diff/57001/content/common/view_messages.h File content/common/view_messages.h (right): https://codereview.chromium.org/23694031/diff/57001/content/common/view_messages.h#newcode812 content/common/view_messages.h:812: int64 ...
7 years, 2 months ago (2013-10-07 18:25:41 UTC) #29
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/kbr@chromium.org/23694031/67001
7 years, 2 months ago (2013-10-08 23:24:42 UTC) #30
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/kbr@chromium.org/23694031/67001
7 years, 2 months ago (2013-10-09 02:06:57 UTC) #31
commit-bot: I haz the power
Retried try job too often on win_rel for step(s) telemetry_unittests http://build.chromium.org/p/tryserver.chromium/buildstatus?builder=win_rel&number=206834
7 years, 2 months ago (2013-10-09 05:34:50 UTC) #32
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/kbr@chromium.org/23694031/95001
7 years, 2 months ago (2013-10-10 22:39:07 UTC) #33
commit-bot: I haz the power
Retried try job too often on win_rel for step(s) telemetry_unittests http://build.chromium.org/p/tryserver.chromium/buildstatus?builder=win_rel&number=207562
7 years, 2 months ago (2013-10-11 01:47:11 UTC) #34
bajones
@piman, @danakj: Added some changes to SoftwareBrowserCompositorOutputSurface in the latest revision. I'd appreciate your input. ...
7 years, 2 months ago (2013-10-14 23:42:33 UTC) #35
piman
Seems reasonable, given that if this was on the compositor thread, we'd have to post ...
7 years, 2 months ago (2013-10-15 00:12:13 UTC) #36
jbauman
On 2013/10/15 00:12:13, piman wrote: > Seems reasonable, given that if this was on the ...
7 years, 2 months ago (2013-10-15 00:19:28 UTC) #37
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/kbr@chromium.org/23694031/144001
7 years, 2 months ago (2013-10-15 06:01:28 UTC) #38
commit-bot: I haz the power
Change committed as 228652
7 years, 2 months ago (2013-10-15 08:24:58 UTC) #39
jam
I just saw this change. There's a big issue here: we have by design never ...
6 years, 11 months ago (2014-01-09 23:42:09 UTC) #40
bajones
On 2014/01/09 23:42:09, jam wrote: > I just saw this change. > > There's a ...
6 years, 11 months ago (2014-01-10 00:11:37 UTC) #41
enne (OOO)
On 2014/01/10 00:11:37, bajones wrote: > enne@, @danakj: You've been doing some work in this ...
6 years, 11 months ago (2014-01-10 00:14:40 UTC) #42
bajones
On 2014/01/10 00:14:40, enne wrote: > On 2014/01/10 00:11:37, bajones wrote: > > > enne@, ...
6 years, 11 months ago (2014-01-10 00:16:02 UTC) #43
Ken Russell (switch to Gerrit)
On 2014/01/09 23:42:09, jam wrote: > I just saw this change. > > There's a ...
6 years, 11 months ago (2014-01-10 00:20:16 UTC) #44
jam
On 2014/01/10 00:20:16, Ken Russell wrote: > On 2014/01/09 23:42:09, jam wrote: > > I ...
6 years, 11 months ago (2014-01-10 00:24:27 UTC) #45
jamesr
6 years, 11 months ago (2014-01-10 00:37:59 UTC) #46
Message was sent while issue was closed.
This is all vague stuff, I don't have a good concrete suggestion for this patch.

My recollection of the issue here is that the code wants a way to receive a
notification in the browser process when a specific renderer's frame is
presented.  The frame is sent to the GPU process, where it's associated with a
surface, and then a notification is sent to the browser process.  In the browser
process, depending on which graphics configuration we're in, there may or may
not be a clear mapping from data on the notification (like the surface id) back
to the original renderer that sent the frame.

To get around this, this patch sticks the renderer's PID into a ui::LatencyInfo
object - which is effectively a hashmap of strings to ints - which is carried
along the frame data back to the browser process.  Then in the browser process a
static function parses out the PID and maps that back to the render host.

IMO, while there are many channels and indirections involved here between
renderer->gpu->browser process we are already plumbing enough data through to
correctly identify which renderer a given frame is for - since we obviously
present it in the correct place - and should be able to correlate this
notification as well with the existing data.  I think it's worrying when we
decide to tack additional data that's technically redundant with existing
mechanisms.  This leads really easily to an explosion where every subsystem
throws extra data in that's only useful for that subsystem because the things
the other subsystems do is too complicated to reuse.

Powered by Google App Engine
This is Rietveld 408576698