Chromium Code Reviews| 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..5b7e445fc9909de13ab1c02d4c9b262fac6776ac 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,33 @@ void OffscreenCanvasFrameDispatcherImpl::dispatchFrame( |
| frame.delegated_frame_data->render_pass_list.push_back(std::move(pass)); |
| + double elapsedTime = WTF::monotonicallyIncreasingTime() - commitStartTime; |
| + if (commitType == CommitGPUCanvasGPUCompositing) { |
|
Justin Novosad
2016/10/12 21:11:12
Nit: Should use switch/case IMHO
xidachen
2016/10/13 01:39:24
Done.
|
| + DEFINE_STATIC_LOCAL(CustomCountHistogram, |
| + commitGPUCanvasGPUCompositingTimer, |
| + ("Blink.Canvas.OffscreenCommit.GPUCanvasGPUCompositing", |
| + 0, 10000000, 50)); |
|
Justin Novosad
2016/10/12 21:11:12
I think we should double the number of categories
xidachen
2016/10/13 01:39:24
Done.
|
| + commitGPUCanvasGPUCompositingTimer.count(elapsedTime * 1000000.0); |
| + } else if (commitType == CommitGPUCanvasSoftwareCompositing) { |
| + DEFINE_STATIC_LOCAL( |
| + CustomCountHistogram, commitGPUCanvasSoftwareCompositingTimer, |
| + ("Blink.Canvas.OffscreenCommit.GPUCanvasSoftwareCompositing", 0, |
| + 10000000, 50)); |
| + commitGPUCanvasSoftwareCompositingTimer.count(elapsedTime * 1000000.0); |
| + } else if (commitType == CommitSoftwareCanvasGPUCompositing) { |
| + DEFINE_STATIC_LOCAL( |
| + CustomCountHistogram, commitSoftwareCanvasGPUCompositingTimer, |
| + ("Blink.Canvas.OffscreenCommit.SoftwareCanvasGPUCompositing", 0, |
| + 10000000, 50)); |
| + commitSoftwareCanvasGPUCompositingTimer.count(elapsedTime * 1000000.0); |
| + } else { |
| + DEFINE_STATIC_LOCAL( |
| + CustomCountHistogram, commitSoftwareCanvasSoftwareCompositingTimer, |
| + ("Blink.Canvas.OffscreenCommit.SoftwareCanvasSoftwareCompositing", 0, |
| + 10000000, 50)); |
| + commitSoftwareCanvasSoftwareCompositingTimer.count(elapsedTime * 1000000.0); |
| + } |
| + |
| m_sink->SubmitCompositorFrame(std::move(frame), base::Closure()); |
| } |