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

Unified Diff: mojo/services/native_viewport/native_viewport.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.cc
diff --git a/mojo/services/native_viewport/native_viewport.cc b/mojo/services/native_viewport/native_viewport.cc
new file mode 100644
index 0000000000000000000000000000000000000000..91e93d16a13f362408d6436ee90ddc13afc079a8
--- /dev/null
+++ b/mojo/services/native_viewport/native_viewport.cc
@@ -0,0 +1,39 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "mojo/services/native_viewport/native_viewport.h"
+
+#include "base/bind.h"
+#include "gpu/command_buffer/client/gl_in_process_context.h"
+#include "gpu/command_buffer/client/gles2_implementation.h"
+
+namespace mojo {
+namespace services {
+
+NativeViewport::NativeViewport(NativeViewportDelegate* delegate)
+ : delegate_(delegate),
+ widget_(gfx::kNullAcceleratedWidget) {
+}
+
+NativeViewport::~NativeViewport() {
+}
+
+void NativeViewport::OnAcceleratedWidgetAvailable() {
+ gpu::GLInProcessContextAttribs attribs;
+ gl_context_.reset(gpu::GLInProcessContext::CreateContext(
+ false, widget_, bounds_.size(), false,
Ben Goodger (Google) 2013/11/06 07:17:17 nit: 4-space indent here
abarth-chromium 2013/11/06 15:40:55 Done.
+ attribs, gfx::PreferDiscreteGpu));
+ gl_context_->SetContextLostCallback(base::Bind(
+ &NativeViewport::OnGLContextLost, base::Unretained(this)));
Ben Goodger (Google) 2013/11/06 07:17:17 and here
abarth-chromium 2013/11/06 15:40:55 Done.
+
+ delegate_->OnGLContextAvailable(gl_context_->GetImplementation());
+}
+
+void NativeViewport::OnGLContextLost() {
+ gl_context_.reset();
+ delegate_->OnGLContextLost();
+}
+
+} // namespace services
+} // namespace mojo

Powered by Google App Engine
This is Rietveld 408576698