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_DELEGATING_RENDERER_H_ | 5 #ifndef CC_DELEGATING_RENDERER_H_ |
6 #define CC_DELEGATING_RENDERER_H_ | 6 #define CC_DELEGATING_RENDERER_H_ |
7 | 7 |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "cc/cc_export.h" | 9 #include "cc/cc_export.h" |
10 #include "cc/renderer.h" | 10 #include "cc/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 { | 20 { |
23 public: | 21 public: |
24 static scoped_ptr<DelegatingRenderer> Create( | 22 static scoped_ptr<DelegatingRenderer> Create( |
25 RendererClient* client, | 23 RendererClient* client, |
26 OutputSurface* output_surface, | 24 OutputSurface* output_surface, |
27 ResourceProvider* resource_provider); | 25 ResourceProvider* resource_provider); |
28 virtual ~DelegatingRenderer(); | 26 virtual ~DelegatingRenderer(); |
29 | 27 |
30 virtual const RendererCapabilities& Capabilities() const OVERRIDE; | 28 virtual const RendererCapabilities& Capabilities() const OVERRIDE; |
31 | 29 |
32 virtual void DrawFrame(RenderPassList& render_passes_in_draw_order) OVERRIDE; | 30 virtual void DrawFrame(RenderPassList& render_passes_in_draw_order) OVERRIDE; |
33 | 31 |
34 virtual void Finish() OVERRIDE {} | 32 virtual void Finish() OVERRIDE {} |
35 | 33 |
36 virtual bool SwapBuffers() OVERRIDE; | 34 virtual bool SwapBuffers() OVERRIDE; |
37 | 35 |
38 virtual void GetFramebufferPixels(void* pixels, gfx::Rect rect) OVERRIDE; | 36 virtual void GetFramebufferPixels(void* pixels, gfx::Rect rect) OVERRIDE; |
39 | 37 |
40 virtual void ReceiveCompositorFrameAck(const CompositorFrameAck&) OVERRIDE; | 38 virtual void ReceiveCompositorFrameAck(const CompositorFrameAck&) OVERRIDE; |
41 | 39 |
42 virtual bool IsContextLost() OVERRIDE; | 40 virtual bool IsContextLost() OVERRIDE; |
43 | 41 |
44 virtual void SetVisible(bool) OVERRIDE; | 42 virtual void SetVisible(bool) OVERRIDE; |
45 | 43 |
46 virtual void SendManagedMemoryStats(size_t bytes_visible, | 44 virtual void SendManagedMemoryStats(size_t bytes_visible, |
47 size_t bytes_visible_and_nearby, | 45 size_t bytes_visible_and_nearby, |
48 size_t bytes_allocated) OVERRIDE {} | 46 size_t bytes_allocated) OVERRIDE {} |
49 | 47 |
50 // WebGraphicsContext3D::WebGraphicsContextLostCallback implementation. | |
51 virtual void onContextLost() OVERRIDE; | |
52 | |
53 private: | 48 private: |
54 DelegatingRenderer(RendererClient* client, | 49 DelegatingRenderer(RendererClient* client, |
55 OutputSurface* output_surface, | 50 OutputSurface* output_surface, |
56 ResourceProvider* resource_provider); | 51 ResourceProvider* resource_provider); |
57 bool Initialize(); | 52 bool Initialize(); |
58 | 53 |
59 OutputSurface* output_surface_; | 54 OutputSurface* output_surface_; |
60 ResourceProvider* resource_provider_; | 55 ResourceProvider* resource_provider_; |
61 RendererCapabilities capabilities_; | 56 RendererCapabilities capabilities_; |
62 bool visible_; | 57 bool visible_; |
63 | 58 |
64 DISALLOW_COPY_AND_ASSIGN(DelegatingRenderer); | 59 DISALLOW_COPY_AND_ASSIGN(DelegatingRenderer); |
65 }; | 60 }; |
66 | 61 |
67 } // namespace cc | 62 } // namespace cc |
68 | 63 |
69 #endif // CC_DELEGATING_RENDERER_H_ | 64 #endif // CC_DELEGATING_RENDERER_H_ |
OLD | NEW |