Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(491)

Side by Side Diff: cc/layers/video_layer_impl.h

Issue 1033563002: cc: Various code safety improvements in video compositing code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments. Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CC_LAYERS_VIDEO_LAYER_IMPL_H_ 5 #ifndef CC_LAYERS_VIDEO_LAYER_IMPL_H_
6 #define CC_LAYERS_VIDEO_LAYER_IMPL_H_ 6 #define CC_LAYERS_VIDEO_LAYER_IMPL_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "cc/base/cc_export.h" 10 #include "cc/base/cc_export.h"
11 #include "cc/layers/layer_impl.h" 11 #include "cc/layers/layer_impl.h"
12 #include "cc/resources/release_callback_impl.h" 12 #include "cc/resources/release_callback_impl.h"
13 #include "cc/resources/video_resource_updater.h" 13 #include "cc/resources/video_resource_updater.h"
14 #include "media/base/video_rotation.h" 14 #include "media/base/video_rotation.h"
15 15
16 namespace media { 16 namespace media {
17 class VideoFrame; 17 class VideoFrame;
18 } 18 }
19 19
20 namespace cc { 20 namespace cc {
21 class VideoFrameProvider; 21 class VideoFrameProvider;
22 class VideoFrameProviderClientImpl; 22 class VideoFrameProviderClientImpl;
23 23
24 class CC_EXPORT VideoLayerImpl : public LayerImpl { 24 class CC_EXPORT VideoLayerImpl : public LayerImpl {
25 public: 25 public:
26 // Must be called on the impl thread while the main thread is blocked. This is
27 // so that |provider| stays alive while this is being created.
26 static scoped_ptr<VideoLayerImpl> Create(LayerTreeImpl* tree_impl, 28 static scoped_ptr<VideoLayerImpl> Create(LayerTreeImpl* tree_impl,
27 int id, 29 int id,
28 VideoFrameProvider* provider, 30 VideoFrameProvider* provider,
29 media::VideoRotation video_rotation); 31 media::VideoRotation video_rotation);
30 ~VideoLayerImpl() override; 32 ~VideoLayerImpl() override;
31 33
32 // LayerImpl implementation. 34 // LayerImpl implementation.
33 scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override; 35 scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override;
34 void PushPropertiesTo(LayerImpl* layer) override;
35 bool WillDraw(DrawMode draw_mode, 36 bool WillDraw(DrawMode draw_mode,
36 ResourceProvider* resource_provider) override; 37 ResourceProvider* resource_provider) override;
37 void AppendQuads(RenderPass* render_pass, 38 void AppendQuads(RenderPass* render_pass,
38 AppendQuadsData* append_quads_data) override; 39 AppendQuadsData* append_quads_data) override;
39 void DidDraw(ResourceProvider* resource_provider) override; 40 void DidDraw(ResourceProvider* resource_provider) override;
40 void DidBecomeActive() override; 41 void DidBecomeActive() override;
41 void ReleaseResources() override; 42 void ReleaseResources() override;
42 43
43 void SetNeedsRedraw(); 44 void SetNeedsRedraw();
44
45 void SetProviderClientImpl(
46 scoped_refptr<VideoFrameProviderClientImpl> provider_client_impl);
47
48 media::VideoRotation video_rotation() const { return video_rotation_; } 45 media::VideoRotation video_rotation() const { return video_rotation_; }
49 46
50 private: 47 private:
51 VideoLayerImpl(LayerTreeImpl* tree_impl, 48 VideoLayerImpl(
52 int id, 49 LayerTreeImpl* tree_impl,
53 media::VideoRotation video_rotation); 50 int id,
51 scoped_refptr<VideoFrameProviderClientImpl> provider_client_impl,
52 media::VideoRotation video_rotation);
54 53
55 const char* LayerTypeAsString() const override; 54 const char* LayerTypeAsString() const override;
56 55
57 scoped_refptr<VideoFrameProviderClientImpl> provider_client_impl_; 56 scoped_refptr<VideoFrameProviderClientImpl> provider_client_impl_;
58 57
59 scoped_refptr<media::VideoFrame> frame_; 58 scoped_refptr<media::VideoFrame> frame_;
60 59
61 media::VideoRotation video_rotation_; 60 media::VideoRotation video_rotation_;
62 61
63 scoped_ptr<VideoResourceUpdater> updater_; 62 scoped_ptr<VideoResourceUpdater> updater_;
64 VideoFrameExternalResources::ResourceType frame_resource_type_; 63 VideoFrameExternalResources::ResourceType frame_resource_type_;
65 std::vector<ResourceProvider::ResourceId> frame_resources_; 64 std::vector<ResourceProvider::ResourceId> frame_resources_;
66 65
67 // TODO(danakj): Remove these, hide software path inside ResourceProvider and 66 // TODO(danakj): Remove these, hide software path inside ResourceProvider and
68 // ExternalResource (aka TextureMailbox) classes. 67 // ExternalResource (aka TextureMailbox) classes.
69 std::vector<unsigned> software_resources_; 68 std::vector<unsigned> software_resources_;
70 // Called once for each software resource. 69 // Called once for each software resource.
71 ReleaseCallbackImpl software_release_callback_; 70 ReleaseCallbackImpl software_release_callback_;
72 71
73 DISALLOW_COPY_AND_ASSIGN(VideoLayerImpl); 72 DISALLOW_COPY_AND_ASSIGN(VideoLayerImpl);
74 }; 73 };
75 74
76 } // namespace cc 75 } // namespace cc
77 76
78 #endif // CC_LAYERS_VIDEO_LAYER_IMPL_H_ 77 #endif // CC_LAYERS_VIDEO_LAYER_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698