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

Unified Diff: cc/layers/layer_impl.cc

Issue 14060015: cc: Async readback. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 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 | « cc/layers/layer_impl.h ('k') | cc/output/direct_renderer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/layers/layer_impl.cc
diff --git a/cc/layers/layer_impl.cc b/cc/layers/layer_impl.cc
index aec8cd28978ae383824e7aee29b011456702a696..f7aecf1a4e8121a27e7b46a49f3fb6c272f781c2 100644
--- a/cc/layers/layer_impl.cc
+++ b/cc/layers/layer_impl.cc
@@ -69,6 +69,10 @@ LayerImpl::~LayerImpl() {
#ifndef NDEBUG
DCHECK(!between_will_draw_and_did_draw_);
#endif
+
+ for (size_t i = 0; i < request_copy_callbacks_.size(); ++i)
+ request_copy_callbacks_[i].Run(scoped_ptr<SkBitmap>());
+
layer_tree_impl_->UnregisterLayer(this);
layer_animation_controller_->RemoveValueObserver(this);
}
@@ -102,6 +106,30 @@ void LayerImpl::ClearChildList() {
layer_tree_impl()->set_needs_update_draw_properties();
}
+void LayerImpl::PassRequestCopyCallbacks(
+ std::vector<RenderPass::RequestCopyAsBitmapCallback>* callbacks) {
+ if (callbacks->empty())
+ return;
+
+ request_copy_callbacks_.insert(request_copy_callbacks_.end(),
+ callbacks->begin(),
+ callbacks->end());
+ callbacks->clear();
+
+ NoteLayerPropertyChangedForSubtree();
+}
+
+void LayerImpl::TakeRequestCopyCallbacks(
+ std::vector<RenderPass::RequestCopyAsBitmapCallback>* callbacks) {
+ if (request_copy_callbacks_.empty())
+ return;
+
+ callbacks->insert(callbacks->end(),
+ request_copy_callbacks_.begin(),
+ request_copy_callbacks_.end());
+ request_copy_callbacks_.clear();
+}
+
void LayerImpl::CreateRenderSurface() {
DCHECK(!draw_properties_.render_surface);
draw_properties_.render_surface =
@@ -351,6 +379,8 @@ void LayerImpl::PushPropertiesTo(LayerImpl* layer) {
layer->SetScrollOffset(scroll_offset_);
layer->SetMaxScrollOffset(max_scroll_offset_);
+ layer->PassRequestCopyCallbacks(&request_copy_callbacks_);
+
// 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.
« no previous file with comments | « cc/layers/layer_impl.h ('k') | cc/output/direct_renderer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698