| Index: cc/trees/layer_tree_host.h
|
| ===================================================================
|
| --- cc/trees/layer_tree_host.h (revision 213649)
|
| +++ cc/trees/layer_tree_host.h (working copy)
|
| @@ -6,6 +6,7 @@
|
| #define CC_TREES_LAYER_TREE_HOST_H_
|
|
|
| #include <limits>
|
| +#include <list>
|
| #include <vector>
|
|
|
| #include "base/basictypes.h"
|
| @@ -23,6 +24,7 @@
|
| #include "cc/input/top_controls_state.h"
|
| #include "cc/layers/layer_lists.h"
|
| #include "cc/output/output_surface.h"
|
| +#include "cc/resources/ui_resource_bitmap.h"
|
| #include "cc/scheduler/rate_limiter.h"
|
| #include "cc/trees/layer_tree_host_client.h"
|
| #include "cc/trees/layer_tree_host_common.h"
|
| @@ -81,6 +83,19 @@
|
| bool using_shared_memory_resources;
|
| };
|
|
|
| +typedef int UIResourceId;
|
| +typedef base::Callback<scoped_refptr<UIResourceBitmap>(bool resource_lost)>
|
| + UIResourceCallback;
|
| +enum UIResourceRequestType {
|
| + UIResourceCreate,
|
| + UIResourceDelete
|
| +};
|
| +struct UIResourceRequest {
|
| + UIResourceRequestType type;
|
| + UIResourceId id;
|
| + scoped_refptr<UIResourceBitmap> bitmap;
|
| +};
|
| +
|
| class CC_EXPORT LayerTreeHost : NON_EXPORTED_BASE(public RateLimiterClient) {
|
| public:
|
| static scoped_ptr<LayerTreeHost> Create(
|
| @@ -215,6 +230,8 @@
|
|
|
| void ApplyScrollAndScale(const ScrollAndScaleSet& info);
|
|
|
| + void UIResourceLost(UIResourceId id);
|
| +
|
| void SetImplTransform(const gfx::Transform& transform);
|
| void SetLatencyInfo(const ui::LatencyInfo& latency_info);
|
|
|
| @@ -252,6 +269,16 @@
|
|
|
| bool in_paint_layer_contents() const { return in_paint_layer_contents_; }
|
|
|
| + // CreateUIResource creates a resource given a bitmap. The bitmap is
|
| + // generated via a callback function, which is called when initializing the
|
| + // resource and when the resource has been lost (due to lost context). The
|
| + // parameter of the callback is a single boolean, which indicates whether the
|
| + // resource has been lost or not. CreateUIResource returns an Id of the
|
| + // resource, which is always positive.
|
| + virtual UIResourceId CreateUIResource(const UIResourceCallback& bitmap_cb);
|
| + // Deletes a UI resource. May safely be called more than once.
|
| + virtual void DeleteUIResource(UIResourceId id);
|
| +
|
| bool UsingSharedMemoryResources();
|
| int id() const { return tree_id_; }
|
|
|
| @@ -288,6 +315,18 @@
|
|
|
| bool AnimateLayersRecursive(Layer* current, base::TimeTicks time);
|
|
|
| + void DidLoseUIResources();
|
| +
|
| + // UIResourceCallback is used to retrieve the the bitmap of the resource
|
| + // request. The boolean parameter indicates whether the retrieval is due
|
| + // to lost resource (due to lost context) or not.
|
| + typedef base::hash_map<UIResourceId, UIResourceCallback> UIResourceClientMap;
|
| + UIResourceClientMap ui_resource_client_map_;
|
| + int ui_resource_id_;
|
| +
|
| + typedef std::list<UIResourceRequest> UIResourceRequestQueue;
|
| + UIResourceRequestQueue ui_resource_request_queue_;
|
| +
|
| void CalculateLCDTextMetricsCallback(Layer* layer);
|
|
|
| bool animating_;
|
|
|