OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 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 | 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 CC_OUTPUT_DELEGATING_RENDERER_H_ | 5 #ifndef CC_OUTPUT_DELEGATING_RENDERER_H_ |
6 #define CC_OUTPUT_DELEGATING_RENDERER_H_ | 6 #define CC_OUTPUT_DELEGATING_RENDERER_H_ |
7 | 7 |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "cc/base/cc_export.h" | 9 #include "cc/base/cc_export.h" |
10 #include "cc/output/renderer.h" | 10 #include "cc/output/renderer.h" |
11 #include "third_party/WebKit/Source/Platform/chromium/public/WebGraphicsContext3
D.h" | 11 #include "third_party/WebKit/Source/Platform/chromium/public/WebGraphicsContext3
D.h" |
12 | 12 |
13 namespace cc { | 13 namespace cc { |
14 | 14 |
15 class OutputSurface; | 15 class OutputSurface; |
16 class ResourceProvider; | 16 class ResourceProvider; |
17 | 17 |
18 class CC_EXPORT DelegatingRenderer | 18 class CC_EXPORT DelegatingRenderer : |
19 : public Renderer, | 19 public Renderer { |
20 public NON_EXPORTED_BASE( | |
21 WebKit::WebGraphicsContext3D::WebGraphicsContextLostCallback) { | |
22 public: | 20 public: |
23 static scoped_ptr<DelegatingRenderer> Create( | 21 static scoped_ptr<DelegatingRenderer> Create( |
24 RendererClient* client, | 22 RendererClient* client, |
25 OutputSurface* output_surface, | 23 OutputSurface* output_surface, |
26 ResourceProvider* resource_provider); | 24 ResourceProvider* resource_provider); |
27 virtual ~DelegatingRenderer(); | 25 virtual ~DelegatingRenderer(); |
28 | 26 |
29 virtual const RendererCapabilities& Capabilities() const OVERRIDE; | 27 virtual const RendererCapabilities& Capabilities() const OVERRIDE; |
30 | 28 |
31 virtual void DrawFrame(RenderPassList* render_passes_in_draw_order) OVERRIDE; | 29 virtual void DrawFrame(RenderPassList* render_passes_in_draw_order) OVERRIDE; |
32 | 30 |
33 virtual void Finish() OVERRIDE {} | 31 virtual void Finish() OVERRIDE {} |
34 | 32 |
35 virtual bool SwapBuffers() OVERRIDE; | 33 virtual bool SwapBuffers() OVERRIDE; |
36 | 34 |
37 virtual void GetFramebufferPixels(void* pixels, gfx::Rect rect) OVERRIDE; | 35 virtual void GetFramebufferPixels(void* pixels, gfx::Rect rect) OVERRIDE; |
38 | 36 |
39 virtual void ReceiveCompositorFrameAck(const CompositorFrameAck&) OVERRIDE; | 37 virtual void ReceiveCompositorFrameAck(const CompositorFrameAck&) OVERRIDE; |
40 | 38 |
41 virtual bool IsContextLost() OVERRIDE; | 39 virtual bool IsContextLost() OVERRIDE; |
42 | 40 |
43 virtual void SetVisible(bool visible) OVERRIDE; | 41 virtual void SetVisible(bool visible) OVERRIDE; |
44 | 42 |
45 virtual void SendManagedMemoryStats(size_t bytes_visible, | 43 virtual void SendManagedMemoryStats(size_t bytes_visible, |
46 size_t bytes_visible_and_nearby, | 44 size_t bytes_visible_and_nearby, |
47 size_t bytes_allocated) OVERRIDE {} | 45 size_t bytes_allocated) OVERRIDE {} |
48 | 46 |
49 // WebGraphicsContext3D::WebGraphicsContextLostCallback implementation. | |
50 virtual void onContextLost() OVERRIDE; | |
51 | |
52 private: | 47 private: |
53 DelegatingRenderer(RendererClient* client, | 48 DelegatingRenderer(RendererClient* client, |
54 OutputSurface* output_surface, | 49 OutputSurface* output_surface, |
55 ResourceProvider* resource_provider); | 50 ResourceProvider* resource_provider); |
56 bool Initialize(); | 51 bool Initialize(); |
57 | 52 |
58 OutputSurface* output_surface_; | 53 OutputSurface* output_surface_; |
59 ResourceProvider* resource_provider_; | 54 ResourceProvider* resource_provider_; |
60 RendererCapabilities capabilities_; | 55 RendererCapabilities capabilities_; |
61 bool visible_; | 56 bool visible_; |
62 | 57 |
63 DISALLOW_COPY_AND_ASSIGN(DelegatingRenderer); | 58 DISALLOW_COPY_AND_ASSIGN(DelegatingRenderer); |
64 }; | 59 }; |
65 | 60 |
66 } // namespace cc | 61 } // namespace cc |
67 | 62 |
68 #endif // CC_OUTPUT_DELEGATING_RENDERER_H_ | 63 #endif // CC_OUTPUT_DELEGATING_RENDERER_H_ |
OLD | NEW |