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

Unified Diff: cc/trees/layer_tree_host_impl.cc

Issue 18191020: UI Resource Manager (Closed) Base URL: https://src.chromium.org/chrome/trunk/src/
Patch Set: 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
Index: cc/trees/layer_tree_host_impl.cc
===================================================================
--- cc/trees/layer_tree_host_impl.cc (revision 210393)
+++ cc/trees/layer_tree_host_impl.cc (working copy)
@@ -49,6 +49,7 @@
#include "cc/trees/quad_culler.h"
#include "cc/trees/single_thread_proxy.h"
#include "cc/trees/tree_synchronizer.h"
+#include "gpu/GLES2/gl2extchromium.h"
#include "ui/gfx/size_conversions.h"
#include "ui/gfx/vector2d_conversions.h"
@@ -564,6 +565,7 @@
TRACE_EVENT0("cc",
"LayerTreeHostImpl::CalculateRenderPasses::EmptyDamageRect");
frame->has_no_damage = true;
+
aelias_OOO_until_Jul13 2013/07/10 23:07:22 nit: extra whitespace
powei 2013/07/11 23:54:44 Done.
// A copy request should cause damage, so we should not have any copy
// requests in this case.
DCHECK_EQ(0u, active_tree_->LayersWithCopyOutputRequest().size());
@@ -2362,4 +2364,43 @@
debug_state_ = debug_state;
}
+void LayerTreeHostImpl::CreateUIResource(UIResourceId uid,
+ scoped_refptr<UIResourceBitmap> bitmap,
+ bool async) {
+ ResourceProvider::ResourceId id =
+ resource_provider_->CreateGLTexture(bitmap->GetSize(),
+ GL_RGBA,
+ GL_TEXTURE_POOL_UNMANAGED_CHROMIUM,
+ ResourceProvider::TextureUsageAny);
+
+ ui_resource_map_[uid] = id;
+ gfx::Size bitmap_size = bitmap->GetSize();
+ resource_provider_->SetPixels(id,
+ reinterpret_cast<uint8_t*>(bitmap->GetPixels()),
+ gfx::Rect(1, 1, bitmap_size.width(),
aelias_OOO_until_Jul13 2013/07/10 23:07:22 "1, 1" looks wrong here. It should be 0, 0. In f
powei 2013/07/11 23:54:44 Done.
+ bitmap_size.height()),
+ gfx::Rect(1, 1, bitmap_size.width(),
+ bitmap_size.height()),
+ gfx::Vector2d(0, 0));
+
+ client_->UIResourceCreatedOnImplThread(uid);
+}
+
+void LayerTreeHostImpl::DeleteUIResource(UIResourceId uid) {
+ ResourceProvider::ResourceId id = ResourceIdForUIResource(uid);
+ if (id) {
+ resource_provider_->DeleteResource(id);
+ ui_resource_map_.erase(uid);
+ }
+}
+
+ResourceProvider::ResourceId
+LayerTreeHostImpl::ResourceIdForUIResource(UIResourceId uid) const {
+ if (ui_resource_map_.find(uid) != ui_resource_map_.end()) {
+ return ui_resource_map_.find(uid)->second;
+ }
+ return 0;
+}
+
+
} // namespace cc

Powered by Google App Engine
This is Rietveld 408576698