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

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

Issue 683113005: Update from chromium https://crrev.com/302282 (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/display.cc ('k') | cc/surfaces/surface_aggregator.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>
8
7 #include "cc/output/compositor_frame.h" 9 #include "cc/output/compositor_frame.h"
8 #include "cc/output/copy_output_request.h" 10 #include "cc/output/copy_output_request.h"
9 #include "cc/surfaces/surface_factory.h" 11 #include "cc/surfaces/surface_factory.h"
10 #include "cc/surfaces/surface_manager.h" 12 #include "cc/surfaces/surface_manager.h"
11 13
12 namespace cc { 14 namespace cc {
13 15
14 // The frame index starts at 2 so that empty frames will be treated as 16 // The frame index starts at 2 so that empty frames will be treated as
15 // completely damaged the first time they're drawn from. 17 // completely damaged the first time they're drawn from.
16 static const int kFrameIndexStart = 2; 18 static const int kFrameIndexStart = 2;
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 current_frame_->delegated_frame_data->render_pass_list.back() 66 current_frame_->delegated_frame_data->render_pass_list.back()
65 ->copy_requests.push_back(copy_request.Pass()); 67 ->copy_requests.push_back(copy_request.Pass());
66 else 68 else
67 copy_request->SendEmptyResult(); 69 copy_request->SendEmptyResult();
68 } 70 }
69 71
70 void Surface::TakeCopyOutputRequests( 72 void Surface::TakeCopyOutputRequests(
71 std::multimap<RenderPassId, CopyOutputRequest*>* copy_requests) { 73 std::multimap<RenderPassId, CopyOutputRequest*>* copy_requests) {
72 DCHECK(copy_requests->empty()); 74 DCHECK(copy_requests->empty());
73 if (current_frame_) { 75 if (current_frame_) {
74 for (auto* render_pass : 76 for (const auto& render_pass :
75 current_frame_->delegated_frame_data->render_pass_list) { 77 current_frame_->delegated_frame_data->render_pass_list) {
76 while (!render_pass->copy_requests.empty()) { 78 while (!render_pass->copy_requests.empty()) {
77 scoped_ptr<CopyOutputRequest> request = 79 scoped_ptr<CopyOutputRequest> request =
78 render_pass->copy_requests.take_back(); 80 render_pass->copy_requests.take_back();
79 render_pass->copy_requests.pop_back(); 81 render_pass->copy_requests.pop_back();
80 copy_requests->insert( 82 copy_requests->insert(
81 std::make_pair(render_pass->id, request.release())); 83 std::make_pair(render_pass->id, request.release()));
82 } 84 }
83 } 85 }
84 } 86 }
(...skipping 19 matching lines...) Expand all
104 void Surface::RunDrawCallbacks() { 106 void Surface::RunDrawCallbacks() {
105 if (!draw_callback_.is_null()) { 107 if (!draw_callback_.is_null()) {
106 base::Closure callback = draw_callback_; 108 base::Closure callback = draw_callback_;
107 draw_callback_ = base::Closure(); 109 draw_callback_ = base::Closure();
108 callback.Run(); 110 callback.Run();
109 } 111 }
110 } 112 }
111 113
112 void Surface::ClearCopyRequests() { 114 void Surface::ClearCopyRequests() {
113 if (current_frame_) { 115 if (current_frame_) {
114 for (auto* render_pass : 116 for (const auto& render_pass :
115 current_frame_->delegated_frame_data->render_pass_list) { 117 current_frame_->delegated_frame_data->render_pass_list) {
116 for (auto* copy_request : render_pass->copy_requests) 118 for (const auto& copy_request : render_pass->copy_requests)
117 copy_request->SendEmptyResult(); 119 copy_request->SendEmptyResult();
118 } 120 }
119 } 121 }
120 } 122 }
121 123
122 } // namespace cc 124 } // namespace cc
OLDNEW
« no previous file with comments | « cc/surfaces/display.cc ('k') | cc/surfaces/surface_aggregator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698