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 #include "base/memory/scoped_ptr.h"
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"
10 #include "cc/surfaces/surface_aggregator.h"
11 #include "cc/surfaces/surface_client.h"
12 #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"
26 class ResourceProvider
;
27 class SharedBitmapManager
;
31 class CC_SURFACES_EXPORT Display
32 : public SurfaceClient
,
33 public DelegatedFrameResourceCollectionClient
,
34 NON_EXPORTED_BASE(public LayerTreeHostClient
),
35 NON_EXPORTED_BASE(public LayerTreeHostSingleThreadClient
) {
37 Display(DisplayClient
* client
,
38 SurfaceManager
* manager
,
39 SharedBitmapManager
* bitmap_manager
);
42 void Resize(const gfx::Size
& new_size
);
45 int CurrentSurfaceID();
47 // LayerTreeHostClient implementation.
48 virtual void WillBeginMainFrame(int frame_id
) OVERRIDE
{}
49 virtual void DidBeginMainFrame() OVERRIDE
{}
50 virtual void Animate(base::TimeTicks frame_begin_time
) OVERRIDE
{}
51 virtual void Layout() OVERRIDE
{}
52 virtual void ApplyScrollAndScale(const gfx::Vector2d
& scroll_delta
,
53 float page_scale
) OVERRIDE
{}
54 virtual scoped_ptr
<OutputSurface
> CreateOutputSurface(bool fallback
) OVERRIDE
;
55 virtual void DidInitializeOutputSurface() OVERRIDE
{}
56 virtual void WillCommit() OVERRIDE
{}
57 virtual void DidCommit() OVERRIDE
{}
58 virtual void DidCommitAndDrawFrame() OVERRIDE
{}
59 virtual void DidCompleteSwapBuffers() OVERRIDE
{}
61 // LayerTreeHostSingleThreadClient implementation.
62 virtual void ScheduleComposite() OVERRIDE
;
63 virtual void ScheduleAnimation() OVERRIDE
;
64 virtual void DidPostSwapBuffers() OVERRIDE
{}
65 virtual void DidAbortSwapBuffers() OVERRIDE
{}
67 // DelegatedFrameResourceCollectionClient implementation.
68 virtual void UnusedResourcesAreAvailable() OVERRIDE
{}
70 // SurfaceClient implementation.
71 virtual void ReturnResources(const ReturnedResourceArray
& resources
) OVERRIDE
;
78 DisplayClient
* client_
;
79 SurfaceManager
* manager_
;
80 SurfaceAggregator aggregator_
;
81 SharedBitmapManager
* bitmap_manager_
;
82 scoped_ptr
<Surface
> current_surface_
;
83 scoped_ptr
<LayerTreeHost
> layer_tree_host_
;
84 scoped_refptr
<DelegatedFrameResourceCollection
> resource_collection_
;
85 scoped_refptr
<DelegatedFrameProvider
> delegated_frame_provider_
;
86 scoped_refptr
<DelegatedRendererLayer
> delegated_layer_
;
87 base::WeakPtrFactory
<Display
> schedule_draw_factory_
;
89 DISALLOW_COPY_AND_ASSIGN(Display
);