Fix OOP <webview> resize and autosize.
[chromium-blink-merge.git] / ui / ozone / demo / software_renderer.h
blobdcb4645988224588876222c26b7b4d091913cff9
1 // Copyright 2014 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_OZONE_DEMO_SOFTWARE_RENDERER_H_
6 #define UI_OZONE_DEMO_SOFTWARE_RENDERER_H_
8 #include "base/macros.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "base/memory/weak_ptr.h"
11 #include "base/timer/timer.h"
12 #include "ui/ozone/demo/renderer_base.h"
14 namespace gfx {
15 class VSyncProvider;
16 } // namespace gfx
18 namespace ui {
20 class SurfaceOzoneCanvas;
22 class SoftwareRenderer : public RendererBase {
23 public:
24 SoftwareRenderer(gfx::AcceleratedWidget widget, const gfx::Size& size);
25 ~SoftwareRenderer() override;
27 // Renderer:
28 bool Initialize() override;
30 private:
31 void RenderFrame();
33 void UpdateVSyncParameters(const base::TimeTicks timebase,
34 const base::TimeDelta interval);
36 scoped_ptr<SurfaceOzoneCanvas> software_surface_;
38 scoped_ptr<gfx::VSyncProvider> vsync_provider_;
40 // Timer for animation.
41 base::RepeatingTimer<SoftwareRenderer> timer_;
43 base::TimeDelta vsync_period_;
45 base::WeakPtrFactory<SoftwareRenderer> weak_ptr_factory_;
47 DISALLOW_COPY_AND_ASSIGN(SoftwareRenderer);
50 } // namespace ui
52 #endif // UI_OZONE_DEMO_SOFTWARE_RENDERER_H_