Index: cc/layers/layer.h |
diff --git a/cc/layers/layer.h b/cc/layers/layer.h |
index 84119649773f43d3e1decfa18041c772ad49e81e..a35d7a5df308255829ab2c3a62c1c5346756f618 100644 |
--- a/cc/layers/layer.h |
+++ b/cc/layers/layer.h |
@@ -8,6 +8,7 @@ |
#include <string> |
#include <vector> |
+#include "base/callback.h" |
#include "base/memory/ref_counted.h" |
#include "base/observer_list.h" |
#include "cc/animation/layer_animation_controller.h" |
@@ -76,6 +77,18 @@ class CC_EXPORT Layer : public base::RefCounted<Layer>, |
const LayerList& children() const { return children_; } |
Layer* child_at(size_t index) { return children_[index].get(); } |
+ typedef base::Callback<void(scoped_ptr<SkBitmap>)> |
+ RequestCopyAsBitmapCallback; |
+ |
+ // This requests the layer and its subtree be rendered into an SkBitmap and |
+ // call the given callback when the SkBitmap has been produced. If the copy |
+ // is unable to be produced (the layer is destroyed first), then the callback |
+ // is called with a NULL bitmap. |
+ void RequestCopyAsBitmap(RequestCopyAsBitmapCallback callback); |
+ bool HasRequestCopyCallback() const { |
+ return !request_copy_callbacks_.empty(); |
+ } |
+ |
void SetAnchorPoint(gfx::PointF anchor_point); |
gfx::PointF anchor_point() const { return anchor_point_; } |
@@ -480,6 +493,8 @@ class CC_EXPORT Layer : public base::RefCounted<Layer>, |
gfx::Transform impl_transform_; |
+ std::vector<RequestCopyAsBitmapCallback> request_copy_callbacks_; |
+ |
WebKit::WebLayerScrollClient* layer_scroll_client_; |
DrawProperties<Layer, RenderSurface> draw_properties_; |