Don't add extra app list launcher page webviews.
[chromium-blink-merge.git] / cc / layers / delegated_renderer_layer_impl.h
blob4a61ba12d68f3454012db906bdb64436fa855411
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_IMPL_H_
6 #define CC_LAYERS_DELEGATED_RENDERER_LAYER_IMPL_H_
8 #include "base/containers/hash_tables.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "cc/base/cc_export.h"
11 #include "cc/base/scoped_ptr_vector.h"
12 #include "cc/layers/layer_impl.h"
14 namespace cc {
15 class DelegatedFrameData;
16 class RenderPassSink;
18 class CC_EXPORT DelegatedRendererLayerImpl : public LayerImpl {
19 public:
20 static scoped_ptr<DelegatedRendererLayerImpl> Create(
21 LayerTreeImpl* tree_impl, int id) {
22 return make_scoped_ptr(new DelegatedRendererLayerImpl(tree_impl, id));
24 ~DelegatedRendererLayerImpl() override;
26 // LayerImpl overrides.
27 scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override;
28 bool HasDelegatedContent() const override;
29 bool HasContributingDelegatedRenderPasses() const override;
30 RenderPassId FirstContributingRenderPassId() const override;
31 RenderPassId NextContributingRenderPassId(
32 RenderPassId previous) const override;
33 void ReleaseResources() override;
34 bool WillDraw(DrawMode draw_mode,
35 ResourceProvider* resource_provider) override;
36 void AppendQuads(RenderPass* render_pass,
37 AppendQuadsData* append_quads_data) override;
38 void PushPropertiesTo(LayerImpl* layer) override;
40 void AppendContributingRenderPasses(RenderPassSink* render_pass_sink);
42 // Creates an ID with the resource provider for the child renderer
43 // that will be sending quads to the layer. Registers the callback to
44 // inform when resources are no longer in use.
45 void CreateChildIdIfNeeded(const ReturnCallback& return_callback);
47 void SetFrameData(const DelegatedFrameData* frame_data,
48 const gfx::RectF& damage_in_frame);
50 float inverse_device_scale_factor() const {
51 return inverse_device_scale_factor_;
54 protected:
55 DelegatedRendererLayerImpl(LayerTreeImpl* tree_impl, int id);
57 int ChildIdForTesting() const { return child_id_; }
58 const RenderPassList& RenderPassesInDrawOrderForTesting() const {
59 return render_passes_in_draw_order_;
61 const ResourceProvider::ResourceIdArray& ResourcesForTesting() const {
62 return resources_;
65 private:
66 void ClearChildId();
68 void AppendRainbowDebugBorder(RenderPass* render_pass);
70 void SetRenderPasses(RenderPassList* render_passes_in_draw_order);
71 void ClearRenderPasses();
73 // Returns |true| if the delegated_render_pass_id is part of the current
74 // frame and can be converted.
75 bool ConvertDelegatedRenderPassId(RenderPassId delegated_render_pass_id,
76 RenderPassId* output_render_pass_id) const;
78 void AppendRenderPassQuads(RenderPass* render_pass,
79 const RenderPass* delegated_render_pass,
80 const gfx::Size& frame_size) const;
82 // LayerImpl overrides.
83 const char* LayerTypeAsString() const override;
85 bool have_render_passes_to_push_;
86 float inverse_device_scale_factor_;
87 RenderPassList render_passes_in_draw_order_;
88 base::hash_map<RenderPassId, int> render_passes_index_by_id_;
89 ResourceProvider::ResourceIdArray resources_;
91 int child_id_;
92 bool own_child_id_;
94 DISALLOW_COPY_AND_ASSIGN(DelegatedRendererLayerImpl);
97 } // namespace cc
99 #endif // CC_LAYERS_DELEGATED_RENDERER_LAYER_IMPL_H_