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

Side by Side Diff: content/renderer/child_frame_compositing_helper.cc

Issue 132233041: Add gpu::MailboxHolder to hold state for a gpu::Mailbox (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ff7262fa Rebase. Created 6 years, 10 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/child_frame_compositing_helper.h" 5 #include "content/renderer/child_frame_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 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 gfx::ScaleSize(buffer_size_, 1.0f / device_scale_factor)); 197 gfx::ScaleSize(buffer_size_, 1.0f / device_scale_factor));
198 layer->SetBounds(device_scale_adjusted_size); 198 layer->SetBounds(device_scale_adjusted_size);
199 } 199 }
200 200
201 // Manually manage background layer for transparent webview. 201 // Manually manage background layer for transparent webview.
202 if (!opaque_) 202 if (!opaque_)
203 background_layer_->SetIsDrawable(false); 203 background_layer_->SetIsDrawable(false);
204 } 204 }
205 205
206 void ChildFrameCompositingHelper::MailboxReleased(SwapBuffersInfo mailbox, 206 void ChildFrameCompositingHelper::MailboxReleased(SwapBuffersInfo mailbox,
207 unsigned sync_point, 207 uint32 sync_point,
208 bool lost_resource) { 208 bool lost_resource) {
209 if (mailbox.type == SOFTWARE_COMPOSITOR_FRAME) { 209 if (mailbox.type == SOFTWARE_COMPOSITOR_FRAME) {
210 delete mailbox.shared_memory; 210 delete mailbox.shared_memory;
211 mailbox.shared_memory = NULL; 211 mailbox.shared_memory = NULL;
212 } else if (lost_resource) { 212 } else if (lost_resource) {
213 // Reset mailbox's name if the resource was lost. 213 // Reset mailbox's name if the resource was lost.
214 mailbox.name.SetZero(); 214 mailbox.name.SetZero();
215 } 215 }
216 216
217 // This means the GPU process crashed or guest crashed. 217 // This means the GPU process crashed or guest crashed.
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 281
282 void ChildFrameCompositingHelper::ChildFrameGone() { 282 void ChildFrameCompositingHelper::ChildFrameGone() {
283 background_layer_->SetBackgroundColor(SkColorSetARGBInline(255, 0, 128, 0)); 283 background_layer_->SetBackgroundColor(SkColorSetARGBInline(255, 0, 128, 0));
284 background_layer_->RemoveAllChildren(); 284 background_layer_->RemoveAllChildren();
285 background_layer_->SetIsDrawable(true); 285 background_layer_->SetIsDrawable(true);
286 background_layer_->SetContentsOpaque(true); 286 background_layer_->SetContentsOpaque(true);
287 } 287 }
288 288
289 void ChildFrameCompositingHelper::OnBuffersSwappedPrivate( 289 void ChildFrameCompositingHelper::OnBuffersSwappedPrivate(
290 const SwapBuffersInfo& mailbox, 290 const SwapBuffersInfo& mailbox,
291 unsigned sync_point, 291 uint32 sync_point,
292 float device_scale_factor) { 292 float device_scale_factor) {
293 DCHECK(!delegated_layer_.get()); 293 DCHECK(!delegated_layer_.get());
294 // If these mismatch, we are either just starting up, GPU process crashed or 294 // If these mismatch, we are either just starting up, GPU process crashed or
295 // guest renderer crashed. 295 // guest renderer crashed.
296 // In this case, we are communicating with a new image transport 296 // In this case, we are communicating with a new image transport
297 // surface and must ACK with the new ID's and an empty mailbox. 297 // surface and must ACK with the new ID's and an empty mailbox.
298 if (last_route_id_ != mailbox.route_id || 298 if (last_route_id_ != mailbox.route_id ||
299 last_output_surface_id_ != mailbox.output_surface_id || 299 last_output_surface_id_ != mailbox.output_surface_id ||
300 last_host_id_ != mailbox.host_id) 300 last_host_id_ != mailbox.host_id)
301 last_mailbox_valid_ = false; 301 last_mailbox_valid_ = false;
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 } 344 }
345 345
346 cc::TextureMailbox texture_mailbox; 346 cc::TextureMailbox texture_mailbox;
347 scoped_ptr<cc::SingleReleaseCallback> release_callback; 347 scoped_ptr<cc::SingleReleaseCallback> release_callback;
348 if (current_mailbox_valid) { 348 if (current_mailbox_valid) {
349 release_callback = 349 release_callback =
350 cc::SingleReleaseCallback::Create( 350 cc::SingleReleaseCallback::Create(
351 base::Bind(&ChildFrameCompositingHelper::MailboxReleased, 351 base::Bind(&ChildFrameCompositingHelper::MailboxReleased,
352 scoped_refptr<ChildFrameCompositingHelper>(this), 352 scoped_refptr<ChildFrameCompositingHelper>(this),
353 mailbox)).Pass(); 353 mailbox)).Pass();
354 if (is_software_frame) 354 if (is_software_frame) {
355 texture_mailbox = cc::TextureMailbox(mailbox.shared_memory, mailbox.size); 355 texture_mailbox = cc::TextureMailbox(mailbox.shared_memory, mailbox.size);
356 else 356 } else {
357 texture_mailbox = cc::TextureMailbox(mailbox.name, sync_point); 357 texture_mailbox =
358 cc::TextureMailbox(mailbox.name, GL_TEXTURE_2D, sync_point);
359 }
358 } 360 }
359 361
360 texture_layer_->SetFlipped(!is_software_frame); 362 texture_layer_->SetFlipped(!is_software_frame);
361 texture_layer_->SetTextureMailbox(texture_mailbox, release_callback.Pass()); 363 texture_layer_->SetTextureMailbox(texture_mailbox, release_callback.Pass());
362 texture_layer_->SetNeedsDisplay(); 364 texture_layer_->SetNeedsDisplay();
363 last_mailbox_valid_ = current_mailbox_valid; 365 last_mailbox_valid_ = current_mailbox_valid;
364 } 366 }
365 367
366 void ChildFrameCompositingHelper::OnBuffersSwapped( 368 void ChildFrameCompositingHelper::OnBuffersSwapped(
367 const gfx::Size& size, 369 const gfx::Size& size,
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
543 skia::ImageOperations::RESIZE_BEST, 545 skia::ImageOperations::RESIZE_BEST,
544 dest_size.width(), 546 dest_size.width(),
545 dest_size.height()); 547 dest_size.height());
546 } 548 }
547 browser_plugin_manager_->Send( 549 browser_plugin_manager_->Send(
548 new BrowserPluginHostMsg_CopyFromCompositingSurfaceAck( 550 new BrowserPluginHostMsg_CopyFromCompositingSurfaceAck(
549 host_routing_id_, instance_id_, request_id, resized_bitmap)); 551 host_routing_id_, instance_id_, request_id, resized_bitmap));
550 } 552 }
551 553
552 } // namespace content 554 } // 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