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

Side by Side Diff: services/shell/runner/host/native_application_support.cc

Issue 2054513002: Revert of Mojo: Eliminate duplicate C API symbols (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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
« no previous file with comments | « services/shell/runner/host/BUILD.gn ('k') | ui/gfx/gfx.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "services/shell/runner/host/native_application_support.h" 5 #include "services/shell/runner/host/native_application_support.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
11 #include "base/files/file_util.h" 11 #include "base/files/file_util.h"
12 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "mojo/edk/embedder/entrypoints.h" 13 #include "mojo/public/platform/native/system_thunks.h"
14 #include "mojo/public/c/system/thunks.h"
15 14
16 namespace shell { 15 namespace shell {
17 16
18 namespace { 17 namespace {
19 18
20 template <typename Thunks> 19 template <typename Thunks>
21 bool SetThunks(Thunks (*make_thunks)(), 20 bool SetThunks(Thunks (*make_thunks)(),
22 const char* function_name, 21 const char* function_name,
23 base::NativeLibrary library) { 22 base::NativeLibrary library) {
24 typedef size_t (*SetThunksFn)(const Thunks* thunks); 23 typedef size_t (*SetThunksFn)(const Thunks* thunks);
(...skipping 25 matching lines...) Expand all
50 49
51 bool RunNativeApplication(base::NativeLibrary app_library, 50 bool RunNativeApplication(base::NativeLibrary app_library,
52 mojom::ShellClientRequest request) { 51 mojom::ShellClientRequest request) {
53 // Tolerate |app_library| being null, to make life easier for callers. 52 // Tolerate |app_library| being null, to make life easier for callers.
54 if (!app_library) 53 if (!app_library)
55 return false; 54 return false;
56 55
57 // Thunks aren't needed/used in component build, since the thunked methods 56 // Thunks aren't needed/used in component build, since the thunked methods
58 // just live in their own dynamically loaded library. 57 // just live in their own dynamically loaded library.
59 #if !defined(COMPONENT_BUILD) 58 #if !defined(COMPONENT_BUILD)
60 if (!SetThunks(&mojo::edk::MakeSystemThunks, "MojoSetSystemThunks", 59 if (!SetThunks(&MojoMakeSystemThunks, "MojoSetSystemThunks", app_library)) {
61 app_library)) {
62 LOG(ERROR) << "MojoSetSystemThunks not found"; 60 LOG(ERROR) << "MojoSetSystemThunks not found";
63 return false; 61 return false;
64 } 62 }
65 63
66 #if !defined(OS_WIN) 64 #if !defined(OS_WIN)
67 // On Windows, initializing base::CommandLine with null parameters gets the 65 // On Windows, initializing base::CommandLine with null parameters gets the
68 // process's command line from the OS. Other platforms need it to be passed 66 // process's command line from the OS. Other platforms need it to be passed
69 // in. This needs to be passed in before the app initializes the command line, 67 // in. This needs to be passed in before the app initializes the command line,
70 // which is done as soon as it loads. 68 // which is done as soon as it loads.
71 typedef void (*InitCommandLineArgs)(int, const char* const*); 69 typedef void (*InitCommandLineArgs)(int, const char* const*);
(...skipping 23 matching lines...) Expand all
95 // |MojoMain()| takes ownership of the service handle. 93 // |MojoMain()| takes ownership of the service handle.
96 MojoHandle handle = request.PassMessagePipe().release().value(); 94 MojoHandle handle = request.PassMessagePipe().release().value();
97 MojoResult result = main_function(handle); 95 MojoResult result = main_function(handle);
98 if (result != MOJO_RESULT_OK) { 96 if (result != MOJO_RESULT_OK) {
99 LOG(ERROR) << "MojoMain returned error (result: " << result << ")"; 97 LOG(ERROR) << "MojoMain returned error (result: " << result << ")";
100 } 98 }
101 return true; 99 return true;
102 } 100 }
103 101
104 } // namespace shell 102 } // namespace shell
OLDNEW
« no previous file with comments | « services/shell/runner/host/BUILD.gn ('k') | ui/gfx/gfx.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698