Print stack traces in browser tests when any process crashes, or an assert fires.
[chromium-blink-merge.git] / ui / compositor / paint_recorder.h
blob39a687b75af38cee61c77e119be2d56be154d8f9
1 // Copyright 2015 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.
5 #ifndef UI_COMPOSITOR_PAINT_RECORDER_H_
6 #define UI_COMPOSITOR_PAINT_RECORDER_H_
8 #include "base/macros.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "skia/ext/refptr.h"
11 #include "ui/compositor/compositor_export.h"
12 #include "ui/gfx/canvas.h"
14 namespace cc {
15 class DisplayItemList;
18 namespace gfx {
19 class Canvas;
22 class SkCanvas;
23 class SkPictureRecorder;
25 namespace ui {
26 class PaintCache;
27 class PaintContext;
29 // A class to hide the complexity behind setting up a recording into a
30 // DisplayItem. This is meant to be short-lived within the scope of recording
31 // taking place, the DisplayItem should be removed from the PaintRecorder once
32 // recording is complete and can be cached.
33 class COMPOSITOR_EXPORT PaintRecorder {
34 public:
35 // The |cache| is owned by the caller and must be kept alive while
36 // PaintRecorder is in use. Canvas is bounded by |recording_size|.
37 PaintRecorder(const PaintContext& context,
38 const gfx::Size& recording_size,
39 PaintCache* cache);
40 PaintRecorder(const PaintContext& context, const gfx::Size& recording_size);
41 ~PaintRecorder();
43 // Gets a gfx::Canvas for painting into.
44 gfx::Canvas* canvas() { return &canvas_; }
46 private:
47 const PaintContext& context_;
48 gfx::Canvas canvas_;
49 PaintCache* cache_;
51 DISALLOW_COPY_AND_ASSIGN(PaintRecorder);
54 } // namespace ui
56 #endif // UI_COMPOSITOR_PAINT_RECORDER_H_