Commit 52a0bdcd authored by junov's avatar junov Committed by Commit bot

Add trace events corresponding to OffscreenCanvas overhead

BUG=716091

Review-Url: https://codereview.chromium.org/2851573002
Cr-Commit-Position: refs/heads/master@{#468012}
parent 3c2131cd
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
#include "platform/graphics/OffscreenCanvasFrameDispatcherImpl.h" #include "platform/graphics/OffscreenCanvasFrameDispatcherImpl.h"
#include "platform/graphics/StaticBitmapImage.h" #include "platform/graphics/StaticBitmapImage.h"
#include "platform/image-encoders/ImageEncoderUtils.h" #include "platform/image-encoders/ImageEncoderUtils.h"
#include "platform/instrumentation/tracing/TraceEvent.h"
#include "platform/wtf/MathExtras.h" #include "platform/wtf/MathExtras.h"
#include "public/platform/Platform.h" #include "public/platform/Platform.h"
#include "third_party/skia/include/core/SkSurface.h" #include "third_party/skia/include/core/SkSurface.h"
...@@ -240,6 +241,8 @@ ScriptPromise OffscreenCanvas::Commit(RefPtr<StaticBitmapImage> image, ...@@ -240,6 +241,8 @@ ScriptPromise OffscreenCanvas::Commit(RefPtr<StaticBitmapImage> image,
bool is_web_gl_software_rendering, bool is_web_gl_software_rendering,
ScriptState* script_state, ScriptState* script_state,
ExceptionState& exception_state) { ExceptionState& exception_state) {
TRACE_EVENT0("blink", "OffscreenCanvas::Commit");
if (!HasPlaceholderCanvas()) { if (!HasPlaceholderCanvas()) {
exception_state.ThrowDOMException( exception_state.ThrowDOMException(
kInvalidStateError, kInvalidStateError,
...@@ -286,12 +289,14 @@ void OffscreenCanvas::FinalizeFrame() { ...@@ -286,12 +289,14 @@ void OffscreenCanvas::FinalizeFrame() {
void OffscreenCanvas::DoCommit(RefPtr<StaticBitmapImage> image, void OffscreenCanvas::DoCommit(RefPtr<StaticBitmapImage> image,
bool is_web_gl_software_rendering) { bool is_web_gl_software_rendering) {
TRACE_EVENT0("blink", "OffscreenCanvas::DoCommit");
double commit_start_time = WTF::MonotonicallyIncreasingTime(); double commit_start_time = WTF::MonotonicallyIncreasingTime();
GetOrCreateFrameDispatcher()->DispatchFrame( GetOrCreateFrameDispatcher()->DispatchFrame(
std::move(image), commit_start_time, is_web_gl_software_rendering); std::move(image), commit_start_time, is_web_gl_software_rendering);
} }
void OffscreenCanvas::BeginFrame() { void OffscreenCanvas::BeginFrame() {
TRACE_EVENT0("blink", "OffscreenCanvas::BeginFrame");
if (current_frame_) { if (current_frame_) {
// TODO(eseckler): beginFrame() shouldn't be used as confirmation of // TODO(eseckler): beginFrame() shouldn't be used as confirmation of
// CompositorFrame activation. // CompositorFrame activation.
...@@ -304,6 +309,7 @@ void OffscreenCanvas::BeginFrame() { ...@@ -304,6 +309,7 @@ void OffscreenCanvas::BeginFrame() {
} else if (commit_promise_resolver_) { } else if (commit_promise_resolver_) {
commit_promise_resolver_->Resolve(); commit_promise_resolver_->Resolve();
commit_promise_resolver_.Clear(); commit_promise_resolver_.Clear();
// We need to tell parent frame to stop sending signals on begin frame to // We need to tell parent frame to stop sending signals on begin frame to
// avoid overhead once we resolve the promise. // avoid overhead once we resolve the promise.
GetOrCreateFrameDispatcher()->SetNeedsBeginFrame(false); GetOrCreateFrameDispatcher()->SetNeedsBeginFrame(false);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment