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_sub_image_thunks.h" | 11 #include "mojo/public/platform/native/gles2_impl_chromium_sub_image_thunks.h" |
12 #include "mojo/public/platform/native/gles2_impl_chromium_sync_point_thunks.h" | 12 #include "mojo/public/platform/native/gles2_impl_chromium_sync_point_thunks.h" |
13 #include "mojo/public/platform/native/gles2_impl_chromium_texture_mailbox_thunks
.h" | 13 #include "mojo/public/platform/native/gles2_impl_chromium_texture_mailbox_thunks
.h" |
14 #include "mojo/public/platform/native/gles2_impl_occlusion_query_ext_thunks.h" | 14 #include "mojo/public/platform/native/gles2_impl_occlusion_query_ext_thunks.h" |
15 #include "mojo/public/platform/native/gles2_impl_thunks.h" | 15 #include "mojo/public/platform/native/gles2_impl_thunks.h" |
16 #include "mojo/public/platform/native/gles2_thunks.h" | 16 #include "mojo/public/platform/native/gles2_thunks.h" |
| 17 #include "mojo/public/platform/native/system_impl_private_thunks.h" |
17 #include "mojo/public/platform/native/system_thunks.h" | 18 #include "mojo/public/platform/native/system_thunks.h" |
18 | 19 |
19 namespace mojo { | 20 namespace mojo { |
20 namespace shell { | 21 namespace shell { |
21 | 22 |
22 namespace { | 23 namespace { |
23 | 24 |
24 template <typename Thunks> | 25 template <typename Thunks> |
25 bool SetThunks(Thunks (*make_thunks)(), | 26 bool SetThunks(Thunks (*make_thunks)(), |
26 const char* function_name, | 27 const char* function_name, |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 InterfaceRequest<Application> application_request) { | 60 InterfaceRequest<Application> application_request) { |
60 // Tolerate |app_library| being null, to make life easier for callers. | 61 // Tolerate |app_library| being null, to make life easier for callers. |
61 if (!app_library) | 62 if (!app_library) |
62 return false; | 63 return false; |
63 | 64 |
64 if (!SetThunks(&MojoMakeSystemThunks, "MojoSetSystemThunks", app_library)) { | 65 if (!SetThunks(&MojoMakeSystemThunks, "MojoSetSystemThunks", app_library)) { |
65 LOG(ERROR) << "MojoSetSystemThunks not found"; | 66 LOG(ERROR) << "MojoSetSystemThunks not found"; |
66 return false; | 67 return false; |
67 } | 68 } |
68 | 69 |
| 70 // TODO(ncbray): enforce the private nature of this API, somehow? |
| 71 SetThunks(&MojoMakeSystemImplControlThunksPrivate, |
| 72 "MojoSetSystemImplControlThunksPrivate", app_library); |
| 73 SetThunks(&MojoMakeSystemImplThunksPrivate, "MojoSetSystemImplThunksPrivate", |
| 74 app_library); |
| 75 |
69 if (SetThunks(&MojoMakeGLES2ControlThunks, "MojoSetGLES2ControlThunks", | 76 if (SetThunks(&MojoMakeGLES2ControlThunks, "MojoSetGLES2ControlThunks", |
70 app_library)) { | 77 app_library)) { |
71 // If we have the control thunks, we should also have the GLES2 | 78 // If we have the control thunks, we should also have the GLES2 |
72 // implementation thunks. | 79 // implementation thunks. |
73 if (!SetThunks(&MojoMakeGLES2ImplThunks, "MojoSetGLES2ImplThunks", | 80 if (!SetThunks(&MojoMakeGLES2ImplThunks, "MojoSetGLES2ImplThunks", |
74 app_library)) { | 81 app_library)) { |
75 LOG(ERROR) | 82 LOG(ERROR) |
76 << "MojoSetGLES2ControlThunks found, but not MojoSetGLES2ImplThunks"; | 83 << "MojoSetGLES2ControlThunks found, but not MojoSetGLES2ImplThunks"; |
77 return false; | 84 return false; |
78 } | 85 } |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 // |MojoMain()| takes ownership of the service handle. | 121 // |MojoMain()| takes ownership of the service handle. |
115 MojoHandle handle = application_request.PassMessagePipe().release().value(); | 122 MojoHandle handle = application_request.PassMessagePipe().release().value(); |
116 MojoResult result = main_function(handle); | 123 MojoResult result = main_function(handle); |
117 LOG_IF(ERROR, result != MOJO_RESULT_OK) | 124 LOG_IF(ERROR, result != MOJO_RESULT_OK) |
118 << "MojoMain returned error (result: " << result << ")"; | 125 << "MojoMain returned error (result: " << result << ")"; |
119 return true; | 126 return true; |
120 } | 127 } |
121 | 128 |
122 } // namespace shell | 129 } // namespace shell |
123 } // namespace mojo | 130 } // namespace mojo |
OLD | NEW |