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

Side by Side Diff: webkit/renderer/compositor_bindings/web_external_texture_layer_impl.cc

Issue 17859002: Allow WebExternalTextureLayers to receive a bitmap along with a mailbox (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 5 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 unified diff | Download patch | Annotate | Revision Log
« cc/trees/layer_tree_host.cc ('K') | « cc/trees/layer_tree_host.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "webkit/renderer/compositor_bindings/web_external_texture_layer_impl.h" 5 #include "webkit/renderer/compositor_bindings/web_external_texture_layer_impl.h"
6 6
7 #include "cc/layers/texture_layer.h" 7 #include "cc/layers/texture_layer.h"
8 #include "cc/resources/resource_update_queue.h" 8 #include "cc/resources/resource_update_queue.h"
9 #include "third_party/WebKit/public/platform/WebExternalTextureLayerClient.h" 9 #include "third_party/WebKit/public/platform/WebExternalTextureLayerClient.h"
10 #include "third_party/WebKit/public/platform/WebExternalTextureMailbox.h" 10 #include "third_party/WebKit/public/platform/WebExternalTextureMailbox.h"
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 } 103 }
104 104
105 WebKit::WebGraphicsContext3D* WebExternalTextureLayerImpl::Context3d() { 105 WebKit::WebGraphicsContext3D* WebExternalTextureLayerImpl::Context3d() {
106 DCHECK(client_); 106 DCHECK(client_);
107 return client_->context(); 107 return client_->context();
108 } 108 }
109 109
110 bool WebExternalTextureLayerImpl::PrepareTextureMailbox( 110 bool WebExternalTextureLayerImpl::PrepareTextureMailbox(
111 cc::TextureMailbox* mailbox) { 111 cc::TextureMailbox* mailbox) {
112 WebKit::WebExternalTextureMailbox client_mailbox; 112 WebKit::WebExternalTextureMailbox client_mailbox;
113 if (!client_->prepareMailbox(&client_mailbox)) { 113 bool use_bitmap =
114 static_cast<TextureLayer*>(layer_->layer())->MustUseBitmap();
115 if (!client_->prepareMailbox(&client_mailbox, use_bitmap)) {
114 return false; 116 return false;
115 } 117 }
118
116 gpu::Mailbox name; 119 gpu::Mailbox name;
117 name.SetName(client_mailbox.name); 120 name.SetName(client_mailbox.name);
118 cc::TextureMailbox::ReleaseCallback callback = 121 cc::TextureMailbox::ReleaseCallback callback =
119 base::Bind(&WebExternalTextureLayerImpl::DidReleaseMailbox, 122 base::Bind(&WebExternalTextureLayerImpl::DidReleaseMailbox,
120 this->AsWeakPtr(), 123 this->AsWeakPtr(),
121 client_mailbox); 124 client_mailbox);
122 *mailbox = cc::TextureMailbox(name, callback, client_mailbox.syncPoint); 125 if (use_bitmap)
126 *mailbox = cc::TextureMailbox(client_mailbox.bitmap,
127 client_mailbox.size,
128 callback);
129 else
130 *mailbox = cc::TextureMailbox(name, callback, client_mailbox.syncPoint);
123 return true; 131 return true;
124 } 132 }
125 133
126 void WebExternalTextureLayerImpl::DidReleaseMailbox( 134 void WebExternalTextureLayerImpl::DidReleaseMailbox(
127 const WebKit::WebExternalTextureMailbox& mailbox, 135 const WebKit::WebExternalTextureMailbox& mailbox,
128 unsigned sync_point, 136 unsigned sync_point,
129 bool lost_resource) { 137 bool lost_resource) {
130 if (lost_resource) 138 if (lost_resource)
131 return; 139 return;
132 140
133 WebKit::WebExternalTextureMailbox available_mailbox; 141 WebKit::WebExternalTextureMailbox available_mailbox;
134 memcpy(available_mailbox.name, mailbox.name, sizeof(available_mailbox.name)); 142 memcpy(available_mailbox.name, mailbox.name, sizeof(available_mailbox.name));
135 available_mailbox.syncPoint = sync_point; 143 available_mailbox.syncPoint = sync_point;
144 available_mailbox.bitmap = mailbox.bitmap;
145 available_mailbox.size = mailbox.size;
136 client_->mailboxReleased(available_mailbox); 146 client_->mailboxReleased(available_mailbox);
137 } 147 }
138 148
139 } // namespace webkit 149 } // namespace webkit
OLDNEW
« cc/trees/layer_tree_host.cc ('K') | « cc/trees/layer_tree_host.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698