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

Unified Diff: cc/trees/layer_tree_host.h

Issue 18191020: UI Resource Manager (Closed) Base URL: https://src.chromium.org/chrome/trunk/src/
Patch Set: Added DCHECK of resource queue size to PushPropertiesTo Created 7 years, 5 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/test/fake_scrollbar_layer.cc ('k') | cc/trees/layer_tree_host.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/trees/layer_tree_host.h
===================================================================
--- cc/trees/layer_tree_host.h (revision 214824)
+++ 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,8 @@
#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/resources/ui_resource_client.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 +84,20 @@
bool using_shared_memory_resources;
};
+struct CC_EXPORT UIResourceRequest {
+ enum UIResourceRequestType {
+ UIResourceCreate,
+ UIResourceDelete,
+ UIResourceInvalidRequest
+ };
+
+ UIResourceRequest();
+ ~UIResourceRequest();
+ UIResourceRequestType type;
+ UIResourceId id;
+ scoped_refptr<UIResourceBitmap> bitmap;
+};
+
class CC_EXPORT LayerTreeHost : NON_EXPORTED_BASE(public RateLimiterClient) {
public:
static scoped_ptr<LayerTreeHost> Create(
@@ -256,6 +273,16 @@
bool in_paint_layer_contents() const { return in_paint_layer_contents_; }
+ // CreateUIResource creates a resource given a bitmap. The bitmap is
+ // generated via an interface function, which is called when initializing the
+ // resource and when the resource has been lost (due to lost context). The
+ // parameter of the interface 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(UIResourceClient* client);
+ // Deletes a UI resource. May safely be called more than once.
+ virtual void DeleteUIResource(UIResourceId id);
+
bool UsingSharedMemoryResources();
int id() const { return tree_id_; }
@@ -292,6 +319,17 @@
bool AnimateLayersRecursive(Layer* current, base::TimeTicks time);
+ void UIResourceLost(UIResourceId id);
+
+ void DidLoseUIResources();
+
+ typedef base::hash_map<UIResourceId, UIResourceClient*> UIResourceClientMap;
+ UIResourceClientMap ui_resource_client_map_;
+ int next_ui_resource_id_;
+
+ typedef std::list<UIResourceRequest> UIResourceRequestQueue;
+ UIResourceRequestQueue ui_resource_request_queue_;
+
void CalculateLCDTextMetricsCallback(Layer* layer);
bool animating_;
« no previous file with comments | « cc/test/fake_scrollbar_layer.cc ('k') | cc/trees/layer_tree_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698