Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / 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 "cc/base/cc_export.h"
11 #include "cc/layers/layer_impl.h"
12 #include "cc/resources/release_callback_impl.h"
13 #include "cc/resources/video_resource_updater.h"
14 #include "media/base/video_rotation.h"
15
16 namespace media {
17 class VideoFrame;
18 }
19
20 namespace cc {
21 class VideoFrameProvider;
22 class VideoFrameProviderClientImpl;
23
24 class CC_EXPORT VideoLayerImpl : public LayerImpl {
25  public:
26   static scoped_ptr<VideoLayerImpl> Create(LayerTreeImpl* tree_impl,
27                                            int id,
28                                            VideoFrameProvider* provider,
29                                            media::VideoRotation video_rotation);
30   ~VideoLayerImpl() override;
31
32   // LayerImpl implementation.
33   scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override;
34   void PushPropertiesTo(LayerImpl* layer) override;
35   bool WillDraw(DrawMode draw_mode,
36                 ResourceProvider* resource_provider) override;
37   void AppendQuads(RenderPass* render_pass,
38                    const Occlusion& occlusion_in_content_space,
39                    AppendQuadsData* append_quads_data) override;
40   void DidDraw(ResourceProvider* resource_provider) override;
41   void DidBecomeActive() override;
42   void ReleaseResources() override;
43
44   void SetNeedsRedraw();
45
46   void SetProviderClientImpl(
47       scoped_refptr<VideoFrameProviderClientImpl> provider_client_impl);
48
49   media::VideoRotation video_rotation() const { return video_rotation_; }
50
51  private:
52   VideoLayerImpl(LayerTreeImpl* tree_impl,
53                  int id,
54                  media::VideoRotation video_rotation);
55
56   const char* LayerTypeAsString() const override;
57
58   scoped_refptr<VideoFrameProviderClientImpl> provider_client_impl_;
59
60   scoped_refptr<media::VideoFrame> frame_;
61
62   media::VideoRotation video_rotation_;
63
64   scoped_ptr<VideoResourceUpdater> updater_;
65   VideoFrameExternalResources::ResourceType frame_resource_type_;
66   std::vector<ResourceProvider::ResourceId> frame_resources_;
67
68   // TODO(danakj): Remove these, hide software path inside ResourceProvider and
69   // ExternalResource (aka TextureMailbox) classes.
70   std::vector<unsigned> software_resources_;
71   // Called once for each software resource.
72   ReleaseCallbackImpl software_release_callback_;
73
74   DISALLOW_COPY_AND_ASSIGN(VideoLayerImpl);
75 };
76
77 }  // namespace cc
78
79 #endif  // CC_LAYERS_VIDEO_LAYER_IMPL_H_