Chromium Code Reviews| 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_miscellaneous_thunks.h " | 10 #include "mojo/public/platform/native/gles2_impl_chromium_miscellaneous_thunks.h " |
| 11 #include "mojo/public/platform/native/gles2_impl_chromium_resize_thunks.h" | 11 #include "mojo/public/platform/native/gles2_impl_chromium_resize_thunks.h" |
| 12 #include "mojo/public/platform/native/gles2_impl_chromium_sub_image_thunks.h" | 12 #include "mojo/public/platform/native/gles2_impl_chromium_sub_image_thunks.h" |
| 13 #include "mojo/public/platform/native/gles2_impl_chromium_sync_point_thunks.h" | 13 #include "mojo/public/platform/native/gles2_impl_chromium_sync_point_thunks.h" |
| 14 #include "mojo/public/platform/native/gles2_impl_chromium_texture_mailbox_thunks .h" | 14 #include "mojo/public/platform/native/gles2_impl_chromium_texture_mailbox_thunks .h" |
| 15 #include "mojo/public/platform/native/gles2_impl_ext_debug_marker_thunks.h" | 15 #include "mojo/public/platform/native/gles2_impl_ext_debug_marker_thunks.h" |
| 16 #include "mojo/public/platform/native/gles2_impl_occlusion_query_ext_thunks.h" | 16 #include "mojo/public/platform/native/gles2_impl_occlusion_query_ext_thunks.h" |
| 17 #include "mojo/public/platform/native/gles2_impl_oes_vertex_array_object_thunks. h" | 17 #include "mojo/public/platform/native/gles2_impl_oes_vertex_array_object_thunks. h" |
| 18 #include "mojo/public/platform/native/gles2_impl_thunks.h" | 18 #include "mojo/public/platform/native/gles2_impl_thunks.h" |
| 19 #include "mojo/public/platform/native/gles2_thunks.h" | 19 #include "mojo/public/platform/native/gles2_thunks.h" |
| 20 #include "mojo/public/platform/native/mgl_onscreen_thunks.h" | |
| 21 #include "mojo/public/platform/native/mgl_thunks.h" | |
| 20 #include "mojo/public/platform/native/system_impl_private_thunks.h" | 22 #include "mojo/public/platform/native/system_impl_private_thunks.h" |
| 21 #include "mojo/public/platform/native/system_thunks.h" | 23 #include "mojo/public/platform/native/system_thunks.h" |
| 22 | 24 |
| 23 namespace shell { | 25 namespace shell { |
| 24 | 26 |
| 25 namespace { | 27 namespace { |
| 26 | 28 |
| 27 template <typename Thunks> | 29 template <typename Thunks> |
| 28 bool SetThunks(Thunks (*make_thunks)(), | 30 bool SetThunks(Thunks (*make_thunks)(), |
| 29 const char* function_name, | 31 const char* function_name, |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 98 "MojoSetGLES2ImplChromiumMiscellaneousThunks", app_library); | 100 "MojoSetGLES2ImplChromiumMiscellaneousThunks", app_library); |
| 99 SetThunks(MojoMakeGLES2ImplChromiumResizeThunks, | 101 SetThunks(MojoMakeGLES2ImplChromiumResizeThunks, |
| 100 "MojoSetGLES2ImplChromiumResizeThunks", app_library); | 102 "MojoSetGLES2ImplChromiumResizeThunks", app_library); |
| 101 SetThunks(MojoMakeGLES2ImplChromiumSubImageThunks, | 103 SetThunks(MojoMakeGLES2ImplChromiumSubImageThunks, |
| 102 "MojoSetGLES2ImplChromiumSubImageThunks", app_library); | 104 "MojoSetGLES2ImplChromiumSubImageThunks", app_library); |
| 103 SetThunks(MojoMakeGLES2ImplChromiumSyncPointThunks, | 105 SetThunks(MojoMakeGLES2ImplChromiumSyncPointThunks, |
| 104 "MojoSetGLES2ImplChromiumSyncPointThunks", app_library); | 106 "MojoSetGLES2ImplChromiumSyncPointThunks", app_library); |
| 105 SetThunks(MojoMakeGLES2ImplChromiumTextureMailboxThunks, | 107 SetThunks(MojoMakeGLES2ImplChromiumTextureMailboxThunks, |
| 106 "MojoSetGLES2ImplChromiumTextureMailboxThunks", app_library); | 108 "MojoSetGLES2ImplChromiumTextureMailboxThunks", app_library); |
| 107 } | 109 } |
| 110 SetThunks(MojoMakeMGLThunks, "MojoSetMGLThunks", app_library); | |
|
viettrungluu
2015/08/12 02:48:10
I suppose the conditional for the GLES2 control th
jamesr
2015/08/13 19:42:27
I made the MGL onscreen thunks conditional on the
| |
| 111 | |
| 112 // TODO(jamesr): We should only need to expose these on apps that need to draw | |
| 113 // to the screen like the system compositor. | |
| 114 SetThunks(MojoMakeMGLOnscreenThunks, "MojoSetMGLOnscreenThunks", app_library); | |
|
viettrungluu
2015/08/12 02:48:10
And presumably this would also be conditional on t
| |
| 115 | |
| 108 // Unlike system thunks, we don't warn on a lack of GLES2 thunks because | 116 // Unlike system thunks, we don't warn on a lack of GLES2 thunks because |
| 109 // not everything is a visual app. | 117 // not everything is a visual app. |
| 110 | 118 |
| 111 typedef MojoResult (*MojoMainFunction)(MojoHandle); | 119 typedef MojoResult (*MojoMainFunction)(MojoHandle); |
| 112 MojoMainFunction main_function = reinterpret_cast<MojoMainFunction>( | 120 MojoMainFunction main_function = reinterpret_cast<MojoMainFunction>( |
| 113 base::GetFunctionPointerFromNativeLibrary(app_library, "MojoMain")); | 121 base::GetFunctionPointerFromNativeLibrary(app_library, "MojoMain")); |
| 114 if (!main_function) { | 122 if (!main_function) { |
| 115 LOG(ERROR) << "MojoMain not found"; | 123 LOG(ERROR) << "MojoMain not found"; |
| 116 return false; | 124 return false; |
| 117 } | 125 } |
| 118 // |MojoMain()| takes ownership of the Application request handle. | 126 // |MojoMain()| takes ownership of the Application request handle. |
| 119 MojoHandle handle = application_request.PassMessagePipe().release().value(); | 127 MojoHandle handle = application_request.PassMessagePipe().release().value(); |
| 120 MojoResult result = main_function(handle); | 128 MojoResult result = main_function(handle); |
| 121 LOG_IF(ERROR, result != MOJO_RESULT_OK) | 129 LOG_IF(ERROR, result != MOJO_RESULT_OK) |
| 122 << "MojoMain returned error (result: " << result << ")"; | 130 << "MojoMain returned error (result: " << result << ")"; |
| 123 return true; | 131 return true; |
| 124 } | 132 } |
| 125 | 133 |
| 126 } // namespace shell | 134 } // namespace shell |
| OLD | NEW |