Upload upstream chromium 67.0.3396
[platform/framework/web/chromium-efl.git] / cc / layers / video_layer_impl.h
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.
4
5 #ifndef CC_LAYERS_VIDEO_LAYER_IMPL_H_
6 #define CC_LAYERS_VIDEO_LAYER_IMPL_H_
7
8 #include <vector>
9
10 #include "base/macros.h"
11 #include "cc/cc_export.h"
12 #include "cc/layers/layer_impl.h"
13 #include "cc/resources/video_resource_updater.h"
14 #include "components/viz/common/resources/release_callback.h"
15 #include "media/base/video_rotation.h"
16
17 namespace media {
18 class VideoFrame;
19 }
20
21 namespace cc {
22 class VideoFrameProvider;
23 class VideoFrameProviderClientImpl;
24
25 class CC_EXPORT VideoLayerImpl : public LayerImpl {
26  public:
27   // Must be called on the impl thread while the main thread is blocked. This is
28   // so that |provider| stays alive while this is being created.
29   static std::unique_ptr<VideoLayerImpl> Create(
30       LayerTreeImpl* tree_impl,
31       int id,
32       VideoFrameProvider* provider,
33       media::VideoRotation video_rotation);
34   ~VideoLayerImpl() override;
35
36   // LayerImpl implementation.
37   std::unique_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override;
38   bool WillDraw(DrawMode draw_mode,
39                 LayerTreeResourceProvider* resource_provider) override;
40   void AppendQuads(viz::RenderPass* render_pass,
41                    AppendQuadsData* append_quads_data) override;
42   void DidDraw(LayerTreeResourceProvider* resource_provider) override;
43   SimpleEnclosedRegion VisibleOpaqueRegion() const override;
44   void DidBecomeActive() override;
45   void ReleaseResources() override;
46
47   void SetNeedsRedraw();
48   media::VideoRotation video_rotation() const { return video_rotation_; }
49
50  private:
51   VideoLayerImpl(
52       LayerTreeImpl* tree_impl,
53       int id,
54       scoped_refptr<VideoFrameProviderClientImpl> provider_client_impl,
55       media::VideoRotation video_rotation);
56
57   const char* LayerTypeAsString() const override;
58
59   scoped_refptr<VideoFrameProviderClientImpl> provider_client_impl_;
60
61   scoped_refptr<media::VideoFrame> frame_;
62
63   media::VideoRotation video_rotation_;
64
65   std::unique_ptr<VideoResourceUpdater> updater_;
66
67   DISALLOW_COPY_AND_ASSIGN(VideoLayerImpl);
68 };
69
70 }  // namespace cc
71
72 #endif  // CC_LAYERS_VIDEO_LAYER_IMPL_H_