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

Unified Diff: content/test/mailbox_output_surface.cc

Issue 2096493002: Make cc::CompositorFrames movable [Part 1 of 2] (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed Dana's nits Created 4 years, 6 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
« no previous file with comments | « content/test/mailbox_output_surface.h ('k') | content/test/test_render_view_host.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/test/mailbox_output_surface.cc
diff --git a/content/test/mailbox_output_surface.cc b/content/test/mailbox_output_surface.cc
index 4f4dd0d03a51642f9836e588c6465d944bfa924a..cbb05d1bd96e8eb8008e4bade4af86cfee17dd6a 100644
--- a/content/test/mailbox_output_surface.cc
+++ b/content/test/mailbox_output_surface.cc
@@ -203,62 +203,62 @@ void MailboxOutputSurface::OnSwapAck(uint32_t output_surface_id,
ReclaimResources(&ack);
client_->DidSwapBuffersComplete();
-}
-
-void MailboxOutputSurface::ShortcutSwapAck(
- uint32_t output_surface_id,
- std::unique_ptr<cc::GLFrameData> gl_frame_data) {
- if (!previous_frame_ack_) {
- previous_frame_ack_.reset(new cc::CompositorFrameAck);
- previous_frame_ack_->gl_frame_data.reset(new cc::GLFrameData);
}
- OnSwapAck(output_surface_id, *previous_frame_ack_);
+ void MailboxOutputSurface::ShortcutSwapAck(
+ uint32_t output_surface_id,
+ std::unique_ptr<cc::GLFrameData> gl_frame_data) {
+ if (!previous_frame_ack_) {
+ previous_frame_ack_.reset(new cc::CompositorFrameAck);
+ previous_frame_ack_->gl_frame_data.reset(new cc::GLFrameData);
+ }
- previous_frame_ack_->gl_frame_data = std::move(gl_frame_data);
-}
+ OnSwapAck(output_surface_id, *previous_frame_ack_);
+
+ previous_frame_ack_->gl_frame_data = std::move(gl_frame_data);
+ }
+
+ void MailboxOutputSurface::SwapBuffers(cc::CompositorFrame frame) {
+ // This class is here to support layout tests that are currently
+ // doing a readback in the renderer instead of the browser. So they
+ // are using deprecated code paths in the renderer and don't need to
+ // actually swap anything to the browser. We shortcut the swap to the
+ // browser here and just ack directly within the renderer process.
+ // Once crbug.com/311404 is fixed, this can be removed.
+
+ // This would indicate that crbug.com/311404 is being fixed, and this
+ // block needs to be removed.
+ DCHECK(!frame.delegated_frame_data);
+
+ DCHECK(frame.gl_frame_data);
+ DCHECK(!surface_size_.IsEmpty());
+ DCHECK(surface_size_ == current_backing_.size);
+ DCHECK(frame.gl_frame_data->size == current_backing_.size);
+ DCHECK(!current_backing_.mailbox.IsZero() ||
+ context_provider_->ContextGL()->GetGraphicsResetStatusKHR() !=
+ GL_NO_ERROR);
+
+ frame.gl_frame_data->mailbox = current_backing_.mailbox;
+
+ gpu::gles2::GLES2Interface* gl = context_provider_->ContextGL();
+
+ const GLuint64 fence_sync = gl->InsertFenceSyncCHROMIUM();
+ gl->Flush();
+ gl->GenSyncTokenCHROMIUM(fence_sync,
+ frame.gl_frame_data->sync_token.GetData());
+
+ // Copy the |sync_token| out of the GLFrameData before moving it into the
+ // closure.
+ gpu::SyncToken sync_token = frame.gl_frame_data->sync_token;
+ context_provider()->ContextSupport()->SignalSyncToken(
+ sync_token, base::Bind(&MailboxOutputSurface::ShortcutSwapAck,
+ weak_ptrs_.GetWeakPtr(), output_surface_id_,
+ base::Passed(&frame.gl_frame_data)));
+
+ pending_textures_.push_back(current_backing_);
+ current_backing_ = TransferableFrame();
-void MailboxOutputSurface::SwapBuffers(cc::CompositorFrame* frame) {
- // This class is here to support layout tests that are currently
- // doing a readback in the renderer instead of the browser. So they
- // are using deprecated code paths in the renderer and don't need to
- // actually swap anything to the browser. We shortcut the swap to the
- // browser here and just ack directly within the renderer process.
- // Once crbug.com/311404 is fixed, this can be removed.
-
- // This would indicate that crbug.com/311404 is being fixed, and this
- // block needs to be removed.
- DCHECK(!frame->delegated_frame_data);
-
- DCHECK(frame->gl_frame_data);
- DCHECK(!surface_size_.IsEmpty());
- DCHECK(surface_size_ == current_backing_.size);
- DCHECK(frame->gl_frame_data->size == current_backing_.size);
- DCHECK(!current_backing_.mailbox.IsZero() ||
- context_provider_->ContextGL()->GetGraphicsResetStatusKHR() !=
- GL_NO_ERROR);
-
- frame->gl_frame_data->mailbox = current_backing_.mailbox;
-
- gpu::gles2::GLES2Interface* gl = context_provider_->ContextGL();
-
- const GLuint64 fence_sync = gl->InsertFenceSyncCHROMIUM();
- gl->Flush();
- gl->GenSyncTokenCHROMIUM(fence_sync,
- frame->gl_frame_data->sync_token.GetData());
-
- // Copy the |sync_token| out of the GLFrameData before moving it into the
- // closure.
- gpu::SyncToken sync_token = frame->gl_frame_data->sync_token;
- context_provider()->ContextSupport()->SignalSyncToken(
- sync_token, base::Bind(&MailboxOutputSurface::ShortcutSwapAck,
- weak_ptrs_.GetWeakPtr(), output_surface_id_,
- base::Passed(&frame->gl_frame_data)));
-
- pending_textures_.push_back(current_backing_);
- current_backing_ = TransferableFrame();
-
- client_->DidSwapBuffers();
+ client_->DidSwapBuffers();
}
MailboxOutputSurface::TransferableFrame::TransferableFrame() : texture_id(0) {}
« no previous file with comments | « content/test/mailbox_output_surface.h ('k') | content/test/test_render_view_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698