summaryrefslogtreecommitdiffstats
path: root/cc/trees
diff options
context:
space:
mode:
authorclholgat@chromium.org <clholgat@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-10-04 00:35:13 +0000
committerclholgat@chromium.org <clholgat@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-10-04 00:35:13 +0000
commitefbdb3ac428aa1829161729189604865e606691b (patch)
treee2b465b299b54934d06c020c0ea514292841aa15 /cc/trees
parent18ae4320efce8e3342c3a5048569a25c4f2498ab (diff)
downloadchromium_src-efbdb3ac428aa1829161729189604865e606691b.zip
chromium_src-efbdb3ac428aa1829161729189604865e606691b.tar.gz
chromium_src-efbdb3ac428aa1829161729189604865e606691b.tar.bz2
Generic UIResourceLayer for shared resources.
Separated the UIResource management from the NinePatchLayer because we need it for other things as well. BUG=235290 Review URL: https://codereview.chromium.org/24716003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@226908 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/trees')
-rw-r--r--cc/trees/layer_tree_host_impl.cc10
-rw-r--r--cc/trees/layer_tree_host_impl.h7
2 files changed, 13 insertions, 4 deletions
diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc
index c447177..7e20fe0 100644
--- a/cc/trees/layer_tree_host_impl.cc
+++ b/cc/trees/layer_tree_host_impl.cc
@@ -2745,7 +2745,11 @@ void LayerTreeHostImpl::CreateUIResource(UIResourceId uid,
ResourceProvider::TextureUsageAny,
resource_provider_->best_texture_format());
- ui_resource_map_[uid] = id;
+ UIResourceData data;
+ data.resource_id = id;
+ data.size = bitmap.GetSize();
+
+ ui_resource_map_[uid] = data;
AutoLockUIResourceBitmap bitmap_lock(bitmap);
resource_provider_->SetPixels(id,
@@ -2773,7 +2777,7 @@ void LayerTreeHostImpl::EvictAllUIResources() {
iter != ui_resource_map_.end();
++iter) {
evicted_ui_resources_.insert(iter->first);
- resource_provider_->DeleteResource(iter->second);
+ resource_provider_->DeleteResource(iter->second.resource_id);
}
ui_resource_map_.clear();
@@ -2786,7 +2790,7 @@ ResourceProvider::ResourceId LayerTreeHostImpl::ResourceIdForUIResource(
UIResourceId uid) const {
UIResourceMap::const_iterator iter = ui_resource_map_.find(uid);
if (iter != ui_resource_map_.end())
- return iter->second;
+ return iter->second.resource_id;
return 0;
}
diff --git a/cc/trees/layer_tree_host_impl.h b/cc/trees/layer_tree_host_impl.h
index aabd0b5..b725ef4 100644
--- a/cc/trees/layer_tree_host_impl.h
+++ b/cc/trees/layer_tree_host_impl.h
@@ -399,6 +399,11 @@ class CC_EXPORT LayerTreeHostImpl
virtual ResourceProvider::ResourceId ResourceIdForUIResource(
UIResourceId uid) const;
+ struct UIResourceData {
+ ResourceProvider::ResourceId resource_id;
+ gfx::Size size;
+ };
+
protected:
LayerTreeHostImpl(
const LayerTreeSettings& settings,
@@ -484,7 +489,7 @@ class CC_EXPORT LayerTreeHostImpl
void MarkUIResourceNotEvicted(UIResourceId uid);
- typedef base::hash_map<UIResourceId, ResourceProvider::ResourceId>
+ typedef base::hash_map<UIResourceId, UIResourceData>
UIResourceMap;
UIResourceMap ui_resource_map_;