| Index: cc/resources/video_resource_updater.h
|
| diff --git a/cc/resources/video_resource_updater.h b/cc/resources/video_resource_updater.h
|
| index 99800b4c878aa65b48776dfc7c1a5aa86a2cf5ad..38f60331286707828e0ea350d833ef1b8fe7d963 100644
|
| --- a/cc/resources/video_resource_updater.h
|
| +++ b/cc/resources/video_resource_updater.h
|
| @@ -10,6 +10,7 @@
|
| #include "base/basictypes.h"
|
| #include "base/memory/ref_counted.h"
|
| #include "base/memory/weak_ptr.h"
|
| +#include "base/time/time.h"
|
| #include "cc/base/cc_export.h"
|
| #include "cc/resources/release_callback_impl.h"
|
| #include "cc/resources/resource_format.h"
|
| @@ -77,17 +78,28 @@ class CC_EXPORT VideoResourceUpdater
|
| gfx::Size resource_size;
|
| ResourceFormat resource_format;
|
| gpu::Mailbox mailbox;
|
| + // These last three members will be used for identifying the data stored in
|
| + // this resource, and uniquely identifies a media::VideoFrame plane. The
|
| + // frame pointer will only be used for pointer comparison, i.e. the
|
| + // underlying data will not be accessed.
|
| + const void* frame_ptr;
|
| + int plane_index;
|
| + base::TimeDelta timestamp;
|
|
|
| PlaneResource(unsigned resource_id,
|
| const gfx::Size& resource_size,
|
| ResourceFormat resource_format,
|
| - gpu::Mailbox mailbox)
|
| - : resource_id(resource_id),
|
| - resource_size(resource_size),
|
| - resource_format(resource_format),
|
| - mailbox(mailbox) {}
|
| + gpu::Mailbox mailbox);
|
| };
|
|
|
| + static bool PlaneResourceMatchesUniqueID(const PlaneResource& plane_resource,
|
| + const media::VideoFrame* video_frame,
|
| + int plane_index);
|
| +
|
| + static void SetPlaneResourceUniqueId(const media::VideoFrame* video_frame,
|
| + int plane_index,
|
| + PlaneResource* plane_resource);
|
| +
|
| void DeleteResource(unsigned resource_id);
|
| bool VerifyFrame(const scoped_refptr<media::VideoFrame>& video_frame);
|
| VideoFrameExternalResources CreateForHardwarePlanes(
|
| @@ -95,14 +107,8 @@ class CC_EXPORT VideoResourceUpdater
|
| VideoFrameExternalResources CreateForSoftwarePlanes(
|
| const scoped_refptr<media::VideoFrame>& video_frame);
|
|
|
| - struct RecycleResourceData {
|
| - unsigned resource_id;
|
| - gfx::Size resource_size;
|
| - ResourceFormat resource_format;
|
| - gpu::Mailbox mailbox;
|
| - };
|
| static void RecycleResource(base::WeakPtr<VideoResourceUpdater> updater,
|
| - RecycleResourceData data,
|
| + PlaneResource data,
|
| uint32 sync_point,
|
| bool lost_resource,
|
| BlockingTaskRunner* main_thread_task_runner);
|
| @@ -117,6 +123,8 @@ class CC_EXPORT VideoResourceUpdater
|
| scoped_ptr<media::SkCanvasVideoRenderer> video_renderer_;
|
|
|
| std::vector<unsigned> all_resources_;
|
| + // Recycle resources so that we can reduce the number of allocations and
|
| + // data transfers.
|
| std::vector<PlaneResource> recycled_resources_;
|
|
|
| DISALLOW_COPY_AND_ASSIGN(VideoResourceUpdater);
|
|
|