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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "mojo/services/native_viewport/native_viewport.h"
6
7 #include "base/bind.h"
8 #include "gpu/command_buffer/client/gl_in_process_context.h"
9 #include "gpu/command_buffer/client/gles2_implementation.h"
10
11 namespace mojo {
12 namespace services {
13
14 NativeViewport::NativeViewport(NativeViewportDelegate* delegate)
15 : delegate_(delegate),
16 widget_(gfx::kNullAcceleratedWidget) {
17 }
18
19 NativeViewport::~NativeViewport() {
20 }
21
22 void NativeViewport::OnAcceleratedWidgetAvailable() {
23 gpu::GLInProcessContextAttribs attribs;
24 gl_context_.reset(gpu::GLInProcessContext::CreateContext(
25 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.
26 attribs, gfx::PreferDiscreteGpu));
27 gl_context_->SetContextLostCallback(base::Bind(
28 &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.
29
30 delegate_->OnGLContextAvailable(gl_context_->GetImplementation());
31 }
32
33 void NativeViewport::OnGLContextLost() {
34 gl_context_.reset();
35 delegate_->OnGLContextLost();
36 }
37
38 } // namespace services
39 } // namespace mojo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698