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

Unified Diff: cc/trees/layer_tree_host.h

Issue 22870016: Update the nine patch layer to use UI resources (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: updated dchecks in ui_resource_bitmap Created 7 years, 3 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
Index: cc/trees/layer_tree_host.h
diff --git a/cc/trees/layer_tree_host.h b/cc/trees/layer_tree_host.h
index e362f84b4ca09789afc7c0ea734edab6f5039e9a..2b6f8d1113cad102a0d18729b2091f4b8ea7fa6d 100644
--- a/cc/trees/layer_tree_host.h
+++ b/cc/trees/layer_tree_host.h
@@ -86,18 +86,35 @@ struct CC_EXPORT RendererCapabilities {
bool using_discard_framebuffer;
};
-struct CC_EXPORT UIResourceRequest {
+class CC_EXPORT UIResourceRequest {
+ public:
enum UIResourceRequestType {
UIResourceCreate,
UIResourceDelete,
UIResourceInvalidRequest
};
- UIResourceRequest();
+ UIResourceRequest(UIResourceRequestType type, UIResourceId id);
+ UIResourceRequest(UIResourceRequestType type,
+ UIResourceId id,
+ const UIResourceBitmap& bitmap);
+ UIResourceRequest(const UIResourceRequest& request);
+
~UIResourceRequest();
- UIResourceRequestType type;
- UIResourceId id;
- scoped_refptr<UIResourceBitmap> bitmap;
+
+ UIResourceRequestType GetType() const { return type_; }
+ UIResourceId GetId() const { return id_; }
+ UIResourceBitmap GetBitmap() const {
+ DCHECK(bitmap_);
+ return *bitmap_.get();
+ }
+
+ UIResourceRequest& operator=(const UIResourceRequest& request);
+
+ private:
+ UIResourceRequestType type_;
+ UIResourceId id_;
+ scoped_ptr<UIResourceBitmap> bitmap_;
};
class CC_EXPORT LayerTreeHost : NON_EXPORTED_BASE(public RateLimiterClient) {
@@ -287,6 +304,8 @@ class CC_EXPORT LayerTreeHost : NON_EXPORTED_BASE(public RateLimiterClient) {
// Deletes a UI resource. May safely be called more than once.
virtual void DeleteUIResource(UIResourceId id);
+ virtual gfx::Size GetUIResourceSize(UIResourceId id) const;
+
bool UsingSharedMemoryResources();
int id() const { return tree_id_; }
@@ -325,7 +344,13 @@ class CC_EXPORT LayerTreeHost : NON_EXPORTED_BASE(public RateLimiterClient) {
void RecreateUIResources(bool resource_lost);
- typedef base::hash_map<UIResourceId, UIResourceClient*> UIResourceClientMap;
+ struct UIResourceClientData {
+ UIResourceClient* client;
+ gfx::Size size;
+ };
+
+ typedef base::hash_map<UIResourceId, UIResourceClientData>
+ UIResourceClientMap;
UIResourceClientMap ui_resource_client_map_;
int next_ui_resource_id_;

Powered by Google App Engine
This is Rietveld 408576698