Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(13)

Side by Side Diff: ui/compositor/paint_recorder.h

Issue 1124223010: ui: Eliminate allocating gfx::Canvas on the heap for every view. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: canvasstack: fixcompile Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef UI_COMPOSITOR_PAINT_RECORDER_H_ 5 #ifndef UI_COMPOSITOR_PAINT_RECORDER_H_
6 #define UI_COMPOSITOR_PAINT_RECORDER_H_ 6 #define UI_COMPOSITOR_PAINT_RECORDER_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "skia/ext/refptr.h" 10 #include "skia/ext/refptr.h"
11 #include "ui/compositor/compositor_export.h" 11 #include "ui/compositor/compositor_export.h"
12 #include "ui/gfx/canvas.h"
12 13
13 namespace cc { 14 namespace cc {
14 class DisplayItemList; 15 class DisplayItemList;
15 } 16 }
16 17
17 namespace gfx { 18 namespace gfx {
18 class Canvas; 19 class Canvas;
19 } 20 }
20 21
21 class SkCanvas; 22 class SkCanvas;
(...skipping 13 matching lines...) Expand all
35 // PaintRecorder is in use. 36 // PaintRecorder is in use.
36 PaintRecorder(const PaintContext& context, PaintCache* cache); 37 PaintRecorder(const PaintContext& context, PaintCache* cache);
37 explicit PaintRecorder(const PaintContext& context); 38 explicit PaintRecorder(const PaintContext& context);
38 ~PaintRecorder(); 39 ~PaintRecorder();
39 40
40 // Gets a gfx::Canvas for painting into. 41 // Gets a gfx::Canvas for painting into.
41 gfx::Canvas* canvas() { return canvas_; } 42 gfx::Canvas* canvas() { return canvas_; }
42 43
43 private: 44 private:
44 const PaintContext& context_; 45 const PaintContext& context_;
46 gfx::Canvas owned_canvas_;
45 gfx::Canvas* canvas_; 47 gfx::Canvas* canvas_;
46 scoped_ptr<gfx::Canvas> owned_canvas_;
47 PaintCache* cache_; 48 PaintCache* cache_;
48 49
49 DISALLOW_COPY_AND_ASSIGN(PaintRecorder); 50 DISALLOW_COPY_AND_ASSIGN(PaintRecorder);
50 }; 51 };
51 52
52 } // namespace ui 53 } // namespace ui
53 54
54 #endif // UI_COMPOSITOR_PAINT_RECORDER_H_ 55 #endif // UI_COMPOSITOR_PAINT_RECORDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698