New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 812134 link

Starred by 1 user

Issue metadata

Status: Available
Owner: ----
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 2
Type: Bug



Sign in to add a comment

Unify screenshot mechanisms

Project Member Reported by sadrul@chromium.org, Feb 14 2018

Issue description

There seems to be two ways to get a screenshot of a page:

 . RenderWidgetHostView::CopyFromSurface [1]
 . RenderWidgetHostImpl::GetSnapshotFromBrowser [2]

My understanding is [1] is the better way of doing it.

[2] is only used for devtools ([3, 4]), both for implementing page.captureScreenshot api [5].

Can we update [3] and [4] to use [1] instead?

Assigning to miu@ to verify this makes sense.

/cc dgozman@ from devtools.

[1] https://cs.chromium.org/chromium/src/content/public/browser/render_widget_host_view.h?sq=package:chromium&dr=CSs&l=188
[2] https://cs.chromium.org/chromium/src/content/browser/renderer_host/render_widget_host_impl.cc?l=1583
[3] https://cs.chromium.org/chromium/src/content/browser/devtools/protocol/page_handler.cc?l=516
[4] https://cs.chromium.org/chromium/src/content/browser/devtools/protocol/page_handler.cc?l=612
[5] https://cs.chromium.org/chromium/src/third_party/WebKit/Source/core/inspector/browser_protocol.pdl?l=4447
 
Cc: kbr@chromium.org
GetSnapshotFromBrowser was historically a mechanism to get what's actually rendered vs some intermediate surface inside. It is used by gpu team, for example, to test the rendering. +kbr@ for this.

Comment 2 by samans@chromium.org, Feb 14 2018

I filed a similar bug last week.  crbug.com/810037 

kbr's response:

"Yes, for end-to-end pixel tests in Chrome it is absolutely necessary to use OS-level screenshot mechanisms, and to know when the requested frame has reached the screen.

Various Telemetry-based pixel tests that run on the GPU bots rely on this working. There is also a new SnapshotBrowserTest which attempts to stress test this mechanism. Simply deleting the sequence number from LatencyInfo causes one of these tests to reliably fail."

Comment 3 by m...@chromium.org, May 19 2018

I took a look and I think, currently, there is no longer a use case for GetSnapshotFromBrowser(). All call points from tests use "true" for its 2nd argument, which means that it is getting the capture from the surface (CopyOutputRequests), and not the OS directly. That makes it functionally identical to the CopyOutputRequests (sans API differences).

That said, GetSnapshotFromBrowser() does one thing extra: It forces the renderer to redraw with a specific LatencyInfo. It appears this is what's allowing tests to correlate a snapshot in a specific sequence-of-operations.

So, I propose we remove GetSnapshotFromBrowser() from RenderWidgetHostImpl, and replace it with a standalone utility function in src/content/test or thereabouts. It's basically a performance test utility. I don't see that CopyOutputRequests wouldn't satisfy any normal, non-test browser screen capture scenario, including the DevTools ones. Sound good?
Components: -Platform>DevTools Internals>Media>ScreenCapture
Owner: ----
Status: Available (was: Assigned)

Sign in to add a comment