OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 #include "base/memory/scoped_ptr.h" | 5 #include "base/memory/scoped_ptr.h" |
6 | 6 |
7 #include "cc/layers/delegated_frame_resource_collection.h" | |
8 #include "cc/layers/delegated_renderer_layer.h" | |
9 #include "cc/output/output_surface_client.h" | 7 #include "cc/output/output_surface_client.h" |
| 8 #include "cc/output/renderer.h" |
10 #include "cc/surfaces/surface_aggregator.h" | 9 #include "cc/surfaces/surface_aggregator.h" |
11 #include "cc/surfaces/surface_client.h" | 10 #include "cc/surfaces/surface_client.h" |
12 #include "cc/surfaces/surfaces_export.h" | 11 #include "cc/surfaces/surfaces_export.h" |
13 #include "cc/trees/layer_tree_host_client.h" | |
14 #include "cc/trees/layer_tree_host_single_thread_client.h" | |
15 | 12 |
16 namespace gfx { | 13 namespace gfx { |
17 class Size; | 14 class Size; |
18 } | 15 } |
19 | 16 |
20 namespace cc { | 17 namespace cc { |
21 | 18 |
22 class DirectRenderer; | 19 class DirectRenderer; |
23 class DisplayClient; | 20 class DisplayClient; |
24 class LayerTreeHost; | |
25 class OutputSurface; | 21 class OutputSurface; |
26 class ResourceProvider; | 22 class ResourceProvider; |
27 class SharedBitmapManager; | 23 class SharedBitmapManager; |
28 class Surface; | 24 class Surface; |
29 class SurfaceManager; | 25 class SurfaceManager; |
30 | 26 |
31 class CC_SURFACES_EXPORT Display | 27 class CC_SURFACES_EXPORT Display : public SurfaceClient, |
32 : public SurfaceClient, | 28 public OutputSurfaceClient, |
33 public DelegatedFrameResourceCollectionClient, | 29 public RendererClient { |
34 NON_EXPORTED_BASE(public LayerTreeHostClient), | |
35 NON_EXPORTED_BASE(public LayerTreeHostSingleThreadClient) { | |
36 public: | 30 public: |
37 Display(DisplayClient* client, | 31 Display(DisplayClient* client, |
38 SurfaceManager* manager, | 32 SurfaceManager* manager, |
39 SharedBitmapManager* bitmap_manager); | 33 SharedBitmapManager* bitmap_manager); |
40 virtual ~Display(); | 34 virtual ~Display(); |
41 | 35 |
42 void Resize(const gfx::Size& new_size); | 36 void Resize(const gfx::Size& new_size); |
43 bool Draw(); | 37 bool Draw(); |
44 | 38 |
45 int CurrentSurfaceID(); | 39 int CurrentSurfaceID(); |
46 | 40 |
47 // LayerTreeHostClient implementation. | 41 // OutputSurfaceClient implementation. |
48 virtual void WillBeginMainFrame(int frame_id) OVERRIDE {} | 42 virtual void DeferredInitialize() OVERRIDE {} |
49 virtual void DidBeginMainFrame() OVERRIDE {} | 43 virtual void ReleaseGL() OVERRIDE {} |
50 virtual void Animate(base::TimeTicks frame_begin_time) OVERRIDE {} | 44 virtual void CommitVSyncParameters(base::TimeTicks timebase, |
51 virtual void Layout() OVERRIDE {} | 45 base::TimeDelta interval) OVERRIDE {} |
52 virtual void ApplyScrollAndScale(const gfx::Vector2d& scroll_delta, | 46 virtual void SetNeedsRedrawRect(const gfx::Rect& damage_rect) OVERRIDE {} |
53 float page_scale) OVERRIDE {} | 47 virtual void BeginFrame(const BeginFrameArgs& args) OVERRIDE {} |
54 virtual scoped_ptr<OutputSurface> CreateOutputSurface(bool fallback) OVERRIDE; | 48 virtual void DidSwapBuffers() OVERRIDE {} |
55 virtual void DidInitializeOutputSurface() OVERRIDE {} | 49 virtual void DidSwapBuffersComplete() OVERRIDE {} |
56 virtual void WillCommit() OVERRIDE {} | 50 virtual void ReclaimResources(const CompositorFrameAck* ack) OVERRIDE {} |
57 virtual void DidCommit() OVERRIDE {} | 51 virtual void DidLoseOutputSurface() OVERRIDE {} |
58 virtual void DidCommitAndDrawFrame() OVERRIDE {} | 52 virtual void SetExternalDrawConstraints( |
59 virtual void DidCompleteSwapBuffers() OVERRIDE {} | 53 const gfx::Transform& transform, |
| 54 const gfx::Rect& viewport, |
| 55 const gfx::Rect& clip, |
| 56 bool valid_for_tile_management) OVERRIDE {} |
| 57 virtual void SetMemoryPolicy(const ManagedMemoryPolicy& policy) OVERRIDE {} |
| 58 virtual void SetTreeActivationCallback( |
| 59 const base::Closure& callback) OVERRIDE {} |
60 | 60 |
61 // LayerTreeHostSingleThreadClient implementation. | 61 // RendererClient implementation. |
62 virtual void ScheduleComposite() OVERRIDE; | 62 virtual void SetFullRootLayerDamage() OVERRIDE {} |
63 virtual void ScheduleAnimation() OVERRIDE; | |
64 virtual void DidPostSwapBuffers() OVERRIDE {} | |
65 virtual void DidAbortSwapBuffers() OVERRIDE {} | |
66 | |
67 // DelegatedFrameResourceCollectionClient implementation. | |
68 virtual void UnusedResourcesAreAvailable() OVERRIDE {} | |
69 | 63 |
70 // SurfaceClient implementation. | 64 // SurfaceClient implementation. |
71 virtual void ReturnResources(const ReturnedResourceArray& resources) OVERRIDE; | 65 virtual void ReturnResources(const ReturnedResourceArray& resources) OVERRIDE; |
72 | 66 |
73 private: | 67 private: |
74 void DoComposite(); | 68 void InitializeOutputSurface(); |
75 | |
76 bool scheduled_draw_; | |
77 | 69 |
78 DisplayClient* client_; | 70 DisplayClient* client_; |
79 SurfaceManager* manager_; | 71 SurfaceManager* manager_; |
80 SurfaceAggregator aggregator_; | 72 SurfaceAggregator aggregator_; |
81 SharedBitmapManager* bitmap_manager_; | 73 SharedBitmapManager* bitmap_manager_; |
82 scoped_ptr<Surface> current_surface_; | 74 scoped_ptr<Surface> current_surface_; |
83 scoped_ptr<LayerTreeHost> layer_tree_host_; | 75 scoped_ptr<OutputSurface> output_surface_; |
84 scoped_refptr<DelegatedFrameResourceCollection> resource_collection_; | 76 scoped_ptr<ResourceProvider> resource_provider_; |
85 scoped_refptr<DelegatedFrameProvider> delegated_frame_provider_; | 77 scoped_ptr<DirectRenderer> renderer_; |
86 scoped_refptr<DelegatedRendererLayer> delegated_layer_; | 78 int child_id_; |
87 base::WeakPtrFactory<Display> schedule_draw_factory_; | |
88 | 79 |
89 DISALLOW_COPY_AND_ASSIGN(Display); | 80 DISALLOW_COPY_AND_ASSIGN(Display); |
90 }; | 81 }; |
91 | 82 |
92 } // namespace cc | 83 } // namespace cc |
OLD | NEW |