Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(158)

Side by Side Diff: mojo/shell/in_process_dynamic_service_runner.cc

Issue 413303002: mojo: Convert gles2 to the new thunking system (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase to ToT Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "mojo/shell/in_process_dynamic_service_runner.h" 5 #include "mojo/shell/in_process_dynamic_service_runner.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback_helpers.h" 8 #include "base/callback_helpers.h"
9 #include "base/location.h" 9 #include "base/location.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/message_loop/message_loop_proxy.h" 11 #include "base/message_loop/message_loop_proxy.h"
12 #include "mojo/public/platform/native/gles2_thunks.h"
12 #include "mojo/public/platform/native/system_thunks.h" 13 #include "mojo/public/platform/native/system_thunks.h"
13 14
14 namespace mojo { 15 namespace mojo {
15 namespace shell { 16 namespace shell {
16 17
17 InProcessDynamicServiceRunner::InProcessDynamicServiceRunner( 18 InProcessDynamicServiceRunner::InProcessDynamicServiceRunner(
18 Context* context) 19 Context* context)
19 : keep_alive_(context) { 20 : keep_alive_(context) {
20 } 21 }
21 22
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 } 80 }
80 } else { 81 } else {
81 // In the component build, Mojo Apps link against mojo_system_impl. 82 // In the component build, Mojo Apps link against mojo_system_impl.
82 #if !defined(COMPONENT_BUILD) 83 #if !defined(COMPONENT_BUILD)
83 // Strictly speaking this is not required, but it's very unusual to have 84 // Strictly speaking this is not required, but it's very unusual to have
84 // an app that doesn't require the basic system library. 85 // an app that doesn't require the basic system library.
85 LOG(WARNING) << "MojoSetSystemThunks not found in app library"; 86 LOG(WARNING) << "MojoSetSystemThunks not found in app library";
86 #endif 87 #endif
87 } 88 }
88 89
90 MojoSetGLES2ThunksFn mojo_set_gles2_thunks_fn =
91 reinterpret_cast<MojoSetGLES2ThunksFn>(app_library_.GetFunctionPointer(
92 "MojoSetGLES2Thunks"));
93 if (mojo_set_gles2_thunks_fn) {
94 MojoGLES2Thunks gles2_thunks = MojoMakeGLES2Thunks();
95 size_t expected_size = mojo_set_gles2_thunks_fn(&gles2_thunks);
96 if (expected_size > sizeof(MojoGLES2Thunks)) {
97 LOG(ERROR)
98 << "Invalid app library: expected MojoGLES2Thunks size: "
99 << expected_size;
100 break;
101 }
102 }
103 // Unlike system thunks, we don't warn on a lack of GLES2 thunks because
104 // not everything is a visual app.
105
89 typedef MojoResult (*MojoMainFunction)(MojoHandle); 106 typedef MojoResult (*MojoMainFunction)(MojoHandle);
90 MojoMainFunction main_function = reinterpret_cast<MojoMainFunction>( 107 MojoMainFunction main_function = reinterpret_cast<MojoMainFunction>(
91 app_library_.GetFunctionPointer("MojoMain")); 108 app_library_.GetFunctionPointer("MojoMain"));
92 if (!main_function) { 109 if (!main_function) {
93 LOG(ERROR) << "Entrypoint MojoMain not found"; 110 LOG(ERROR) << "Entrypoint MojoMain not found";
94 break; 111 break;
95 } 112 }
96 113
97 // |MojoMain()| takes ownership of the service handle. 114 // |MojoMain()| takes ownership of the service handle.
98 MojoResult result = main_function(service_handle_.release().value()); 115 MojoResult result = main_function(service_handle_.release().value());
99 if (result < MOJO_RESULT_OK) 116 if (result < MOJO_RESULT_OK)
100 LOG(ERROR) << "MojoMain returned an error: " << result; 117 LOG(ERROR) << "MojoMain returned an error: " << result;
101 } while (false); 118 } while (false);
102 119
103 bool success = app_completed_callback_runner_.Run(); 120 bool success = app_completed_callback_runner_.Run();
104 app_completed_callback_runner_.Reset(); 121 app_completed_callback_runner_.Reset();
105 LOG_IF(ERROR, !success) << "Failed post run app_completed_callback"; 122 LOG_IF(ERROR, !success) << "Failed post run app_completed_callback";
106 } 123 }
107 124
108 } // namespace shell 125 } // namespace shell
109 } // namespace mojo 126 } // namespace mojo
OLDNEW
« mojo/public/platform/native/gles2_thunks.h ('K') | « mojo/shell/context.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698