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_LAYERS_DELEGATED_RENDERER_LAYER_H_
6 #define CC_LAYERS_DELEGATED_RENDERER_LAYER_H_
8 #include "cc/base/cc_export.h"
9 #include "cc/layers/layer.h"
10 #include "cc/resources/transferable_resource.h"
14 class DelegatedFrameData
;
15 class DelegatedRendererLayerClient
;
17 class CC_EXPORT DelegatedRendererLayer
: public Layer
{
19 static scoped_refptr
<DelegatedRendererLayer
> Create(
20 DelegatedRendererLayerClient
* client
);
22 virtual scoped_ptr
<LayerImpl
> CreateLayerImpl(LayerTreeImpl
* tree_impl
)
24 virtual void PushPropertiesTo(LayerImpl
* impl
) OVERRIDE
;
25 virtual bool DrawsContent() const OVERRIDE
;
27 // Set the size at which the frame should be displayed, with the origin at the
28 // layer's origin. This must always contain at least the layer's bounds. A
29 // value of (0, 0) implies that the frame should be displayed to fit exactly
30 // in the layer's bounds.
31 void SetDisplaySize(gfx::Size size
);
33 void SetFrameData(scoped_ptr
<DelegatedFrameData
> frame_data
);
35 // Passes ownership of any unused resources that had been given by the child
36 // compositor to the given array, so they can be given back to the child.
37 void TakeUnusedResourcesForChildCompositor(TransferableResourceArray
* array
);
39 virtual bool BlocksPendingCommit() const OVERRIDE
;
42 explicit DelegatedRendererLayer(DelegatedRendererLayerClient
* client
);
43 virtual ~DelegatedRendererLayer();
46 scoped_ptr
<DelegatedFrameData
> frame_data_
;
47 gfx::RectF damage_in_frame_
;
48 gfx::Size frame_size_
;
49 gfx::Size display_size_
;
50 TransferableResourceArray unused_resources_for_child_compositor_
;
52 DelegatedRendererLayerClient
* client_
;
54 DISALLOW_COPY_AND_ASSIGN(DelegatedRendererLayer
);
58 #endif // CC_LAYERS_DELEGATED_RENDERER_LAYER_H_