Chromium Code Reviews| OLD | NEW |
|---|---|
| (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 | |
| OLD | NEW |