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

Side by Side Diff: cc/surfaces/surface.cc

Issue 1088883004: Revert of Use null rather than empty frame to lock Surface resources (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 unified diff | Download patch
« no previous file with comments | « no previous file | cc/surfaces/surface_display_output_surface.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/surfaces/surface.h" 5 #include "cc/surfaces/surface.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "cc/output/compositor_frame.h" 9 #include "cc/output/compositor_frame.h"
10 #include "cc/output/copy_output_request.h" 10 #include "cc/output/copy_output_request.h"
(...skipping 23 matching lines...) Expand all
34 factory_->UnrefResources(current_resources); 34 factory_->UnrefResources(current_resources);
35 } 35 }
36 if (!draw_callback_.is_null()) 36 if (!draw_callback_.is_null())
37 draw_callback_.Run(SurfaceDrawStatus::DRAW_SKIPPED); 37 draw_callback_.Run(SurfaceDrawStatus::DRAW_SKIPPED);
38 } 38 }
39 39
40 void Surface::QueueFrame(scoped_ptr<CompositorFrame> frame, 40 void Surface::QueueFrame(scoped_ptr<CompositorFrame> frame,
41 const DrawCallback& callback) { 41 const DrawCallback& callback) {
42 DCHECK(factory_); 42 DCHECK(factory_);
43 ClearCopyRequests(); 43 ClearCopyRequests();
44 44 TakeLatencyInfo(&frame->metadata.latency_info);
45 if (frame) {
46 TakeLatencyInfo(&frame->metadata.latency_info);
47 }
48
49 scoped_ptr<CompositorFrame> previous_frame = current_frame_.Pass(); 45 scoped_ptr<CompositorFrame> previous_frame = current_frame_.Pass();
50 current_frame_ = frame.Pass(); 46 current_frame_ = frame.Pass();
51 47 factory_->ReceiveFromChild(
52 if (current_frame_) { 48 current_frame_->delegated_frame_data->resource_list);
53 factory_->ReceiveFromChild(
54 current_frame_->delegated_frame_data->resource_list);
55 }
56
57 // Empty frames shouldn't be drawn and shouldn't contribute damage, so don't 49 // Empty frames shouldn't be drawn and shouldn't contribute damage, so don't
58 // increment frame index for them. 50 // increment frame index for them.
59 if (!current_frame_ || 51 if (!current_frame_ ||
60 !current_frame_->delegated_frame_data->render_pass_list.empty()) 52 !current_frame_->delegated_frame_data->render_pass_list.empty())
61 ++frame_index_; 53 ++frame_index_;
62 54
63 if (previous_frame) { 55 if (previous_frame) {
64 ReturnedResourceArray previous_resources; 56 ReturnedResourceArray previous_resources;
65 TransferableResource::ReturnResources( 57 TransferableResource::ReturnResources(
66 previous_frame->delegated_frame_data->resource_list, 58 previous_frame->delegated_frame_data->resource_list,
67 &previous_resources); 59 &previous_resources);
68 factory_->UnrefResources(previous_resources); 60 factory_->UnrefResources(previous_resources);
69 } 61 }
70 if (!draw_callback_.is_null()) 62 if (!draw_callback_.is_null())
71 draw_callback_.Run(SurfaceDrawStatus::DRAW_SKIPPED); 63 draw_callback_.Run(SurfaceDrawStatus::DRAW_SKIPPED);
72 draw_callback_ = callback; 64 draw_callback_ = callback;
73 65 factory_->manager()->DidSatisfySequences(
74 if (current_frame_) { 66 SurfaceIdAllocator::NamespaceForId(surface_id_),
75 factory_->manager()->DidSatisfySequences( 67 &current_frame_->metadata.satisfies_sequences);
76 SurfaceIdAllocator::NamespaceForId(surface_id_),
77 &current_frame_->metadata.satisfies_sequences);
78 }
79 } 68 }
80 69
81 void Surface::RequestCopyOfOutput(scoped_ptr<CopyOutputRequest> copy_request) { 70 void Surface::RequestCopyOfOutput(scoped_ptr<CopyOutputRequest> copy_request) {
82 if (current_frame_ && 71 if (current_frame_ &&
83 !current_frame_->delegated_frame_data->render_pass_list.empty()) 72 !current_frame_->delegated_frame_data->render_pass_list.empty())
84 current_frame_->delegated_frame_data->render_pass_list.back() 73 current_frame_->delegated_frame_data->render_pass_list.back()
85 ->copy_requests.push_back(copy_request.Pass()); 74 ->copy_requests.push_back(copy_request.Pass());
86 else 75 else
87 copy_request->SendEmptyResult(); 76 copy_request->SendEmptyResult();
88 } 77 }
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 if (current_frame_) { 135 if (current_frame_) {
147 for (const auto& render_pass : 136 for (const auto& render_pass :
148 current_frame_->delegated_frame_data->render_pass_list) { 137 current_frame_->delegated_frame_data->render_pass_list) {
149 for (const auto& copy_request : render_pass->copy_requests) 138 for (const auto& copy_request : render_pass->copy_requests)
150 copy_request->SendEmptyResult(); 139 copy_request->SendEmptyResult();
151 } 140 }
152 } 141 }
153 } 142 }
154 143
155 } // namespace cc 144 } // namespace cc
OLDNEW
« 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