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

Unified Diff: content/browser/android/synchronous_compositor_host.cc

Issue 2458743002: Switching to base::Optional<CompositorFrame> in Android's synchronous compositor IPC messages (Closed)
Patch Set: Created 4 years, 2 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/browser/android/synchronous_compositor_host.cc
diff --git a/content/browser/android/synchronous_compositor_host.cc b/content/browser/android/synchronous_compositor_host.cc
index eb5a90fa6d0287d38f18ce369f439becf52ab5f9..cd1653efb1044b20281b7bc61d76af8d01af20e9 100644
--- a/content/browser/android/synchronous_compositor_host.cc
+++ b/content/browser/android/synchronous_compositor_host.cc
@@ -123,33 +123,32 @@ SynchronousCompositor::Frame SynchronousCompositorHost::DemandDrawHw(
uint32_t compositor_frame_sink_id;
cc::CompositorFrame compositor_frame;
SyncCompositorCommonRendererParams common_renderer_params;
+ bool has_swapped;
boliu 2016/10/27 18:11:46 initialize to false
if (!sender_->Send(new SyncCompositorMsg_DemandDrawHw(
routing_id_, params, &common_renderer_params,
- &compositor_frame_sink_id, &compositor_frame))) {
+ &compositor_frame_sink_id, &compositor_frame, &has_swapped))) {
return SynchronousCompositor::Frame();
}
ProcessCommonParams(common_renderer_params);
return ProcessHardwareFrame(compositor_frame_sink_id,
boliu 2016/10/27 18:11:46 just return empty frame if false, rather than pass
- std::move(compositor_frame));
+ std::move(compositor_frame), has_swapped);
}
SynchronousCompositor::Frame SynchronousCompositorHost::ProcessHardwareFrame(
uint32_t compositor_frame_sink_id,
- cc::CompositorFrame compositor_frame) {
+ cc::CompositorFrame compositor_frame,
+ bool has_swapped) {
SynchronousCompositor::Frame frame;
frame.frame.reset(new cc::CompositorFrame);
frame.compositor_frame_sink_id = compositor_frame_sink_id;
*frame.frame = std::move(compositor_frame);
- if (!frame.frame->delegated_frame_data) {
- // This can happen if compositor did not swap in this draw.
- frame.frame.reset();
- }
- if (frame.frame) {
+ if (has_swapped)
UpdateFrameMetaData(frame.frame->metadata.Clone());
- }
+ else
+ frame.frame.reset();
return frame;
}

Powered by Google App Engine
This is Rietveld 408576698