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/native_application_support.h" | 5 #include "shell/native_application_support.h" |
6 | 6 |
7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
8 #include "base/files/file_util.h" | 8 #include "base/files/file_util.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "mojo/public/platform/native/gles2_impl_chromium_bind_uniform_location_
thunks.h" | 10 #include "mojo/public/platform/native/gles2_impl_chromium_bind_uniform_location_
thunks.h" |
11 #include "mojo/public/platform/native/gles2_impl_chromium_map_sub_thunks.h" | 11 #include "mojo/public/platform/native/gles2_impl_chromium_map_sub_thunks.h" |
12 #include "mojo/public/platform/native/gles2_impl_chromium_miscellaneous_thunks.h
" | 12 #include "mojo/public/platform/native/gles2_impl_chromium_miscellaneous_thunks.h
" |
13 #include "mojo/public/platform/native/gles2_impl_chromium_resize_thunks.h" | 13 #include "mojo/public/platform/native/gles2_impl_chromium_resize_thunks.h" |
14 #include "mojo/public/platform/native/gles2_impl_chromium_sync_point_thunks.h" | 14 #include "mojo/public/platform/native/gles2_impl_chromium_sync_point_thunks.h" |
15 #include "mojo/public/platform/native/gles2_impl_chromium_texture_mailbox_thunks
.h" | 15 #include "mojo/public/platform/native/gles2_impl_chromium_texture_mailbox_thunks
.h" |
16 #include "mojo/public/platform/native/gles2_impl_ext_debug_marker_thunks.h" | 16 #include "mojo/public/platform/native/gles2_impl_ext_debug_marker_thunks.h" |
17 #include "mojo/public/platform/native/gles2_impl_ext_discard_framebuffer_thunks.
h" | 17 #include "mojo/public/platform/native/gles2_impl_ext_discard_framebuffer_thunks.
h" |
18 #include "mojo/public/platform/native/gles2_impl_ext_multisampled_render_to_text
ure_thunks.h" | 18 #include "mojo/public/platform/native/gles2_impl_ext_multisampled_render_to_text
ure_thunks.h" |
19 #include "mojo/public/platform/native/gles2_impl_ext_texture_storage_thunks.h" | 19 #include "mojo/public/platform/native/gles2_impl_ext_texture_storage_thunks.h" |
20 #include "mojo/public/platform/native/gles2_impl_khr_blend_equation_advanced_thu
nks.h" | 20 #include "mojo/public/platform/native/gles2_impl_khr_blend_equation_advanced_thu
nks.h" |
21 #include "mojo/public/platform/native/gles2_impl_occlusion_query_ext_thunks.h" | 21 #include "mojo/public/platform/native/gles2_impl_occlusion_query_ext_thunks.h" |
22 #include "mojo/public/platform/native/gles2_impl_oes_vertex_array_object_thunks.
h" | 22 #include "mojo/public/platform/native/gles2_impl_oes_vertex_array_object_thunks.
h" |
23 #include "mojo/public/platform/native/gles2_impl_thunks.h" | 23 #include "mojo/public/platform/native/gles2_impl_thunks.h" |
24 #include "mojo/public/platform/native/gles2_thunks.h" | 24 #include "mojo/public/platform/native/gles2_thunks.h" |
25 #include "mojo/public/platform/native/mgl_onscreen_thunks.h" | 25 #include "mojo/public/platform/native/mgl_onscreen_thunks.h" |
| 26 #include "mojo/public/platform/native/mgl_signal_sync_point_thunks.h" |
26 #include "mojo/public/platform/native/mgl_thunks.h" | 27 #include "mojo/public/platform/native/mgl_thunks.h" |
27 #include "mojo/public/platform/native/system_impl_private_thunks.h" | 28 #include "mojo/public/platform/native/system_impl_private_thunks.h" |
28 #include "mojo/public/platform/native/system_thunks.h" | 29 #include "mojo/public/platform/native/system_thunks.h" |
29 | 30 |
30 namespace shell { | 31 namespace shell { |
31 | 32 |
32 namespace { | 33 namespace { |
33 | 34 |
34 template <typename Thunks> | 35 template <typename Thunks> |
35 bool SetThunks(Thunks (*make_thunks)(), | 36 bool SetThunks(Thunks (*make_thunks)(), |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 SetThunks(MojoMakeGLES2ImplCHROMIUMMiscellaneousThunks, | 108 SetThunks(MojoMakeGLES2ImplCHROMIUMMiscellaneousThunks, |
108 "MojoSetGLES2ImplCHROMIUMMiscellaneousThunks", app_library); | 109 "MojoSetGLES2ImplCHROMIUMMiscellaneousThunks", app_library); |
109 SetThunks(MojoMakeGLES2ImplCHROMIUMResizeThunks, | 110 SetThunks(MojoMakeGLES2ImplCHROMIUMResizeThunks, |
110 "MojoSetGLES2ImplCHROMIUMResizeThunks", app_library); | 111 "MojoSetGLES2ImplCHROMIUMResizeThunks", app_library); |
111 SetThunks(MojoMakeGLES2ImplCHROMIUMSyncPointThunks, | 112 SetThunks(MojoMakeGLES2ImplCHROMIUMSyncPointThunks, |
112 "MojoSetGLES2ImplCHROMIUMSyncPointThunks", app_library); | 113 "MojoSetGLES2ImplCHROMIUMSyncPointThunks", app_library); |
113 SetThunks(MojoMakeGLES2ImplCHROMIUMTextureMailboxThunks, | 114 SetThunks(MojoMakeGLES2ImplCHROMIUMTextureMailboxThunks, |
114 "MojoSetGLES2ImplCHROMIUMTextureMailboxThunks", app_library); | 115 "MojoSetGLES2ImplCHROMIUMTextureMailboxThunks", app_library); |
115 | 116 |
116 if (SetThunks(MojoMakeMGLThunks, "MojoSetMGLThunks", app_library)) { | 117 if (SetThunks(MojoMakeMGLThunks, "MojoSetMGLThunks", app_library)) { |
117 // TODO(jamesr): We should only need to expose these on apps that need to | 118 // TODO(jamesr): We should only need to expose the onscreen thunks to apps |
118 // draw to the screen like the system compositor. | 119 // that need to draw to the screen like the system compositor. |
119 SetThunks(MojoMakeMGLOnscreenThunks, "MojoSetMGLOnscreenThunks", | 120 SetThunks(MojoMakeMGLOnscreenThunks, "MojoSetMGLOnscreenThunks", |
120 app_library); | 121 app_library); |
| 122 |
| 123 SetThunks(MojoMakeMGLSignalSyncPointThunks, |
| 124 "MojoSetMGLSignalSyncPointThunks", app_library); |
121 } | 125 } |
122 | 126 |
123 // Unlike system thunks, we don't warn on a lack of GLES2 thunks because | |
124 // not everything is a visual app. | |
125 | |
126 typedef MojoResult (*MojoMainFunction)(MojoHandle); | 127 typedef MojoResult (*MojoMainFunction)(MojoHandle); |
127 MojoMainFunction main_function = reinterpret_cast<MojoMainFunction>( | 128 MojoMainFunction main_function = reinterpret_cast<MojoMainFunction>( |
128 base::GetFunctionPointerFromNativeLibrary(app_library, "MojoMain")); | 129 base::GetFunctionPointerFromNativeLibrary(app_library, "MojoMain")); |
129 if (!main_function) { | 130 if (!main_function) { |
130 LOG(ERROR) << "MojoMain not found"; | 131 LOG(ERROR) << "MojoMain not found"; |
131 return false; | 132 return false; |
132 } | 133 } |
133 // |MojoMain()| takes ownership of the Application request handle. | 134 // |MojoMain()| takes ownership of the Application request handle. |
134 MojoHandle handle = application_request.PassMessagePipe().release().value(); | 135 MojoHandle handle = application_request.PassMessagePipe().release().value(); |
135 MojoResult result = main_function(handle); | 136 MojoResult result = main_function(handle); |
136 LOG_IF(ERROR, result != MOJO_RESULT_OK) | 137 LOG_IF(ERROR, result != MOJO_RESULT_OK) |
137 << "MojoMain returned error (result: " << result << ")"; | 138 << "MojoMain returned error (result: " << result << ")"; |
138 return true; | 139 return true; |
139 } | 140 } |
140 | 141 |
141 } // namespace shell | 142 } // namespace shell |
OLD | NEW |