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

Unified Diff: webkit/compositor_bindings/web_external_texture_layer_impl.cc

Issue 12374028: Allow WebExternalTextureLayerClient to work with mailboxes. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Rebase Created 7 years, 9 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
Index: webkit/compositor_bindings/web_external_texture_layer_impl.cc
diff --git a/webkit/compositor_bindings/web_external_texture_layer_impl.cc b/webkit/compositor_bindings/web_external_texture_layer_impl.cc
index 01f6e79214b41438ed4e1453c000461fde04418b..26d109cc0a580472215438ff6dee918ea732c5e7 100644
--- a/webkit/compositor_bindings/web_external_texture_layer_impl.cc
+++ b/webkit/compositor_bindings/web_external_texture_layer_impl.cc
@@ -7,6 +7,7 @@
#include "cc/layers/texture_layer.h"
#include "cc/resources/resource_update_queue.h"
#include "third_party/WebKit/Source/Platform/chromium/public/WebExternalTextureLayerClient.h"
+#include "third_party/WebKit/Source/Platform/chromium/public/WebExternalTextureMailbox.h"
#include "third_party/WebKit/Source/Platform/chromium/public/WebFloatRect.h"
#include "third_party/WebKit/Source/Platform/chromium/public/WebSize.h"
#include "webkit/compositor_bindings/web_layer_impl.h"
@@ -17,13 +18,16 @@ using cc::ResourceUpdateQueue;
namespace webkit {
WebExternalTextureLayerImpl::WebExternalTextureLayerImpl(
- WebKit::WebExternalTextureLayerClient* client)
- : client_(client) {
+ WebKit::WebExternalTextureLayerClient* client,
+ bool mailbox)
+ : client_(client),
+ uses_mailbox_(mailbox) {
scoped_refptr<TextureLayer> layer;
- if (client_)
- layer = TextureLayer::Create(this);
+ cc::TextureLayerClient* cc_client = client_ ? this : NULL;
+ if (mailbox)
+ layer = TextureLayer::CreateForMailbox(cc_client);
else
- layer = TextureLayer::Create(NULL);
+ layer = TextureLayer::Create(cc_client);
layer->SetIsDrawable(true);
layer_.reset(new WebLayerImpl(layer));
}
@@ -34,6 +38,15 @@ WebExternalTextureLayerImpl::~WebExternalTextureLayerImpl() {
WebKit::WebLayer* WebExternalTextureLayerImpl::layer() { return layer_.get(); }
+void WebExternalTextureLayerImpl::clearTexture() {
+ if (uses_mailbox_) {
+ static_cast<TextureLayer*>(layer_->layer())->SetTextureMailbox(
+ cc::TextureMailbox());
+ } else {
+ static_cast<TextureLayer*>(layer_->layer())->SetTextureId(0);
+ }
+}
+
void WebExternalTextureLayerImpl::setTextureId(unsigned id) {
static_cast<TextureLayer*>(layer_->layer())->SetTextureId(id);
}
@@ -94,4 +107,29 @@ WebKit::WebGraphicsContext3D* WebExternalTextureLayerImpl::Context3d() {
return client_->context();
}
-} // namespace webkit
+bool WebExternalTextureLayerImpl::PrepareTextureMailbox(
+ cc::TextureMailbox* out_mailbox) {
+ WebKit::WebExternalTextureMailbox mailbox;
+ if (!client_->prepareMailbox(&mailbox)) {
+ return false;
+ }
+ gpu::Mailbox name;
+ name.SetName(mailbox.name);
+ cc::TextureMailbox::ReleaseCallback callback =
+ base::Bind(&WebExternalTextureLayerImpl::mailboxReleased,
+ this->AsWeakPtr(),
+ mailbox);
+ *out_mailbox = cc::TextureMailbox(name, callback, mailbox.syncPoint);
+ return true;
+}
+
+void WebExternalTextureLayerImpl::mailboxReleased(
+ const WebKit::WebExternalTextureMailbox &mailbox,
+ unsigned sync_point) {
+ WebKit::WebExternalTextureMailbox available_mailbox;
+ memcpy(available_mailbox.name, mailbox.name, sizeof(available_mailbox.name));
+ available_mailbox.syncPoint = sync_point;
+ client_->mailboxReleased(available_mailbox);
+}
+
+} // namespace webkit
« no previous file with comments | « webkit/compositor_bindings/web_external_texture_layer_impl.h ('k') | webkit/plugins/ppapi/ppapi_plugin_instance.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698