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

Side by Side Diff: content/renderer/browser_plugin/browser_plugin_compositing_helper.cc

Issue 105743004: Add gpu::MailboxHolder to hold state for a gpu::Mailbox (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: bfbc08f8 Android clang fixes. Created 6 years, 11 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
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 "content/renderer/browser_plugin/browser_plugin_compositing_helper.h" 5 #include "content/renderer/browser_plugin/browser_plugin_compositing_helper.h"
6 6
7 #include "cc/layers/delegated_frame_provider.h" 7 #include "cc/layers/delegated_frame_provider.h"
8 #include "cc/layers/delegated_frame_resource_collection.h" 8 #include "cc/layers/delegated_frame_resource_collection.h"
9 #include "cc/layers/delegated_renderer_layer.h" 9 #include "cc/layers/delegated_renderer_layer.h"
10 #include "cc/layers/solid_color_layer.h" 10 #include "cc/layers/solid_color_layer.h"
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 gfx::Size device_scale_adjusted_size = gfx::ToFlooredSize( 134 gfx::Size device_scale_adjusted_size = gfx::ToFlooredSize(
135 gfx::ScaleSize(buffer_size_, 1.0f / device_scale_factor)); 135 gfx::ScaleSize(buffer_size_, 1.0f / device_scale_factor));
136 layer->SetBounds(device_scale_adjusted_size); 136 layer->SetBounds(device_scale_adjusted_size);
137 } 137 }
138 138
139 // Manually manage background layer for transparent webview. 139 // Manually manage background layer for transparent webview.
140 if (!opaque_) 140 if (!opaque_)
141 background_layer_->SetIsDrawable(false); 141 background_layer_->SetIsDrawable(false);
142 } 142 }
143 143
144 void BrowserPluginCompositingHelper::MailboxReleased( 144 void BrowserPluginCompositingHelper::MailboxReleased(SwapBuffersInfo mailbox,
145 SwapBuffersInfo mailbox, 145 uint32 sync_point,
146 unsigned sync_point, 146 bool lost_resource) {
147 bool lost_resource) {
148 if (mailbox.type == SOFTWARE_COMPOSITOR_FRAME) { 147 if (mailbox.type == SOFTWARE_COMPOSITOR_FRAME) {
149 delete mailbox.shared_memory; 148 delete mailbox.shared_memory;
150 mailbox.shared_memory = NULL; 149 mailbox.shared_memory = NULL;
151 } else if (lost_resource) { 150 } else if (lost_resource) {
152 // Reset mailbox's name if the resource was lost. 151 // Reset mailbox's name if the resource was lost.
153 mailbox.name.SetZero(); 152 mailbox.name.SetZero();
154 } 153 }
155 154
156 // This means the GPU process crashed or guest crashed. 155 // This means the GPU process crashed or guest crashed.
157 if (last_host_id_ != mailbox.host_id || 156 if (last_host_id_ != mailbox.host_id ||
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 resource_collection_ = NULL; 221 resource_collection_ = NULL;
223 frame_provider_ = NULL; 222 frame_provider_ = NULL;
224 texture_layer_ = NULL; 223 texture_layer_ = NULL;
225 delegated_layer_ = NULL; 224 delegated_layer_ = NULL;
226 background_layer_ = NULL; 225 background_layer_ = NULL;
227 web_layer_.reset(); 226 web_layer_.reset();
228 } 227 }
229 228
230 void BrowserPluginCompositingHelper::OnBuffersSwappedPrivate( 229 void BrowserPluginCompositingHelper::OnBuffersSwappedPrivate(
231 const SwapBuffersInfo& mailbox, 230 const SwapBuffersInfo& mailbox,
232 unsigned sync_point, 231 uint32 sync_point,
233 float device_scale_factor) { 232 float device_scale_factor) {
234 DCHECK(!delegated_layer_.get()); 233 DCHECK(!delegated_layer_.get());
235 // If these mismatch, we are either just starting up, GPU process crashed or 234 // If these mismatch, we are either just starting up, GPU process crashed or
236 // guest renderer crashed. 235 // guest renderer crashed.
237 // In this case, we are communicating with a new image transport 236 // In this case, we are communicating with a new image transport
238 // surface and must ACK with the new ID's and an empty mailbox. 237 // surface and must ACK with the new ID's and an empty mailbox.
239 if (last_route_id_ != mailbox.route_id || 238 if (last_route_id_ != mailbox.route_id ||
240 last_output_surface_id_ != mailbox.output_surface_id || 239 last_output_surface_id_ != mailbox.output_surface_id ||
241 last_host_id_ != mailbox.host_id) 240 last_host_id_ != mailbox.host_id)
242 last_mailbox_valid_ = false; 241 last_mailbox_valid_ = false;
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 return; 284 return;
286 } 285 }
287 286
288 cc::TextureMailbox texture_mailbox; 287 cc::TextureMailbox texture_mailbox;
289 scoped_ptr<cc::SingleReleaseCallback> release_callback; 288 scoped_ptr<cc::SingleReleaseCallback> release_callback;
290 if (current_mailbox_valid) { 289 if (current_mailbox_valid) {
291 release_callback = cc::SingleReleaseCallback::Create( 290 release_callback = cc::SingleReleaseCallback::Create(
292 base::Bind(&BrowserPluginCompositingHelper::MailboxReleased, 291 base::Bind(&BrowserPluginCompositingHelper::MailboxReleased,
293 scoped_refptr<BrowserPluginCompositingHelper>(this), 292 scoped_refptr<BrowserPluginCompositingHelper>(this),
294 mailbox)).Pass(); 293 mailbox)).Pass();
295 if (is_software_frame) 294 if (is_software_frame) {
296 texture_mailbox = cc::TextureMailbox(mailbox.shared_memory, mailbox.size); 295 texture_mailbox = cc::TextureMailbox(mailbox.shared_memory, mailbox.size);
297 else 296 } else {
298 texture_mailbox = cc::TextureMailbox(mailbox.name, sync_point); 297 texture_mailbox =
298 cc::TextureMailbox(mailbox.name, GL_TEXTURE_2D, sync_point);
299 }
299 } 300 }
300 301
301 texture_layer_->SetFlipped(!is_software_frame); 302 texture_layer_->SetFlipped(!is_software_frame);
302 texture_layer_->SetTextureMailbox(texture_mailbox, release_callback.Pass()); 303 texture_layer_->SetTextureMailbox(texture_mailbox, release_callback.Pass());
303 texture_layer_->SetNeedsDisplay(); 304 texture_layer_->SetNeedsDisplay();
304 last_mailbox_valid_ = current_mailbox_valid; 305 last_mailbox_valid_ = current_mailbox_valid;
305 } 306 }
306 307
307 void BrowserPluginCompositingHelper::OnBuffersSwapped( 308 void BrowserPluginCompositingHelper::OnBuffersSwapped(
308 const gfx::Size& size, 309 const gfx::Size& size,
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
488 dest_size.width(), 489 dest_size.width(),
489 dest_size.height()); 490 dest_size.height());
490 } 491 }
491 browser_plugin_manager_->Send( 492 browser_plugin_manager_->Send(
492 new BrowserPluginHostMsg_CopyFromCompositingSurfaceAck( 493 new BrowserPluginHostMsg_CopyFromCompositingSurfaceAck(
493 host_routing_id_, instance_id_, request_id, 494 host_routing_id_, instance_id_, request_id,
494 resized_bitmap)); 495 resized_bitmap));
495 } 496 }
496 497
497 } // namespace content 498 } // namespace content
OLDNEW
« no previous file with comments | « content/common/gpu/client/gl_helper.cc ('k') | content/renderer/media/android/webmediaplayer_android.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698