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

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

Issue 59383011: Factor common code into native_viewport_controller.cc (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix windows build 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_controller.cc
diff --git a/mojo/services/native_viewport/native_viewport_controller.cc b/mojo/services/native_viewport/native_viewport_controller.cc
index e234fab2304f86965503f2c233003179ad784b14..192422455ca51fd022734f5adc1a6b7988b8ad8b 100644
--- a/mojo/services/native_viewport/native_viewport_controller.cc
+++ b/mojo/services/native_viewport/native_viewport_controller.cc
@@ -4,9 +4,11 @@
#include "mojo/services/native_viewport/native_viewport_controller.h"
+#include "base/bind.h"
#include "base/message_loop/message_loop.h"
#include "base/strings/stringprintf.h"
-#include "gpu/command_buffer/client/gles2_interface.h"
+#include "gpu/command_buffer/client/gl_in_process_context.h"
+#include "gpu/command_buffer/client/gles2_implementation.h"
#include "mojo/services/native_viewport/native_viewport.h"
#include "ui/events/event.h"
@@ -34,10 +36,18 @@ bool NativeViewportController::OnEvent(ui::Event* event) {
return false;
}
-void NativeViewportController::OnGLContextAvailable(
- gpu::gles2::GLES2Interface* gl) {
+void NativeViewportController::OnAcceleratedWidgetAvailable(
+ gfx::AcceleratedWidget widget) {
+ gfx::Size size = native_viewport_->GetSize();
+ gpu::GLInProcessContextAttribs attribs;
+ gl_context_.reset(gpu::GLInProcessContext::CreateContext(
+ false, widget, size, false, attribs, gfx::PreferDiscreteGpu));
+ gl_context_->SetContextLostCallback(base::Bind(
+ &NativeViewportController::OnGLContextLost, base::Unretained(this)));
+
// TODO(abarth): Instead of drawing green, we want to send the context over
// pipe_ somehow.
+ gpu::gles2::GLES2Interface* gl = gl_context_->GetImplementation();
gl->ClearColor(0, 1, 0, 0);
gl->Clear(GL_COLOR_BUFFER_BIT);
gl->SwapBuffers();
« no previous file with comments | « mojo/services/native_viewport/native_viewport_controller.h ('k') | mojo/services/native_viewport/native_viewport_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698