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 "shell/android/native_viewport_application_loader.h" | 5 #include "shell/android/native_viewport_application_loader.h" |
6 | 6 |
7 #include "mojo/public/cpp/application/application_impl.h" | 7 #include "mojo/public/cpp/application/application_impl.h" |
8 #include "services/gles2/gpu_state.h" | 8 #include "services/gles2/gpu_state.h" |
9 #include "services/native_viewport/native_viewport_impl.h" | 9 #include "services/native_viewport/native_viewport_impl.h" |
10 | 10 |
(...skipping 11 matching lines...) Expand all Loading... |
22 | 22 |
23 void NativeViewportApplicationLoader::Load( | 23 void NativeViewportApplicationLoader::Load( |
24 const GURL& url, | 24 const GURL& url, |
25 InterfaceRequest<mojo::Application> application_request) { | 25 InterfaceRequest<mojo::Application> application_request) { |
26 DCHECK(application_request.is_pending()); | 26 DCHECK(application_request.is_pending()); |
27 app_.reset(new mojo::ApplicationImpl(this, application_request.Pass())); | 27 app_.reset(new mojo::ApplicationImpl(this, application_request.Pass())); |
28 } | 28 } |
29 | 29 |
30 bool NativeViewportApplicationLoader::ConfigureIncomingConnection( | 30 bool NativeViewportApplicationLoader::ConfigureIncomingConnection( |
31 ApplicationConnection* connection) { | 31 ApplicationConnection* connection) { |
32 connection->AddService<mojo::NativeViewport>(this); | 32 connection->GetServiceProviderImpl().AddService<mojo::NativeViewport>( |
33 connection->AddService<mojo::Gpu>(this); | 33 [this](const ConnectionContext& connection_context, |
| 34 InterfaceRequest<mojo::NativeViewport> native_viewport_request) { |
| 35 if (!gpu_state_) |
| 36 gpu_state_ = new gles2::GpuState(); |
| 37 new native_viewport::NativeViewportImpl(app_.get(), false, gpu_state_, |
| 38 native_viewport_request.Pass()); |
| 39 }); |
| 40 connection->GetServiceProviderImpl().AddService<mojo::Gpu>( |
| 41 [this](const ConnectionContext& connection_context, |
| 42 InterfaceRequest<mojo::Gpu> gpu_request) { |
| 43 if (!gpu_state_) |
| 44 gpu_state_ = new gles2::GpuState(); |
| 45 new gles2::GpuImpl(gpu_request.Pass(), gpu_state_); |
| 46 }); |
34 return true; | 47 return true; |
35 } | 48 } |
36 | 49 |
37 void NativeViewportApplicationLoader::Create( | |
38 const ConnectionContext& connection_context, | |
39 InterfaceRequest<mojo::NativeViewport> request) { | |
40 if (!gpu_state_) | |
41 gpu_state_ = new gles2::GpuState; | |
42 new native_viewport::NativeViewportImpl(app_.get(), false, gpu_state_, | |
43 request.Pass()); | |
44 } | |
45 | |
46 void NativeViewportApplicationLoader::Create( | |
47 const ConnectionContext& connection_context, | |
48 InterfaceRequest<mojo::Gpu> request) { | |
49 if (!gpu_state_) | |
50 gpu_state_ = new gles2::GpuState; | |
51 new gles2::GpuImpl(request.Pass(), gpu_state_); | |
52 } | |
53 | |
54 } // namespace shell | 50 } // namespace shell |
OLD | NEW |