ui: Eliminate allocating gfx::Canvas on the heap for every view.
commit8fa739b657b48f54ee96e2187158570101623f94
authordanakj <danakj@chromium.org>
Tue, 12 May 2015 02:10:06 +0000 (11 19:10 -0700)
committerCommit bot <commit-bot@chromium.org>
Tue, 12 May 2015 02:11:00 +0000 (12 02:11 +0000)
tree5ebb82d9c6837f34e4f302dd642bf225d2b8fcfb
parentc811ac094d2d64f85989a19d5743c324c49e1e3a
ui: Eliminate allocating gfx::Canvas on the heap for every view.

PaintRecorder needs to present a gfx::Canvas instead of an SkCanvas.
Currently it does so via CreateCanvasWithoutScaling which returns
a new Canvas allocated on the heap. But mallocs are terrible, so
instead make it a constructor and have the canvas allocated as part
of ui::PaintRecorder on the stack.

This changes the time to record a single tab loading spinner from
0.138818 ms to 0.124487 ms per frame for a 10% reduction in time.

R=sky
BUG=466426

Review URL: https://codereview.chromium.org/1124223010

Cr-Commit-Position: refs/heads/master@{#329315}
ui/compositor/layer.cc
ui/compositor/paint_recorder.cc
ui/compositor/paint_recorder.h
ui/gfx/canvas.cc
ui/gfx/canvas.h
ui/gfx/render_text_unittest.cc
ui/native_theme/common_theme.cc
ui/views/view.cc