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

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

Issue 706203003: Update from https://crrev.com/303153 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 1 month 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 | « cc/surfaces/surface.h ('k') | cc/surfaces/surface_factory.h » ('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"
11 #include "cc/surfaces/surface_factory.h" 11 #include "cc/surfaces/surface_factory.h"
12 #include "cc/surfaces/surface_id_allocator.h"
12 #include "cc/surfaces/surface_manager.h" 13 #include "cc/surfaces/surface_manager.h"
13 14
14 namespace cc { 15 namespace cc {
15 16
16 // The frame index starts at 2 so that empty frames will be treated as 17 // The frame index starts at 2 so that empty frames will be treated as
17 // completely damaged the first time they're drawn from. 18 // completely damaged the first time they're drawn from.
18 static const int kFrameIndexStart = 2; 19 static const int kFrameIndexStart = 2;
19 20
20 Surface::Surface(SurfaceId id, const gfx::Size& size, SurfaceFactory* factory) 21 Surface::Surface(SurfaceId id, const gfx::Size& size, SurfaceFactory* factory)
21 : surface_id_(id), 22 : surface_id_(id),
(...skipping 28 matching lines...) Expand all
50 ReturnedResourceArray previous_resources; 51 ReturnedResourceArray previous_resources;
51 TransferableResource::ReturnResources( 52 TransferableResource::ReturnResources(
52 previous_frame->delegated_frame_data->resource_list, 53 previous_frame->delegated_frame_data->resource_list,
53 &previous_resources); 54 &previous_resources);
54 factory_->UnrefResources(previous_resources); 55 factory_->UnrefResources(previous_resources);
55 } 56 }
56 if (!draw_callback_.is_null()) 57 if (!draw_callback_.is_null())
57 draw_callback_.Run(); 58 draw_callback_.Run();
58 draw_callback_ = callback; 59 draw_callback_ = callback;
59 factory_->manager()->DidSatisfySequences( 60 factory_->manager()->DidSatisfySequences(
60 surface_id_, &current_frame_->metadata.satisfies_sequences); 61 SurfaceIdAllocator::NamespaceForId(surface_id_),
62 &current_frame_->metadata.satisfies_sequences);
61 } 63 }
62 64
63 void Surface::RequestCopyOfOutput(scoped_ptr<CopyOutputRequest> copy_request) { 65 void Surface::RequestCopyOfOutput(scoped_ptr<CopyOutputRequest> copy_request) {
64 if (current_frame_ && 66 if (current_frame_ &&
65 !current_frame_->delegated_frame_data->render_pass_list.empty()) 67 !current_frame_->delegated_frame_data->render_pass_list.empty())
66 current_frame_->delegated_frame_data->render_pass_list.back() 68 current_frame_->delegated_frame_data->render_pass_list.back()
67 ->copy_requests.push_back(copy_request.Pass()); 69 ->copy_requests.push_back(copy_request.Pass());
68 else 70 else
69 copy_request->SendEmptyResult(); 71 copy_request->SendEmptyResult();
70 } 72 }
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 } 106 }
105 107
106 void Surface::RunDrawCallbacks() { 108 void Surface::RunDrawCallbacks() {
107 if (!draw_callback_.is_null()) { 109 if (!draw_callback_.is_null()) {
108 base::Closure callback = draw_callback_; 110 base::Closure callback = draw_callback_;
109 draw_callback_ = base::Closure(); 111 draw_callback_ = base::Closure();
110 callback.Run(); 112 callback.Run();
111 } 113 }
112 } 114 }
113 115
116 void Surface::AddDestructionDependency(SurfaceSequence sequence) {
117 destruction_dependencies_.push_back(sequence);
118 }
119
120 void Surface::SatisfyDestructionDependencies(
121 base::hash_set<SurfaceSequence>* sequences) {
122 destruction_dependencies_.erase(
123 std::remove_if(
124 destruction_dependencies_.begin(), destruction_dependencies_.end(),
125 [sequences](SurfaceSequence seq) { return !!sequences->erase(seq); }),
126 destruction_dependencies_.end());
127 }
128
114 void Surface::ClearCopyRequests() { 129 void Surface::ClearCopyRequests() {
115 if (current_frame_) { 130 if (current_frame_) {
116 for (const auto& render_pass : 131 for (const auto& render_pass :
117 current_frame_->delegated_frame_data->render_pass_list) { 132 current_frame_->delegated_frame_data->render_pass_list) {
118 for (const auto& copy_request : render_pass->copy_requests) 133 for (const auto& copy_request : render_pass->copy_requests)
119 copy_request->SendEmptyResult(); 134 copy_request->SendEmptyResult();
120 } 135 }
121 } 136 }
122 } 137 }
123 138
124 } // namespace cc 139 } // namespace cc
OLDNEW
« no previous file with comments | « cc/surfaces/surface.h ('k') | cc/surfaces/surface_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698