| Index: mojo/services/native_viewport/native_viewport_android.cc
|
| diff --git a/mojo/services/native_viewport/native_viewport_android.cc b/mojo/services/native_viewport/native_viewport_android.cc
|
| index 753b8ed7d4f4046749f8db63abfbeac8de67ba36..1b97a700583d69d1aba43275c5efffcc18ccb78c 100644
|
| --- a/mojo/services/native_viewport/native_viewport_android.cc
|
| +++ b/mojo/services/native_viewport/native_viewport_android.cc
|
| @@ -5,8 +5,6 @@
|
| #include "mojo/services/native_viewport/native_viewport_android.h"
|
|
|
| #include <android/native_window_jni.h>
|
| -#include "gpu/command_buffer/client/gl_in_process_context.h"
|
| -#include "gpu/command_buffer/client/gles2_implementation.h"
|
| #include "mojo/services/native_viewport/android/mojo_viewport.h"
|
| #include "mojo/shell/context.h"
|
|
|
| @@ -14,48 +12,35 @@ namespace mojo {
|
| namespace services {
|
|
|
| NativeViewportAndroid::NativeViewportAndroid(NativeViewportDelegate* delegate)
|
| - : delegate_(delegate),
|
| - window_(NULL),
|
| + : NativeViewport(delegate),
|
| weak_factory_(this) {
|
| }
|
|
|
| NativeViewportAndroid::~NativeViewportAndroid() {
|
| - if (window_)
|
| + if (widget_)
|
| ReleaseWindow();
|
| }
|
|
|
| void NativeViewportAndroid::OnNativeWindowCreated(ANativeWindow* window) {
|
| - DCHECK(!window_);
|
| - window_ = window;
|
| -
|
| - gpu::GLInProcessContextAttribs attribs;
|
| - gl_context_.reset(gpu::GLInProcessContext::CreateContext(
|
| - false, window_, size_, false, attribs, gfx::PreferDiscreteGpu));
|
| - gl_context_->SetContextLostCallback(base::Bind(
|
| - &NativeViewportAndroid::OnGLContextLost, base::Unretained(this)));
|
| -
|
| - delegate_->OnGLContextAvailable(gl_context_->GetImplementation());
|
| -}
|
| -
|
| -void NativeViewportAndroid::OnGLContextLost() {
|
| - gl_context_.reset();
|
| - delegate_->OnGLContextLost();
|
| + DCHECK(!widget_);
|
| + widget_ = window;
|
| + OnAcceleratedWidgetAvailable();
|
| }
|
|
|
| void NativeViewportAndroid::OnNativeWindowDestroyed() {
|
| - DCHECK(window_);
|
| + DCHECK(widget_);
|
| ReleaseWindow();
|
| }
|
|
|
| void NativeViewportAndroid::OnResized(const gfx::Size& size) {
|
| - size_ = size;
|
| + bounds_ = gfx::Rect(size);
|
| delegate_->OnResized(size);
|
| }
|
|
|
| void NativeViewportAndroid::ReleaseWindow() {
|
| gl_context_.reset();
|
| - ANativeWindow_release(window_);
|
| - window_ = NULL;
|
| + ANativeWindow_release(widget_);
|
| + widget_ = NULL;
|
| }
|
|
|
| void NativeViewportAndroid::Close() {
|
|
|