| OLD | NEW | 
|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be | 
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. | 
| 4 | 4 | 
| 5 #include "services/native_viewport/app_delegate.h" | 5 #include "services/native_viewport/app_delegate.h" | 
| 6 | 6 | 
| 7 #include <vector> | 7 #include <vector> | 
|  | 8 | 
| 8 #include "gpu/config/gpu_util.h" | 9 #include "gpu/config/gpu_util.h" | 
| 9 | 10 | 
| 10 namespace native_viewport { | 11 namespace native_viewport { | 
| 11 | 12 | 
| 12 NativeViewportAppDelegate::NativeViewportAppDelegate() : is_headless_(false) {} | 13 NativeViewportAppDelegate::NativeViewportAppDelegate() : is_headless_(false) {} | 
| 13 | 14 | 
| 14 NativeViewportAppDelegate::~NativeViewportAppDelegate() {} | 15 NativeViewportAppDelegate::~NativeViewportAppDelegate() {} | 
| 15 | 16 | 
| 16 void NativeViewportAppDelegate::InitLogging( | 17 void NativeViewportAppDelegate::InitLogging( | 
| 17     mojo::ApplicationImpl* application) { | 18     mojo::ApplicationImpl* application) { | 
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 53   else if (application->HasArg(mojo::kUseOSMesa)) | 54   else if (application->HasArg(mojo::kUseOSMesa)) | 
| 54     gfx::GLSurface::InitializeOneOff(gfx::kGLImplementationOSMesaGL); | 55     gfx::GLSurface::InitializeOneOff(gfx::kGLImplementationOSMesaGL); | 
| 55   else | 56   else | 
| 56     gfx::GLSurface::InitializeOneOff(); | 57     gfx::GLSurface::InitializeOneOff(); | 
| 57 | 58 | 
| 58   is_headless_ = application->HasArg(mojo::kUseHeadlessConfig); | 59   is_headless_ = application->HasArg(mojo::kUseHeadlessConfig); | 
| 59 } | 60 } | 
| 60 | 61 | 
| 61 bool NativeViewportAppDelegate::ConfigureIncomingConnection( | 62 bool NativeViewportAppDelegate::ConfigureIncomingConnection( | 
| 62     mojo::ApplicationConnection* connection) { | 63     mojo::ApplicationConnection* connection) { | 
| 63   connection->AddService<mojo::NativeViewport>(this); | 64   connection->GetServiceProviderImpl().AddService<mojo::NativeViewport>([this]( | 
| 64   connection->AddService<mojo::Gpu>(this); | 65       const mojo::ConnectionContext& connection_context, | 
|  | 66       mojo::InterfaceRequest<mojo::NativeViewport> native_viewport_request) { | 
|  | 67     if (!gpu_state_.get()) | 
|  | 68       gpu_state_ = new gles2::GpuState(); | 
|  | 69     new NativeViewportImpl(application_, is_headless_, gpu_state_, | 
|  | 70                            native_viewport_request.Pass()); | 
|  | 71   }); | 
|  | 72 | 
|  | 73   connection->GetServiceProviderImpl().AddService<mojo::Gpu>( | 
|  | 74       [this](const mojo::ConnectionContext& connection_context, | 
|  | 75              mojo::InterfaceRequest<mojo::Gpu> gpu_request) { | 
|  | 76         if (!gpu_state_.get()) | 
|  | 77           gpu_state_ = new gles2::GpuState(); | 
|  | 78         new gles2::GpuImpl(gpu_request.Pass(), gpu_state_); | 
|  | 79       }); | 
|  | 80 | 
| 65   return true; | 81   return true; | 
| 66 } | 82 } | 
| 67 | 83 | 
| 68 void NativeViewportAppDelegate::Create( |  | 
| 69     const mojo::ConnectionContext& connection_context, |  | 
| 70     mojo::InterfaceRequest<mojo::NativeViewport> request) { |  | 
| 71   if (!gpu_state_.get()) |  | 
| 72     gpu_state_ = new gles2::GpuState; |  | 
| 73   new NativeViewportImpl(application_, is_headless_, gpu_state_, |  | 
| 74                          request.Pass()); |  | 
| 75 } |  | 
| 76 |  | 
| 77 void NativeViewportAppDelegate::Create( |  | 
| 78     const mojo::ConnectionContext& connection_context, |  | 
| 79     mojo::InterfaceRequest<mojo::Gpu> request) { |  | 
| 80   if (!gpu_state_.get()) |  | 
| 81     gpu_state_ = new gles2::GpuState; |  | 
| 82   new gles2::GpuImpl(request.Pass(), gpu_state_); |  | 
| 83 } |  | 
| 84 |  | 
| 85 }  // namespace native_viewport | 84 }  // namespace native_viewport | 
| OLD | NEW | 
|---|