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

Unified Diff: cc/resources/video_resource_updater.h

Issue 13959005: cc: Recycle resources for software video decode. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Destroy recycled textures when VRU shuts down Created 7 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/layers/video_layer_impl.cc ('k') | cc/resources/video_resource_updater.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
};
« no previous file with comments | « cc/layers/video_layer_impl.cc ('k') | cc/resources/video_resource_updater.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698