Chromium Code Reviews| Index: third_party/WebKit/Source/core/paint/FramePaintTiming.h |
| diff --git a/third_party/WebKit/Source/core/paint/FramePaintTiming.h b/third_party/WebKit/Source/core/paint/FramePaintTiming.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..4e9e1eac3ee16d34d43811c0f1f0c02f8a05267b |
| --- /dev/null |
| +++ b/third_party/WebKit/Source/core/paint/FramePaintTiming.h |
| @@ -0,0 +1,41 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
|
Xianzhu
2017/05/10 23:22:46
Please list this file in Source/core/paint/BUILD.g
Zhen Wang
2017/05/11 20:27:08
Done.
|
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef FramePaintTiming_h |
| +#define FramePaintTiming_h |
| + |
| +#include "core/frame/LocalFrame.h" |
| +#include "core/paint/PaintTiming.h" |
| +#include "platform/graphics/GraphicsContext.h" |
| +#include "platform/graphics/paint/PaintController.h" |
| +#include "platform/heap/Handle.h" |
| + |
| +namespace blink { |
| + |
| +class FramePaintTiming { |
| + STACK_ALLOCATED(); |
| + WTF_MAKE_NONCOPYABLE(FramePaintTiming); |
| + |
| + public: |
| + FramePaintTiming(GraphicsContext& context, const LocalFrame* frame) |
| + : context_(context), frame_(frame) { |
| + context_.GetPaintController().BeginFrame(frame_); |
| + } |
| + |
| + ~FramePaintTiming() { |
| + DCHECK(frame_->GetDocument()); |
| + FrameFirstPaint result = context_.GetPaintController().EndFrame(frame_); |
| + PaintTiming::From(*frame_->GetDocument()) |
| + .NotifyPaint(result.first_painted, result.text_painted, |
| + result.image_painted); |
| + } |
| + |
| + private: |
| + GraphicsContext& context_; |
| + Member<const LocalFrame> frame_; |
| +}; |
| + |
| +} // namespace blink |
| + |
| +#endif // FramePaintTiming_h |