Don't show supervised user as "already on this device" while they're being imported.
[chromium-blink-merge.git] / cc / layers / delegated_renderer_layer_impl.h
blob617d76f3b1e3ae2176ae5ecf0ccb9ad416c6e380
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::ResourceIdSet& ResourcesForTesting() const {
62 return resources_;
65 private:
66 void ClearChildId();
68 void AppendRainbowDebugBorder(RenderPass* render_pass);
70 void TakeOwnershipOfResourcesIfOnActiveTree(
71 const ResourceProvider::ResourceIdSet& resources);
72 void SetRenderPasses(RenderPassList* render_passes_in_draw_order);
73 void ClearRenderPasses();
75 // Returns |true| if the delegated_render_pass_id is part of the current
76 // frame and can be converted.
77 bool ConvertDelegatedRenderPassId(RenderPassId delegated_render_pass_id,
78 RenderPassId* output_render_pass_id) const;
80 void AppendRenderPassQuads(RenderPass* render_pass,
81 const RenderPass* delegated_render_pass,
82 const gfx::Size& frame_size) const;
84 // LayerImpl overrides.
85 const char* LayerTypeAsString() const override;
87 bool have_render_passes_to_push_;
88 float inverse_device_scale_factor_;
89 RenderPassList render_passes_in_draw_order_;
90 base::hash_map<RenderPassId, int> render_passes_index_by_id_;
91 ResourceProvider::ResourceIdSet resources_;
93 int child_id_;
94 bool own_child_id_;
96 DISALLOW_COPY_AND_ASSIGN(DelegatedRendererLayerImpl);
99 } // namespace cc
101 #endif // CC_LAYERS_DELEGATED_RENDERER_LAYER_IMPL_H_