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

Unified Diff: mojo/services/native_viewport/native_viewport_x11.cc

Issue 59383011: Factor common code into native_viewport_controller.cc (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix X11 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: mojo/services/native_viewport/native_viewport_x11.cc
diff --git a/mojo/services/native_viewport/native_viewport_x11.cc b/mojo/services/native_viewport/native_viewport_x11.cc
index e0c23ce1202926d361a96ba7dd6b25419da350d9..80abd9272d8aa3c6c69857efb420f6beb9ab7765 100644
--- a/mojo/services/native_viewport/native_viewport_x11.cc
+++ b/mojo/services/native_viewport/native_viewport_x11.cc
@@ -10,9 +10,6 @@
#include "base/logging.h"
#include "base/message_loop/message_loop.h"
#include "base/message_loop/message_pump_x11.h"
-#include "gpu/command_buffer/client/gl_in_process_context.h"
-#include "gpu/command_buffer/client/gles2_implementation.h"
-#include "ui/gfx/rect.h"
#include "ui/gfx/x/x11_types.h"
namespace mojo {
@@ -22,13 +19,14 @@ class NativeViewportX11 : public NativeViewport,
public base::MessagePumpDispatcher {
public:
NativeViewportX11(NativeViewportDelegate* delegate)
- : delegate_(delegate),
- bounds_(10, 10, 500, 500) {
+ : NativeViewport(delegate) {
+ bounds_ = gfx::Rect(10, 10, 500, 500);
+
XDisplay* display = gfx::GetXDisplay();
XSetWindowAttributes swa;
memset(&swa, 0, sizeof(swa));
swa.override_redirect = False;
- window_ = XCreateWindow(
+ widget_ = XCreateWindow(
display,
DefaultRootWindow(display),
bounds_.x(), bounds_.y(), bounds_.width(), bounds_.height(),
@@ -38,27 +36,20 @@ class NativeViewportX11 : public NativeViewport,
CopyFromParent, // visual
CWBackPixmap | CWOverrideRedirect, &swa);
- base::MessagePumpX11::Current()->AddDispatcherForWindow(this, window_);
+ base::MessagePumpX11::Current()->AddDispatcherForWindow(this, widget_);
base::MessagePumpX11::Current()->AddDispatcherForRootWindow(this);
- XMapWindow(display, window_);
+ XMapWindow(display, widget_);
XFlush(display);
- gpu::GLInProcessContextAttribs attribs;
- gl_context_.reset(gpu::GLInProcessContext::CreateContext(
- false, window_, bounds_.size(), false,
- attribs, gfx::PreferDiscreteGpu));
- gl_context_->SetContextLostCallback(base::Bind(
- &NativeViewportX11::OnGLContextLost, base::Unretained(this)));
-
- delegate_->OnGLContextAvailable(gl_context_->GetImplementation());
+ OnAcceleratedWidgetAvailable();
}
virtual ~NativeViewportX11() {
base::MessagePumpX11::Current()->RemoveDispatcherForRootWindow(this);
- base::MessagePumpX11::Current()->RemoveDispatcherForWindow(window_);
+ base::MessagePumpX11::Current()->RemoveDispatcherForWindow(widget_);
- XDestroyWindow(gfx::GetXDisplay(), window_);
+ XDestroyWindow(gfx::GetXDisplay(), widget_);
}
private:
@@ -73,16 +64,6 @@ class NativeViewportX11 : public NativeViewport,
return true;
}
- void OnGLContextLost() {
- gl_context_.reset();
- delegate_->OnGLContextLost();
- }
-
- NativeViewportDelegate* delegate_;
- gfx::Rect bounds_;
- XID window_;
- scoped_ptr<gpu::GLInProcessContext> gl_context_;
-
DISALLOW_COPY_AND_ASSIGN(NativeViewportX11);
};

Powered by Google App Engine
This is Rietveld 408576698