summaryrefslogtreecommitdiff
path: root/chromium/cc/layers/delegated_renderer_layer.h
blob: 3f5280eec5f4226f5efbd876927438ea29094ad1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CC_LAYERS_DELEGATED_RENDERER_LAYER_H_
#define CC_LAYERS_DELEGATED_RENDERER_LAYER_H_

#include "cc/base/cc_export.h"
#include "cc/layers/layer.h"
#include "cc/resources/transferable_resource.h"

namespace cc {

class DelegatedFrameData;
class DelegatedRendererLayerClient;

class CC_EXPORT DelegatedRendererLayer : public Layer {
 public:
  static scoped_refptr<DelegatedRendererLayer> Create(
      DelegatedRendererLayerClient* client);

  virtual scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl)
      OVERRIDE;
  virtual void PushPropertiesTo(LayerImpl* impl) OVERRIDE;
  virtual bool DrawsContent() const OVERRIDE;

  // Set the size at which the frame should be displayed, with the origin at the
  // layer's origin. This must always contain at least the layer's bounds. A
  // value of (0, 0) implies that the frame should be displayed to fit exactly
  // in the layer's bounds.
  void SetDisplaySize(gfx::Size size);

  void SetFrameData(scoped_ptr<DelegatedFrameData> frame_data);

  // Passes ownership of any unused resources that had been given by the child
  // compositor to the given array, so they can be given back to the child.
  void TakeUnusedResourcesForChildCompositor(TransferableResourceArray* array);

  virtual bool BlocksPendingCommit() const OVERRIDE;

 protected:
  explicit DelegatedRendererLayer(DelegatedRendererLayerClient* client);
  virtual ~DelegatedRendererLayer();

 private:
  scoped_ptr<DelegatedFrameData> frame_data_;
  gfx::RectF damage_in_frame_;
  gfx::Size frame_size_;
  gfx::Size display_size_;
  TransferableResourceArray unused_resources_for_child_compositor_;

  DelegatedRendererLayerClient* client_;

  DISALLOW_COPY_AND_ASSIGN(DelegatedRendererLayer);
};

}  // namespace cc
#endif  // CC_LAYERS_DELEGATED_RENDERER_LAYER_H_