OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef FramePaintTiming_h |
| 6 #define FramePaintTiming_h |
| 7 |
| 8 #include "core/frame/LocalFrame.h" |
| 9 #include "core/paint/PaintTiming.h" |
| 10 #include "platform/graphics/GraphicsContext.h" |
| 11 #include "platform/graphics/paint/PaintController.h" |
| 12 #include "platform/heap/Handle.h" |
| 13 |
| 14 namespace blink { |
| 15 |
| 16 class FramePaintTiming { |
| 17 STACK_ALLOCATED(); |
| 18 WTF_MAKE_NONCOPYABLE(FramePaintTiming); |
| 19 |
| 20 public: |
| 21 FramePaintTiming(GraphicsContext& context, const LocalFrame* frame) |
| 22 : context_(context), frame_(frame) { |
| 23 context_.GetPaintController().BeginFrame(frame_); |
| 24 } |
| 25 |
| 26 ~FramePaintTiming() { |
| 27 DCHECK(frame_->GetDocument()); |
| 28 FrameFirstPaint result = context_.GetPaintController().EndFrame(frame_); |
| 29 PaintTiming::From(*frame_->GetDocument()) |
| 30 .NotifyPaint(result.first_painted, result.text_painted, |
| 31 result.image_painted); |
| 32 } |
| 33 |
| 34 private: |
| 35 GraphicsContext& context_; |
| 36 Member<const LocalFrame> frame_; |
| 37 }; |
| 38 |
| 39 } // namespace blink |
| 40 |
| 41 #endif // FramePaintTiming_h |
OLD | NEW |