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

Unified Diff: cc/surfaces/surface.cc

Issue 1073323002: Use null rather than empty frame to lock Surface resources (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix frame_index_ incrementing Created 5 years, 8 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 | « no previous file | cc/surfaces/surface_display_output_surface.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/surfaces/surface.cc
diff --git a/cc/surfaces/surface.cc b/cc/surfaces/surface.cc
index 065aa3822895dec4fdd64bb8d520c1aa80d45b58..97575813f489a415f91200917efa0f14dd47d7a6 100644
--- a/cc/surfaces/surface.cc
+++ b/cc/surfaces/surface.cc
@@ -41,14 +41,22 @@ void Surface::QueueFrame(scoped_ptr<CompositorFrame> frame,
const DrawCallback& callback) {
DCHECK(factory_);
ClearCopyRequests();
- TakeLatencyInfo(&frame->metadata.latency_info);
+
+ if (frame) {
+ TakeLatencyInfo(&frame->metadata.latency_info);
+ }
+
scoped_ptr<CompositorFrame> previous_frame = current_frame_.Pass();
current_frame_ = frame.Pass();
- factory_->ReceiveFromChild(
- current_frame_->delegated_frame_data->resource_list);
+
+ if (current_frame_) {
+ factory_->ReceiveFromChild(
+ current_frame_->delegated_frame_data->resource_list);
+ }
+
// Empty frames shouldn't be drawn and shouldn't contribute damage, so don't
// increment frame index for them.
- if (!current_frame_ ||
+ if (current_frame_ &&
!current_frame_->delegated_frame_data->render_pass_list.empty())
++frame_index_;
@@ -62,9 +70,12 @@ void Surface::QueueFrame(scoped_ptr<CompositorFrame> frame,
if (!draw_callback_.is_null())
draw_callback_.Run(SurfaceDrawStatus::DRAW_SKIPPED);
draw_callback_ = callback;
- factory_->manager()->DidSatisfySequences(
- SurfaceIdAllocator::NamespaceForId(surface_id_),
- &current_frame_->metadata.satisfies_sequences);
+
+ if (current_frame_) {
+ factory_->manager()->DidSatisfySequences(
+ SurfaceIdAllocator::NamespaceForId(surface_id_),
+ &current_frame_->metadata.satisfies_sequences);
+ }
}
void Surface::RequestCopyOfOutput(scoped_ptr<CopyOutputRequest> copy_request) {
« no previous file with comments | « no previous file | cc/surfaces/surface_display_output_surface.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698