Separate Simple Backend creation from initialization.
[chromium-blink-merge.git] / cc / output / delegating_renderer.h
bloba1bac0e0e6445c2d3bb0e05c87411d480196aec9
1 // Copyright 2012 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 CC_OUTPUT_DELEGATING_RENDERER_H_
6 #define CC_OUTPUT_DELEGATING_RENDERER_H_
8 #include "base/memory/scoped_ptr.h"
9 #include "cc/base/cc_export.h"
10 #include "cc/output/renderer.h"
11 #include "third_party/WebKit/Source/Platform/chromium/public/WebGraphicsContext3D.h"
13 namespace cc {
15 class OutputSurface;
16 class ResourceProvider;
18 class CC_EXPORT DelegatingRenderer
19 : public Renderer,
20 public NON_EXPORTED_BASE(
21 WebKit::WebGraphicsContext3D::WebGraphicsContextLostCallback) {
22 public:
23 static scoped_ptr<DelegatingRenderer> Create(
24 RendererClient* client,
25 OutputSurface* output_surface,
26 ResourceProvider* resource_provider);
27 virtual ~DelegatingRenderer();
29 virtual const RendererCapabilities& Capabilities() const OVERRIDE;
31 virtual void DrawFrame(RenderPassList* render_passes_in_draw_order) OVERRIDE;
33 virtual void Finish() OVERRIDE {}
35 virtual bool SwapBuffers() OVERRIDE;
37 virtual void GetFramebufferPixels(void* pixels, gfx::Rect rect) OVERRIDE;
39 virtual void ReceiveCompositorFrameAck(const CompositorFrameAck&) OVERRIDE;
41 virtual bool IsContextLost() OVERRIDE;
43 virtual void SetVisible(bool visible) OVERRIDE;
45 virtual void SendManagedMemoryStats(size_t bytes_visible,
46 size_t bytes_visible_and_nearby,
47 size_t bytes_allocated) OVERRIDE {}
49 // WebGraphicsContext3D::WebGraphicsContextLostCallback implementation.
50 virtual void onContextLost() OVERRIDE;
52 private:
53 DelegatingRenderer(RendererClient* client,
54 OutputSurface* output_surface,
55 ResourceProvider* resource_provider);
56 bool Initialize();
58 OutputSurface* output_surface_;
59 ResourceProvider* resource_provider_;
60 RendererCapabilities capabilities_;
61 bool visible_;
63 DISALLOW_COPY_AND_ASSIGN(DelegatingRenderer);
66 } // namespace cc
68 #endif // CC_OUTPUT_DELEGATING_RENDERER_H_