Chromium Code Reviews| 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..2e9b606eadf5c69dd19d136856113756e91a155e 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,9 @@ blink::WGC3Denum CompositorImpl::GetGLTypeForBitmap(gfx::JavaBitmap& bitmap) { |
| } |
| } |
| +void CompositorImpl::DidCommit() { |
| + DCHECK(root_window_); |
|
no sievers
2013/11/15 22:56:19
nit: we already DCHECK() in the constructor
powei
2013/11/18 19:29:59
Done.
|
| + root_window_->OnCompositingDidCommit(); |
| +} |
| + |
| } // namespace content |