OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_RESOURCES_VIDEO_RESOURCE_UPDATER_H_ | 5 #ifndef CC_RESOURCES_VIDEO_RESOURCE_UPDATER_H_ |
6 #define CC_RESOURCES_VIDEO_RESOURCE_UPDATER_H_ | 6 #define CC_RESOURCES_VIDEO_RESOURCE_UPDATER_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
14 #include "cc/base/cc_export.h" | 14 #include "cc/base/cc_export.h" |
15 #include "cc/resources/release_callback.h" | 15 #include "cc/resources/release_callback.h" |
| 16 #include "cc/resources/resource_format.h" |
16 #include "cc/resources/texture_mailbox.h" | 17 #include "cc/resources/texture_mailbox.h" |
17 #include "ui/gfx/size.h" | 18 #include "ui/gfx/size.h" |
18 | 19 |
19 namespace media { | 20 namespace media { |
20 class SkCanvasVideoRenderer; | 21 class SkCanvasVideoRenderer; |
21 class VideoFrame; | 22 class VideoFrame; |
22 } | 23 } |
23 | 24 |
24 namespace cc { | 25 namespace cc { |
25 class ContextProvider; | 26 class ContextProvider; |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 ResourceProvider* resource_provider); | 69 ResourceProvider* resource_provider); |
69 ~VideoResourceUpdater(); | 70 ~VideoResourceUpdater(); |
70 | 71 |
71 VideoFrameExternalResources CreateExternalResourcesFromVideoFrame( | 72 VideoFrameExternalResources CreateExternalResourcesFromVideoFrame( |
72 const scoped_refptr<media::VideoFrame>& video_frame); | 73 const scoped_refptr<media::VideoFrame>& video_frame); |
73 | 74 |
74 private: | 75 private: |
75 struct PlaneResource { | 76 struct PlaneResource { |
76 unsigned resource_id; | 77 unsigned resource_id; |
77 gfx::Size resource_size; | 78 gfx::Size resource_size; |
78 unsigned resource_format; | 79 ResourceFormat resource_format; |
79 gpu::Mailbox mailbox; | 80 gpu::Mailbox mailbox; |
80 | 81 |
81 PlaneResource(unsigned resource_id, | 82 PlaneResource(unsigned resource_id, |
82 gfx::Size resource_size, | 83 gfx::Size resource_size, |
83 unsigned resource_format, | 84 ResourceFormat resource_format, |
84 gpu::Mailbox mailbox) | 85 gpu::Mailbox mailbox) |
85 : resource_id(resource_id), | 86 : resource_id(resource_id), |
86 resource_size(resource_size), | 87 resource_size(resource_size), |
87 resource_format(resource_format), | 88 resource_format(resource_format), |
88 mailbox(mailbox) {} | 89 mailbox(mailbox) {} |
89 }; | 90 }; |
90 | 91 |
91 void DeleteResource(unsigned resource_id); | 92 void DeleteResource(unsigned resource_id); |
92 bool VerifyFrame(const scoped_refptr<media::VideoFrame>& video_frame); | 93 bool VerifyFrame(const scoped_refptr<media::VideoFrame>& video_frame); |
93 VideoFrameExternalResources CreateForHardwarePlanes( | 94 VideoFrameExternalResources CreateForHardwarePlanes( |
94 const scoped_refptr<media::VideoFrame>& video_frame); | 95 const scoped_refptr<media::VideoFrame>& video_frame); |
95 VideoFrameExternalResources CreateForSoftwarePlanes( | 96 VideoFrameExternalResources CreateForSoftwarePlanes( |
96 const scoped_refptr<media::VideoFrame>& video_frame); | 97 const scoped_refptr<media::VideoFrame>& video_frame); |
97 | 98 |
98 struct RecycleResourceData { | 99 struct RecycleResourceData { |
99 unsigned resource_id; | 100 unsigned resource_id; |
100 gfx::Size resource_size; | 101 gfx::Size resource_size; |
101 unsigned resource_format; | 102 ResourceFormat resource_format; |
102 gpu::Mailbox mailbox; | 103 gpu::Mailbox mailbox; |
103 }; | 104 }; |
104 static void RecycleResource(base::WeakPtr<VideoResourceUpdater> updater, | 105 static void RecycleResource(base::WeakPtr<VideoResourceUpdater> updater, |
105 RecycleResourceData data, | 106 RecycleResourceData data, |
106 unsigned sync_point, | 107 unsigned sync_point, |
107 bool lost_resource); | 108 bool lost_resource); |
108 | 109 |
109 ContextProvider* context_provider_; | 110 ContextProvider* context_provider_; |
110 ResourceProvider* resource_provider_; | 111 ResourceProvider* resource_provider_; |
111 scoped_ptr<media::SkCanvasVideoRenderer> video_renderer_; | 112 scoped_ptr<media::SkCanvasVideoRenderer> video_renderer_; |
112 | 113 |
113 std::vector<unsigned> all_resources_; | 114 std::vector<unsigned> all_resources_; |
114 std::vector<PlaneResource> recycled_resources_; | 115 std::vector<PlaneResource> recycled_resources_; |
115 | 116 |
116 DISALLOW_COPY_AND_ASSIGN(VideoResourceUpdater); | 117 DISALLOW_COPY_AND_ASSIGN(VideoResourceUpdater); |
117 }; | 118 }; |
118 | 119 |
119 } // namespace cc | 120 } // namespace cc |
120 | 121 |
121 #endif // CC_RESOURCES_VIDEO_RESOURCE_UPDATER_H_ | 122 #endif // CC_RESOURCES_VIDEO_RESOURCE_UPDATER_H_ |
OLD | NEW |