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

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: Using base::Optional instead of boolean 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..93a79061610194c9acce049ec518719772ea3694 100644
--- a/content/browser/android/synchronous_compositor_host.cc
+++ b/content/browser/android/synchronous_compositor_host.cc
@@ -121,19 +121,20 @@ SynchronousCompositor::Frame SynchronousCompositorHost::DemandDrawHw(
viewport_rect_for_tile_priority,
transform_for_tile_priority);
uint32_t compositor_frame_sink_id;
- cc::CompositorFrame compositor_frame;
+ base::Optional<cc::CompositorFrame> compositor_frame;
SyncCompositorCommonRendererParams common_renderer_params;
if (!sender_->Send(new SyncCompositorMsg_DemandDrawHw(
routing_id_, params, &common_renderer_params,
- &compositor_frame_sink_id, &compositor_frame))) {
+ &compositor_frame_sink_id, &compositor_frame)) ||
+ !compositor_frame) {
boliu 2016/10/27 19:52:15 not quite the same. ProcessHardwareFrame can be sk
return SynchronousCompositor::Frame();
}
ProcessCommonParams(common_renderer_params);
return ProcessHardwareFrame(compositor_frame_sink_id,
- std::move(compositor_frame));
+ std::move(*compositor_frame));
}
SynchronousCompositor::Frame SynchronousCompositorHost::ProcessHardwareFrame(
@@ -143,13 +144,7 @@ SynchronousCompositor::Frame SynchronousCompositorHost::ProcessHardwareFrame(
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) {
- UpdateFrameMetaData(frame.frame->metadata.Clone());
- }
+ UpdateFrameMetaData(frame.frame->metadata.Clone());
return frame;
}

Powered by Google App Engine
This is Rietveld 408576698