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

Unified Diff: content/browser/renderer_host/compositor_impl_android.cc

Issue 22870016: Update the nine patch layer to use UI resources (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased 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: content/browser/renderer_host/compositor_impl_android.cc
diff --git a/content/browser/renderer_host/compositor_impl_android.cc b/content/browser/renderer_host/compositor_impl_android.cc
index 313764b02f83d71b01f20f431ae674e34751da98..7f4f0647dc53e526c92edc5f0adf1751c394b287 100644
--- a/content/browser/renderer_host/compositor_impl_android.cc
+++ b/content/browser/renderer_host/compositor_impl_android.cc
@@ -22,6 +22,8 @@
#include "cc/output/compositor_frame.h"
#include "cc/output/context_provider.h"
#include "cc/output/output_surface.h"
+#include "cc/resources/scoped_ui_resource.h"
+#include "cc/resources/ui_resource_bitmap.h"
#include "cc/trees/layer_tree_host.h"
#include "content/browser/gpu/browser_gpu_channel_host_factory.h"
#include "content/browser/gpu/gpu_surface_tracker.h"
@@ -233,7 +235,9 @@ void CompositorImpl::SetSurface(jobject surface) {
void CompositorImpl::SetVisible(bool visible) {
if (!visible) {
+ ui_resource_map_.clear();
host_.reset();
+ client_->UIResourcesAreInvalid();
} else if (!host_) {
cc::LayerTreeSettings settings;
settings.refresh_rate = 60.0;
@@ -260,6 +264,9 @@ void CompositorImpl::SetVisible(bool visible) {
host_->SetLayerTreeHostClientReady();
host_->SetViewportSize(size_);
host_->set_has_transparent_background(has_transparent_background_);
+ // Need to recreate the UI resources because a new LayerTreeHost has been
+ // created.
+ client_->DidLoseUIResources();
}
}
@@ -291,6 +298,23 @@ bool CompositorImpl::CompositeAndReadback(void *pixels, const gfx::Rect& rect) {
return false;
}
+cc::UIResourceId CompositorImpl::GenerateUIResource(
+ const cc::UIResourceBitmap& bitmap) {
+ if (!host_)
+ return 0;
+ scoped_ptr<cc::ScopedUIResource> ui_resource =
+ cc::ScopedUIResource::Create(host_.get(), bitmap);
+ cc::UIResourceId id = ui_resource->id();
+ ui_resource_map_.set(id, ui_resource.Pass());
+ return id;
+}
+
+void CompositorImpl::DeleteUIResource(cc::UIResourceId resource_id) {
+ UIResourceMap::iterator it = ui_resource_map_.find(resource_id);
+ if (it != ui_resource_map_.end())
+ ui_resource_map_.erase(it);
+}
+
WebKit::WebGLId CompositorImpl::GenerateTexture(gfx::JavaBitmap& bitmap) {
unsigned int texture_id = BuildBasicTexture();
WebKit::WebGraphicsContext3D* context =
« no previous file with comments | « content/browser/renderer_host/compositor_impl_android.h ('k') | content/public/browser/android/compositor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698