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

Side by Side Diff: shell/dynamic_service_runner.cc

Issue 868463008: Remove Client relationship between mojo.Shell/mojo.Application (Closed) Base URL: git@github.com:domokit/mojo.git@app_impl_init
Patch Set: fix android Created 5 years, 11 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
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 "shell/dynamic_service_runner.h" 5 #include "shell/dynamic_service_runner.h"
6 6
7 #include "base/files/file_path.h" 7 #include "base/files/file_path.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "mojo/public/platform/native/gles2_impl_chromium_sync_point_thunks.h" 9 #include "mojo/public/platform/native/gles2_impl_chromium_sync_point_thunks.h"
10 #include "mojo/public/platform/native/gles2_impl_chromium_texture_mailbox_thunks .h" 10 #include "mojo/public/platform/native/gles2_impl_chromium_texture_mailbox_thunks .h"
(...skipping 22 matching lines...) Expand all
33 << " to return thunks of size: " << expected_size; 33 << " to return thunks of size: " << expected_size;
34 return false; 34 return false;
35 } 35 }
36 return true; 36 return true;
37 } 37 }
38 38
39 } // namespace 39 } // namespace
40 40
41 base::NativeLibrary DynamicServiceRunner::LoadAndRunService( 41 base::NativeLibrary DynamicServiceRunner::LoadAndRunService(
42 const base::FilePath& app_path, 42 const base::FilePath& app_path,
43 ScopedMessagePipeHandle service_handle) { 43 InterfaceRequest<Application> application_request) {
44 DVLOG(2) << "Loading/running Mojo app in process from library: " 44 DVLOG(2) << "Loading/running Mojo app in process from library: "
45 << app_path.value(); 45 << app_path.value();
46 base::NativeLibraryLoadError error; 46 base::NativeLibraryLoadError error;
47 base::NativeLibrary app_library = base::LoadNativeLibrary(app_path, &error); 47 base::NativeLibrary app_library = base::LoadNativeLibrary(app_path, &error);
48 do { 48 do {
49 if (!app_library) { 49 if (!app_library) {
50 LOG(ERROR) << "Failed to load app library (error: " << error.ToString() 50 LOG(ERROR) << "Failed to load app library (error: " << error.ToString()
51 << ")"; 51 << ")";
52 break; 52 break;
53 } 53 }
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 // not everything is a visual app. 91 // not everything is a visual app.
92 92
93 typedef MojoResult (*MojoMainFunction)(MojoHandle); 93 typedef MojoResult (*MojoMainFunction)(MojoHandle);
94 MojoMainFunction main_function = reinterpret_cast<MojoMainFunction>( 94 MojoMainFunction main_function = reinterpret_cast<MojoMainFunction>(
95 base::GetFunctionPointerFromNativeLibrary(app_library, "MojoMain")); 95 base::GetFunctionPointerFromNativeLibrary(app_library, "MojoMain"));
96 if (!main_function) { 96 if (!main_function) {
97 LOG(ERROR) << app_path.value() << " MojoMain not found"; 97 LOG(ERROR) << app_path.value() << " MojoMain not found";
98 break; 98 break;
99 } 99 }
100 // |MojoMain()| takes ownership of the service handle. 100 // |MojoMain()| takes ownership of the service handle.
101 MojoResult result = main_function(service_handle.release().value()); 101 MojoHandle handle = application_request.PassMessagePipe().release().value();
102 MojoResult result = main_function(handle);
102 if (result < MOJO_RESULT_OK) { 103 if (result < MOJO_RESULT_OK) {
103 LOG(ERROR) << app_path.value() << " MojoMain returned error(" << result 104 LOG(ERROR) << app_path.value() << " MojoMain returned error(" << result
104 << ")"; 105 << ")";
105 } 106 }
106 } while (false); 107 } while (false);
107 108
108 return app_library; 109 return app_library;
109 } 110 }
110 111
111 } // namespace shell 112 } // namespace shell
112 } // namespace mojo 113 } // namespace mojo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698