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

Unified Diff: cc/layers/io_surface_layer_impl.cc

Issue 13445009: cc: Move video upload to VideoResourceUpdater. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: consume textures that were produced 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/io_surface_layer_impl.h ('k') | cc/layers/video_frame_provider_client_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/layers/io_surface_layer_impl.cc
diff --git a/cc/layers/io_surface_layer_impl.cc b/cc/layers/io_surface_layer_impl.cc
index 2c95c005b284fb98ffc031a6ab05420b5399dd3e..2d4f9b782a58a774a5d78568b8ca770a6d7b9315 100644
--- a/cc/layers/io_surface_layer_impl.cc
+++ b/cc/layers/io_surface_layer_impl.cc
@@ -27,11 +27,25 @@ IOSurfaceLayerImpl::~IOSurfaceLayerImpl() {
if (!io_surface_texture_id_)
return;
- OutputSurface* output_surface = layer_tree_impl()->output_surface();
- // FIXME: Implement this path for software compositing.
- WebKit::WebGraphicsContext3D* context3d = output_surface->context3d();
- if (context3d)
- context3d->deleteTexture(io_surface_texture_id_);
+ DestroyTexture();
+}
+
+void IOSurfaceLayerImpl::DestroyTexture() {
+ if (io_surface_resource_id_) {
+ ResourceProvider* resource_provider =
+ layer_tree_impl()->resource_provider();
+ resource_provider->DeleteResource(io_surface_resource_id_);
+ io_surface_resource_id_ = 0;
+ }
+
+ if (io_surface_texture_id_) {
+ OutputSurface* output_surface = layer_tree_impl()->output_surface();
+ // FIXME: Implement this path for software compositing.
+ WebKit::WebGraphicsContext3D* context3d = output_surface->context3d();
+ if (context3d)
+ context3d->deleteTexture(io_surface_texture_id_);
+ io_surface_texture_id_ = 0;
+ }
}
scoped_ptr<LayerImpl> IOSurfaceLayerImpl::CreateLayerImpl(
@@ -59,8 +73,12 @@ void IOSurfaceLayerImpl::WillDraw(ResourceProvider* resource_provider) {
}
// FIXME: Do this in a way that we can track memory usage.
- if (!io_surface_texture_id_)
+ if (!io_surface_texture_id_) {
io_surface_texture_id_ = context3d->createTexture();
+ io_surface_resource_id_ =
+ resource_provider->CreateResourceFromExternalTexture(
+ io_surface_texture_id_);
+ }
GLC(context3d, context3d->activeTexture(GL_TEXTURE0));
GLC(context3d,
@@ -107,7 +125,7 @@ void IOSurfaceLayerImpl::AppendQuads(QuadSink* quad_sink,
quad_rect,
opaque_rect,
io_surface_size_,
- io_surface_texture_id_,
+ io_surface_resource_id_,
IOSurfaceDrawQuad::FLIPPED);
quad_sink->Append(quad.PassAs<DrawQuad>(), append_quads_data);
}
@@ -125,7 +143,7 @@ void IOSurfaceLayerImpl::DumpLayerProperties(std::string* str,
void IOSurfaceLayerImpl::DidLoseOutputSurface() {
// We don't have a valid texture ID in the new context; however,
// the IOSurface is still valid.
- io_surface_texture_id_ = 0;
+ DestroyTexture();
io_surface_changed_ = true;
}
« no previous file with comments | « cc/layers/io_surface_layer_impl.h ('k') | cc/layers/video_frame_provider_client_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698