| Index: third_party/WebKit/Source/platform/graphics/OffscreenCanvasFrameDispatcherImpl.cpp
|
| diff --git a/third_party/WebKit/Source/platform/graphics/OffscreenCanvasFrameDispatcherImpl.cpp b/third_party/WebKit/Source/platform/graphics/OffscreenCanvasFrameDispatcherImpl.cpp
|
| index a40cfba6a760d212cfec49a7c99957de551565fc..58a98254728ae45166f81769e0009da05415cf98 100644
|
| --- a/third_party/WebKit/Source/platform/graphics/OffscreenCanvasFrameDispatcherImpl.cpp
|
| +++ b/third_party/WebKit/Source/platform/graphics/OffscreenCanvasFrameDispatcherImpl.cpp
|
| @@ -152,6 +152,7 @@ void OffscreenCanvasFrameDispatcherImpl::
|
|
|
| void OffscreenCanvasFrameDispatcherImpl::dispatchFrame(
|
| RefPtr<StaticBitmapImage> image,
|
| + double commitStartTime,
|
| bool isWebGLSoftwareRendering /* This flag is true when WebGL's commit is
|
| called on SwiftShader. */) {
|
| if (!image)
|
| @@ -182,6 +183,7 @@ void OffscreenCanvasFrameDispatcherImpl::dispatchFrame(
|
| // TODO(crbug.com/646022): making this overlay-able.
|
| resource.is_overlay_candidate = false;
|
|
|
| + OffscreenCanvasCommitType commitType;
|
| DEFINE_THREAD_SAFE_STATIC_LOCAL(
|
| EnumerationHistogram, commitTypeHistogram,
|
| new EnumerationHistogram("OffscreenCanvas.CommitType",
|
| @@ -190,28 +192,29 @@ void OffscreenCanvasFrameDispatcherImpl::dispatchFrame(
|
| if (Platform::current()->isGPUCompositingEnabled() &&
|
| !isWebGLSoftwareRendering) {
|
| // Case 1: both canvas and compositor are gpu accelerated.
|
| - commitTypeHistogram.count(CommitGPUCanvasGPUCompositing);
|
| + commitType = CommitGPUCanvasGPUCompositing;
|
| setTransferableResourceToStaticBitmapImage(resource, image);
|
| } else {
|
| // Case 2: canvas is accelerated but --disable-gpu-compositing is
|
| // specified, or WebGL's commit is called with SwiftShader. The latter
|
| // case is indicated by
|
| // WebGraphicsContext3DProvider::isSoftwareRendering.
|
| - commitTypeHistogram.count(CommitGPUCanvasSoftwareCompositing);
|
| + commitType = CommitGPUCanvasSoftwareCompositing;
|
| setTransferableResourceToSharedBitmap(resource, image);
|
| }
|
| } else {
|
| if (Platform::current()->isGPUCompositingEnabled() &&
|
| !isWebGLSoftwareRendering) {
|
| // Case 3: canvas is not gpu-accelerated, but compositor is
|
| - commitTypeHistogram.count(CommitSoftwareCanvasGPUCompositing);
|
| + commitType = CommitSoftwareCanvasGPUCompositing;
|
| setTransferableResourceToSharedGPUContext(resource, image);
|
| } else {
|
| // Case 4: both canvas and compositor are not gpu accelerated.
|
| - commitTypeHistogram.count(CommitSoftwareCanvasSoftwareCompositing);
|
| + commitType = CommitSoftwareCanvasSoftwareCompositing;
|
| setTransferableResourceToSharedBitmap(resource, image);
|
| }
|
| }
|
| + commitTypeHistogram.count(commitType);
|
|
|
| m_nextResourceId++;
|
| frame.delegated_frame_data->resource_list.push_back(std::move(resource));
|
| @@ -238,6 +241,80 @@ void OffscreenCanvasFrameDispatcherImpl::dispatchFrame(
|
|
|
| frame.delegated_frame_data->render_pass_list.push_back(std::move(pass));
|
|
|
| + double elapsedTime = WTF::monotonicallyIncreasingTime() - commitStartTime;
|
| + switch (commitType) {
|
| + case CommitGPUCanvasGPUCompositing:
|
| + if (isMainThread()) {
|
| + DEFINE_STATIC_LOCAL(
|
| + CustomCountHistogram, commitGPUCanvasGPUCompositingMainTimer,
|
| + ("Blink.Canvas.OffscreenCommit.GPUCanvasGPUCompositingMain", 0,
|
| + 10000000, 50));
|
| + commitGPUCanvasGPUCompositingMainTimer.count(elapsedTime * 1000000.0);
|
| + } else {
|
| + DEFINE_STATIC_LOCAL(
|
| + CustomCountHistogram, commitGPUCanvasGPUCompositingWorkerTimer,
|
| + ("Blink.Canvas.OffscreenCommit.GPUCanvasGPUCompositingWorker", 0,
|
| + 10000000, 50));
|
| + commitGPUCanvasGPUCompositingWorkerTimer.count(elapsedTime * 1000000.0);
|
| + }
|
| + break;
|
| + case CommitGPUCanvasSoftwareCompositing:
|
| + if (isMainThread()) {
|
| + DEFINE_STATIC_LOCAL(
|
| + CustomCountHistogram, commitGPUCanvasSoftwareCompositingMainTimer,
|
| + ("Blink.Canvas.OffscreenCommit.GPUCanvasSoftwareCompositingMain", 0,
|
| + 10000000, 50));
|
| + commitGPUCanvasSoftwareCompositingMainTimer.count(elapsedTime *
|
| + 1000000.0);
|
| + } else {
|
| + DEFINE_STATIC_LOCAL(
|
| + CustomCountHistogram, commitGPUCanvasSoftwareCompositingWorkerTimer,
|
| + ("Blink.Canvas.OffscreenCommit.GPUCanvasSoftwareCompositingWorker",
|
| + 0, 10000000, 50));
|
| + commitGPUCanvasSoftwareCompositingWorkerTimer.count(elapsedTime *
|
| + 1000000.0);
|
| + }
|
| + break;
|
| + case CommitSoftwareCanvasGPUCompositing:
|
| + if (isMainThread()) {
|
| + DEFINE_STATIC_LOCAL(
|
| + CustomCountHistogram, commitSoftwareCanvasGPUCompositingMainTimer,
|
| + ("Blink.Canvas.OffscreenCommit.SoftwareCanvasGPUCompositingMain", 0,
|
| + 10000000, 50));
|
| + commitSoftwareCanvasGPUCompositingMainTimer.count(elapsedTime *
|
| + 1000000.0);
|
| + } else {
|
| + DEFINE_STATIC_LOCAL(
|
| + CustomCountHistogram, commitSoftwareCanvasGPUCompositingWorkerTimer,
|
| + ("Blink.Canvas.OffscreenCommit.SoftwareCanvasGPUCompositingWorker",
|
| + 0, 10000000, 50));
|
| + commitSoftwareCanvasGPUCompositingWorkerTimer.count(elapsedTime *
|
| + 1000000.0);
|
| + }
|
| + break;
|
| + case CommitSoftwareCanvasSoftwareCompositing:
|
| + if (isMainThread()) {
|
| + DEFINE_STATIC_LOCAL(CustomCountHistogram,
|
| + commitSoftwareCanvasSoftwareCompositingMainTimer,
|
| + ("Blink.Canvas.OffscreenCommit."
|
| + "SoftwareCanvasSoftwareCompositingMain",
|
| + 0, 10000000, 50));
|
| + commitSoftwareCanvasSoftwareCompositingMainTimer.count(elapsedTime *
|
| + 1000000.0);
|
| + } else {
|
| + DEFINE_STATIC_LOCAL(CustomCountHistogram,
|
| + commitSoftwareCanvasSoftwareCompositingWorkerTimer,
|
| + ("Blink.Canvas.OffscreenCommit."
|
| + "SoftwareCanvasSoftwareCompositingWorker",
|
| + 0, 10000000, 50));
|
| + commitSoftwareCanvasSoftwareCompositingWorkerTimer.count(elapsedTime *
|
| + 1000000.0);
|
| + }
|
| + break;
|
| + case OffscreenCanvasCommitTypeCount:
|
| + NOTREACHED();
|
| + }
|
| +
|
| m_sink->SubmitCompositorFrame(std::move(frame), base::Closure());
|
| }
|
|
|
|
|