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

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

Issue 26753005: Adding compositor callbacks to RenderWidgetHostViewAndroid (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressed comments and rebased Created 7 years, 1 month 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 86acf38893b8afe0fd2eaf38a2c51fda43352c4a..4fd7036a5b0ce113af7bfb29a6f550687950939e 100644
--- a/content/browser/renderer_host/compositor_impl_android.cc
+++ b/content/browser/renderer_host/compositor_impl_android.cc
@@ -38,6 +38,7 @@
#include "third_party/WebKit/public/platform/WebGraphicsContext3D.h"
#include "third_party/khronos/GLES2/gl2.h"
#include "third_party/khronos/GLES2/gl2ext.h"
+#include "ui/base/android/window_android.h"
#include "ui/gfx/android/device_display_info.h"
#include "ui/gfx/android/java_bitmap.h"
#include "ui/gfx/frame_time.h"
@@ -103,8 +104,9 @@ static base::LazyInstance<SurfaceMap>
static base::LazyInstance<base::Lock> g_surface_map_lock;
// static
-Compositor* Compositor::Create(CompositorClient* client) {
- return client ? new CompositorImpl(client) : NULL;
+Compositor* Compositor::Create(CompositorClient* client,
+ gfx::NativeWindow root_window) {
+ return client ? new CompositorImpl(client, root_window) : NULL;
}
// static
@@ -129,17 +131,22 @@ jobject CompositorImpl::GetSurface(int surface_id) {
return jsurface;
}
-CompositorImpl::CompositorImpl(CompositorClient* client)
+CompositorImpl::CompositorImpl(CompositorClient* client,
+ gfx::NativeWindow root_window)
: root_layer_(cc::Layer::Create()),
has_transparent_background_(false),
window_(NULL),
surface_id_(0),
- client_(client) {
+ client_(client),
+ root_window_(root_window) {
DCHECK(client);
+ DCHECK(root_window);
ImageTransportFactoryAndroid::AddObserver(this);
+ root_window->AttachCompositor();
}
CompositorImpl::~CompositorImpl() {
+ root_window_->DetachCompositor();
ImageTransportFactoryAndroid::RemoveObserver(this);
// Clean-up any surface references.
SetSurface(NULL);
@@ -481,4 +488,8 @@ blink::WGC3Denum CompositorImpl::GetGLTypeForBitmap(gfx::JavaBitmap& bitmap) {
}
}
+void CompositorImpl::DidCommit() {
+ root_window_->OnCompositingDidCommit();
+}
+
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698