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

Unified Diff: content/renderer/gpu/mailbox_output_surface.cc

Issue 19331002: Associate an id with the output surface to handle lost contexts (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 side-by-side diff with in-line comments
Download patch
Index: content/renderer/gpu/mailbox_output_surface.cc
diff --git a/content/renderer/gpu/mailbox_output_surface.cc b/content/renderer/gpu/mailbox_output_surface.cc
index 8af117d2aa453354bdc95244273de237cfc03254..63989cb06bcaadea7cd2907100db0dfe6bcf4d5f 100644
--- a/content/renderer/gpu/mailbox_output_surface.cc
+++ b/content/renderer/gpu/mailbox_output_surface.cc
@@ -20,9 +20,14 @@ namespace content {
MailboxOutputSurface::MailboxOutputSurface(
int32 routing_id,
+ uint32 output_surface_id,
WebGraphicsContext3DCommandBufferImpl* context3D,
cc::SoftwareOutputDevice* software_device)
- : CompositorOutputSurface(routing_id, context3D, software_device, true),
+ : CompositorOutputSurface(routing_id,
+ output_surface_id,
+ context3D,
+ software_device,
+ true),
fbo_(0),
is_backbuffer_discarded_(false) {
pending_textures_.push_back(TransferableFrame());
@@ -123,7 +128,14 @@ void MailboxOutputSurface::BindFramebuffer() {
current_backing_.texture_id, 0);
}
-void MailboxOutputSurface::OnSwapAck(const cc::CompositorFrameAck& ack) {
+void MailboxOutputSurface::OnSwapAck(uint32 output_surface_id,
+ const cc::CompositorFrameAck& ack) {
+ // Ignore message if it's a stale one coming from a different output surface
+ // (e.g. after a lost context).
+ if (output_surface_id != output_surface_id_) {
+ CompositorOutputSurface::OnSwapAck(output_surface_id, ack);
+ return;
+ }
if (!ack.gl_frame_data->mailbox.IsZero()) {
DCHECK(!ack.gl_frame_data->size.IsEmpty());
// The browser could be returning the oldest or any other pending texture
@@ -158,7 +170,7 @@ void MailboxOutputSurface::OnSwapAck(const cc::CompositorFrameAck& ack) {
context3d_->deleteTexture(texture_id);
pending_textures_.pop_front();
}
- CompositorOutputSurface::OnSwapAck(ack);
+ CompositorOutputSurface::OnSwapAck(output_surface_id, ack);
}
void MailboxOutputSurface::SwapBuffers(cc::CompositorFrame* frame) {

Powered by Google App Engine
This is Rietveld 408576698