Index: cc/resources/video_resource_updater.h |
diff --git a/cc/resources/video_resource_updater.h b/cc/resources/video_resource_updater.h |
index fba59fca999e168e59ae83544fb632d798f89b1d..8547e653201b8e9934d7c3293d1cbca08d73525a 100644 |
--- a/cc/resources/video_resource_updater.h |
+++ b/cc/resources/video_resource_updater.h |
@@ -10,7 +10,9 @@ |
#include "base/basictypes.h" |
#include "base/memory/ref_counted.h" |
#include "base/memory/scoped_ptr.h" |
+#include "base/memory/weak_ptr.h" |
#include "cc/resources/texture_mailbox.h" |
+#include "ui/gfx/size.h" |
namespace media { |
class SkCanvasVideoRenderer; |
@@ -55,7 +57,8 @@ class VideoFrameExternalResources { |
// VideoResourceUpdater is by the video system to produce frame content as |
// resources consumable by the compositor. |
-class VideoResourceUpdater { |
+class VideoResourceUpdater |
+ : public base::SupportsWeakPtr<VideoResourceUpdater> { |
public: |
explicit VideoResourceUpdater(ResourceProvider* resource_provider); |
~VideoResourceUpdater(); |
@@ -68,8 +71,31 @@ class VideoResourceUpdater { |
const scoped_refptr<media::VideoFrame>& video_frame); |
private: |
+ struct PlaneResource { |
+ unsigned resource_id; |
+ gfx::Size resource_size; |
+ unsigned resource_format; |
+ unsigned sync_point; |
+ |
+ PlaneResource(unsigned resource_id, |
+ gfx::Size resource_size, |
+ unsigned resource_format, |
+ unsigned sync_point) |
+ : resource_id(resource_id), |
+ resource_size(resource_size), |
+ resource_format(resource_format), |
+ sync_point(sync_point) {} |
+ }; |
+ |
bool VerifyFrame(const scoped_refptr<media::VideoFrame>& video_frame); |
+ static void RecycleResource(base::WeakPtr<VideoResourceUpdater> updater, |
+ ResourceProvider* resource_provider, |
+ unsigned resource_id, |
+ gfx::Size resource_size, |
+ unsigned resource_format, |
+ gpu::Mailbox mailbox, |
+ unsigned sync_point); |
static void ReturnTexture(ResourceProvider* resource_provider, |
TextureMailbox::ReleaseCallback callback, |
unsigned texture_id, |
@@ -79,6 +105,8 @@ class VideoResourceUpdater { |
ResourceProvider* resource_provider_; |
scoped_ptr<media::SkCanvasVideoRenderer> video_renderer_; |
+ std::vector<PlaneResource> recycled_resources_; |
+ |
DISALLOW_COPY_AND_ASSIGN(VideoResourceUpdater); |
}; |