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

Unified Diff: cc/layers/layer.cc

Issue 2017263002: cc: Move copy requests from layers to the effect tree (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix typo in comment Created 4 years, 7 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 | « cc/layers/layer.h ('k') | cc/layers/layer_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/layers/layer.cc
diff --git a/cc/layers/layer.cc b/cc/layers/layer.cc
index 4aaeade757203fe7437a3619fd88e2218636e3de..14f0c00ac7322239d68d5fa159a3d3be3b2b8cfb 100644
--- a/cc/layers/layer.cc
+++ b/cc/layers/layer.cc
@@ -1207,29 +1207,6 @@ void Layer::PushPropertiesTo(LayerImpl* layer) {
->property_trees()
->scroll_tree.SetScrollOffsetClobberActiveValue(layer->id());
- {
- TRACE_EVENT0("cc", "Layer::PushPropertiesTo::CopyOutputRequests");
- // Wrap the copy_requests_ in a PostTask to the main thread.
- std::vector<std::unique_ptr<CopyOutputRequest>> main_thread_copy_requests;
- for (auto it = copy_requests_.begin(); it != copy_requests_.end(); ++it) {
- scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner =
- layer_tree_host()->task_runner_provider()->MainThreadTaskRunner();
- std::unique_ptr<CopyOutputRequest> original_request = std::move(*it);
- const CopyOutputRequest& original_request_ref = *original_request;
- std::unique_ptr<CopyOutputRequest> main_thread_request =
- CopyOutputRequest::CreateRelayRequest(
- original_request_ref,
- base::Bind(&PostCopyCallbackToMainThread, main_thread_task_runner,
- base::Passed(&original_request)));
- main_thread_copy_requests.push_back(std::move(main_thread_request));
- }
- if (!copy_requests_.empty() && layer_tree_host_)
- layer_tree_host_->property_trees()->needs_rebuild = true;
-
- copy_requests_.clear();
- layer->PassCopyRequests(&main_thread_copy_requests);
- }
-
// If the main thread commits multiple times before the impl thread actually
// draws, then damage tracking will become incorrect if we simply clobber the
// update_rect here. The LayerImpl's update_rect needs to accumulate (i.e.
@@ -1246,6 +1223,28 @@ void Layer::PushPropertiesTo(LayerImpl* layer) {
layer_tree_host()->RemoveLayerShouldPushProperties(this);
}
+void Layer::TakeCopyRequests(
+ std::vector<std::unique_ptr<CopyOutputRequest>>* requests) {
+ for (auto& it : copy_requests_) {
+ scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner =
+ layer_tree_host()->task_runner_provider()->MainThreadTaskRunner();
+ std::unique_ptr<CopyOutputRequest> original_request = std::move(it);
+ const CopyOutputRequest& original_request_ref = *original_request;
+ std::unique_ptr<CopyOutputRequest> main_thread_request =
+ CopyOutputRequest::CreateRelayRequest(
+ original_request_ref,
+ base::Bind(&PostCopyCallbackToMainThread, main_thread_task_runner,
+ base::Passed(&original_request)));
+ if (main_thread_request->has_area()) {
+ main_thread_request->set_area(gfx::IntersectRects(
+ main_thread_request->area(), gfx::Rect(bounds())));
+ }
+ requests->push_back(std::move(main_thread_request));
+ }
+
+ copy_requests_.clear();
+}
+
void Layer::SetTypeForProtoSerialization(proto::LayerNode* proto) const {
proto->set_type(proto::LayerNode::LAYER);
}
« no previous file with comments | « cc/layers/layer.h ('k') | cc/layers/layer_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698