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 12 matching lines...) Expand all Loading... | |
23 const GURL& url, | 23 const GURL& url, |
24 InterfaceRequest<mojo::Application> application_request) { | 24 InterfaceRequest<mojo::Application> application_request) { |
25 DCHECK(application_request.is_pending()); | 25 DCHECK(application_request.is_pending()); |
26 app_.reset(new mojo::ApplicationImpl(this, application_request.Pass())); | 26 app_.reset(new mojo::ApplicationImpl(this, application_request.Pass())); |
27 } | 27 } |
28 | 28 |
29 bool NativeViewportApplicationLoader::ConfigureIncomingConnection( | 29 bool NativeViewportApplicationLoader::ConfigureIncomingConnection( |
30 ApplicationConnection* connection) { | 30 ApplicationConnection* connection) { |
31 connection->AddService<mojo::NativeViewport>(this); | 31 connection->AddService<mojo::NativeViewport>(this); |
32 connection->AddService<mojo::Gpu>(this); | 32 connection->AddService<mojo::Gpu>(this); |
33 connection->AddService<mojo::NativeViewportShellService>(this); | |
33 return true; | 34 return true; |
34 } | 35 } |
35 | 36 |
36 void NativeViewportApplicationLoader::Create( | 37 void NativeViewportApplicationLoader::Create( |
37 ApplicationConnection* connection, | 38 ApplicationConnection* connection, |
38 InterfaceRequest<mojo::NativeViewport> request) { | 39 InterfaceRequest<mojo::NativeViewport> request) { |
39 if (!gpu_state_) | 40 if (!gpu_state_) |
40 gpu_state_ = new gles2::GpuState; | 41 gpu_state_ = new gles2::GpuState; |
41 new native_viewport::NativeViewportImpl(false, gpu_state_, request.Pass()); | 42 native_viewport::NativeViewportImpl* native_viewport_impl = |
43 new native_viewport::NativeViewportImpl(false, gpu_state_, | |
44 request.Pass()); | |
45 native_viewports_.push(native_viewport_impl->GetWeakPtr()); | |
42 } | 46 } |
43 | 47 |
44 void NativeViewportApplicationLoader::Create( | 48 void NativeViewportApplicationLoader::Create( |
45 ApplicationConnection* connection, | 49 ApplicationConnection* connection, |
46 InterfaceRequest<mojo::Gpu> request) { | 50 InterfaceRequest<mojo::Gpu> request) { |
47 if (!gpu_state_) | 51 if (!gpu_state_) |
48 gpu_state_ = new gles2::GpuState; | 52 gpu_state_ = new gles2::GpuState; |
49 new gles2::GpuImpl(request.Pass(), gpu_state_); | 53 new gles2::GpuImpl(request.Pass(), gpu_state_); |
50 } | 54 } |
51 | 55 |
56 void NativeViewportApplicationLoader::Create( | |
57 mojo::ApplicationConnection* connection, | |
58 InterfaceRequest<mojo::NativeViewportShellService> request) { | |
59 native_viewport_shell_service_bindings_.AddBinding(this, request.Pass()); | |
60 } | |
61 | |
62 void NativeViewportApplicationLoader::NewNativeSurfaceAvailable() { | |
63 while (!native_viewports_.empty()) { | |
64 base::WeakPtr<native_viewport::NativeViewportImpl> native_viewport = | |
65 native_viewports_.front(); | |
66 native_viewports_.pop(); | |
67 if (native_viewport && native_viewport->NewNativeSurfaceAvailable()) { | |
qsr
2015/08/06 14:13:20
No {} on a single if (following what is done in th
etiennej
2015/08/07 10:16:37
No longer applicable.
| |
68 return; | |
69 } | |
70 } | |
71 // Normally, a native surface is created only after a NativeViewport is | |
72 // requested. | |
73 NOTREACHED() << "No native viewport to attach to."; | |
74 } | |
52 } // namespace shell | 75 } // namespace shell |
OLD | NEW |