Commit eef69a40 authored by ben's avatar ben Committed by Commit bot

Purge references of "Mojo Application" from comments & var names.

Replace with Service.

TBR=rockot@chromium.org,tsepez@chromium.org

Review-Url: https://codereview.chromium.org/2397353002
Cr-Commit-Position: refs/heads/master@{#423865}
parent 1bb1fb7f
...@@ -16,7 +16,7 @@ class Connector; ...@@ -16,7 +16,7 @@ class Connector;
namespace ash { namespace ash {
// Mus+ash implementation of the AppListPresenter interface for mash, which // Mus+ash implementation of the AppListPresenter interface for mash, which
// talks to the mojo app list service in chrome. // talks to the app list service in chrome.
class AppListPresenterMus : public app_list::AppListPresenter { class AppListPresenterMus : public app_list::AppListPresenter {
public: public:
explicit AppListPresenterMus(::shell::Connector* connector); explicit AppListPresenterMus(::shell::Connector* connector);
...@@ -30,7 +30,7 @@ class AppListPresenterMus : public app_list::AppListPresenter { ...@@ -30,7 +30,7 @@ class AppListPresenterMus : public app_list::AppListPresenter {
bool GetTargetVisibility() const override; bool GetTargetVisibility() const override;
private: private:
// Connect to the mojo app list service in chrome if the connection hasn't // Connect to the app list service in chrome if the connection hasn't
// been established or has an error. // been established or has an error.
void ConnectIfNeeded(); void ConnectIfNeeded();
......
...@@ -50,10 +50,10 @@ BASE_I18N_EXPORT const uint8_t* GetRawIcuMemory(); ...@@ -50,10 +50,10 @@ BASE_I18N_EXPORT const uint8_t* GetRawIcuMemory();
// //
// This does nothing in component builds; this initialization should only be // This does nothing in component builds; this initialization should only be
// done in cases where there could be two copies of base in a single process in // done in cases where there could be two copies of base in a single process in
// non-component builds. (The big example is mojo: the shell will have a copy // non-component builds. (The big example is standalone service libraries: the
// of base linked in, and the majority of mojo applications will have base // Service Manager will have a copy of base linked in, and the majority of
// linked in but in non-component builds, these will be separate copies of // service libraries will have base linked in but in non-component builds,
// base.) // these will be separate copies of base.)
BASE_I18N_EXPORT bool InitializeICUFromRawMemory(const uint8_t* raw_memory); BASE_I18N_EXPORT bool InitializeICUFromRawMemory(const uint8_t* raw_memory);
#endif // ICU_UTIL_DATA_IMPL == ICU_UTIL_DATA_FILE #endif // ICU_UTIL_DATA_IMPL == ICU_UTIL_DATA_FILE
#endif // !defined(OS_NACL) #endif // !defined(OS_NACL)
......
...@@ -359,9 +359,9 @@ Status MojoEnv::UnlockFile(FileLock* lock) { ...@@ -359,9 +359,9 @@ Status MojoEnv::UnlockFile(FileLock* lock) {
Status MojoEnv::GetTestDirectory(std::string* path) { Status MojoEnv::GetTestDirectory(std::string* path) {
// TODO(erg): This method is actually only used from the test harness in // TODO(erg): This method is actually only used from the test harness in
// leveldb. And when we go and port that test stuff to a mojo apptest, we // leveldb. And when we go and port that test stuff to a shell::ServiceTest,
// probably won't use it since the mojo filesystem actually handles temporary // we probably won't use it since the mojo filesystem actually handles
// filesystems just fine. // temporary filesystems just fine.
NOTREACHED(); NOTREACHED();
return Status::OK(); return Status::OK();
} }
......
...@@ -186,11 +186,11 @@ void RenderWidgetHostViewMus::SetIsLoading(bool is_loading) { ...@@ -186,11 +186,11 @@ void RenderWidgetHostViewMus::SetIsLoading(bool is_loading) {
void RenderWidgetHostViewMus::TextInputStateChanged( void RenderWidgetHostViewMus::TextInputStateChanged(
const TextInputState& params) { const TextInputState& params) {
// TODO(fsamuel): Implement an IME mojo app. // TODO(fsamuel): Implement an IME service.
} }
void RenderWidgetHostViewMus::ImeCancelComposition() { void RenderWidgetHostViewMus::ImeCancelComposition() {
// TODO(fsamuel): Implement an IME mojo app. // TODO(fsamuel): Implement an IME service.
} }
void RenderWidgetHostViewMus::ImeCompositionRangeChanged( void RenderWidgetHostViewMus::ImeCompositionRangeChanged(
......
...@@ -6,8 +6,8 @@ implementation. It should be used by code running on top of the system-level ...@@ -6,8 +6,8 @@ implementation. It should be used by code running on top of the system-level
APIs to set up the Mojo environment (instead of directly instantiating things APIs to set up the Mojo environment (instead of directly instantiating things
from src/mojo/edk/system). from src/mojo/edk/system).
Example uses: Mojo shell, to set up the Mojo environment for Mojo apps; Chromium Example uses: Service Manager, to set up the Mojo environment for Services;
code, to set up the Mojo IPC system for use between processes. Note that most Chromium code, to set up the Mojo IPC system for use between processes. Note
code should use the Mojo Public API (under src/mojo/public) instead. The that most code should use the Mojo Public API (under src/mojo/public) instead.
Embedder API should only be used to initialize the environment, set up the The Embedder API should only be used to initialize the environment, set up the
initial MessagePipe between two processes, etc. initial MessagePipe between two processes, etc.
...@@ -31,7 +31,7 @@ Platform ...@@ -31,7 +31,7 @@ Platform
-------- --------
The platform/ subdirectory contains any build-time requirements (e.g., static The platform/ subdirectory contains any build-time requirements (e.g., static
libraries) that may be needed to produce a Mojo application for certain libraries) that may be needed to produce a Service library for certain
platforms, such as a native shared library or as a NaCl binary. platforms, such as a native shared library or as a NaCl binary.
Tools Tools
......
...@@ -7,7 +7,7 @@ System ...@@ -7,7 +7,7 @@ System
------ ------
The system/ subdirectory provides definitions of the basic low-level API used by The system/ subdirectory provides definitions of the basic low-level API used by
all Mojo applications (whether directly or indirectly). These consist primarily all Services (whether directly or indirectly). These consist primarily
of the IPC primitives used to communicate with Mojo services. of the IPC primitives used to communicate with Mojo services.
Though the message protocol is stable, the implementation of the transport is Though the message protocol is stable, the implementation of the transport is
......
...@@ -46,7 +46,7 @@ class ResponderThunk : public MessageReceiverWithStatus { ...@@ -46,7 +46,7 @@ class ResponderThunk : public MessageReceiverWithStatus {
task_runner_(std::move(runner)) {} task_runner_(std::move(runner)) {}
~ResponderThunk() override { ~ResponderThunk() override {
if (!accept_was_invoked_) { if (!accept_was_invoked_) {
// The Mojo application handled a message that was expecting a response // The Service handled a message that was expecting a response
// but did not send a response. // but did not send a response.
// We raise an error to signal the calling application that an error // We raise an error to signal the calling application that an error
// condition occurred. Without this the calling application would have no // condition occurred. Without this the calling application would have no
......
...@@ -38,7 +38,7 @@ class ResponderThunk : public MessageReceiverWithStatus { ...@@ -38,7 +38,7 @@ class ResponderThunk : public MessageReceiverWithStatus {
task_runner_(std::move(runner)) {} task_runner_(std::move(runner)) {}
~ResponderThunk() override { ~ResponderThunk() override {
if (!accept_was_invoked_) { if (!accept_was_invoked_) {
// The Mojo application handled a message that was expecting a response // The Service handled a message that was expecting a response
// but did not send a response. // but did not send a response.
// We raise an error to signal the calling application that an error // We raise an error to signal the calling application that an error
// condition occurred. Without this the calling application would have no // condition occurred. Without this the calling application would have no
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
// Note: This file is for documentation purposes only. The code here is not // Note: This file is for documentation purposes only. The code here is not
// actually executed. The real module is implemented natively in Mojo. // actually executed. The real module is implemented natively in Mojo.
// //
// This module provides a way for a Mojo application implemented in JS // This module provides a way for a Service implemented in JS
// to exit by quitting the current message loop. This module is not // to exit by quitting the current message loop. This module is not
// intended to be used by Mojo JS application started by the JS // intended to be used by Mojo JS application started by the JS
// content handler. // content handler.
......
...@@ -236,7 +236,7 @@ class {{class_name}}_{{method.name}}_ProxyToResponder { ...@@ -236,7 +236,7 @@ class {{class_name}}_{{method.name}}_ProxyToResponder {
~{{class_name}}_{{method.name}}_ProxyToResponder() { ~{{class_name}}_{{method.name}}_ProxyToResponder() {
#if DCHECK_IS_ON() #if DCHECK_IS_ON()
if (responder_) { if (responder_) {
// Is the Mojo application destroying the callback without running it // Is the Service destroying the callback without running it
// and without first closing the pipe? // and without first closing the pipe?
responder_->DCheckInvalid("The callback passed to " responder_->DCheckInvalid("The callback passed to "
"{{class_name}}::{{method.name}}() was never run."); "{{class_name}}::{{method.name}}() was never run.");
......
...@@ -4,9 +4,9 @@ ...@@ -4,9 +4,9 @@
module shell.mojom; module shell.mojom;
// Mojo Capabilities ----------------------------------------------------------- // Capabilities ----------------------------------------------------------------
// //
// Mojo applications expose interfaces and capability classes to one another. // Services expose interfaces and capability classes to one another.
// //
// An interface is just a Mojo interface, defined in a mojom file like this one. // An interface is just a Mojo interface, defined in a mojom file like this one.
// In a CapabilitySpec, an interface is represented by its fully qualified name, // In a CapabilitySpec, an interface is represented by its fully qualified name,
......
...@@ -82,7 +82,7 @@ struct ClientProcessConnection { ...@@ -82,7 +82,7 @@ struct ClientProcessConnection {
handle<message_pipe> pid_receiver_request; handle<message_pipe> pid_receiver_request;
}; };
// Encapsulates establishing connections with other Mojo applications. // Encapsulates establishing connections with other Services.
interface Connector { interface Connector {
// Requests a connection with another application. The application originating // Requests a connection with another application. The application originating
// the request is referred to as the "source" and the one receiving the // the request is referred to as the "source" and the one receiving the
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
namespace switches { namespace switches {
// Used internally by the main process to indicate that a new process should be // Used internally by the main process to indicate that a new process should be
// a child process. Takes the absolute path to the mojo application to load as // a child process. Takes the absolute path to the service library to load as
// an argument. Not for user use. // an argument. Not for user use.
const char kChildProcess[] = "child-process"; const char kChildProcess[] = "child-process";
......
...@@ -15,10 +15,10 @@ group("host") { ...@@ -15,10 +15,10 @@ group("host") {
] ]
} }
source_set("native_application_support") { source_set("native_library_runner") {
sources = [ sources = [
"native_application_support.cc", "native_library_runner.cc",
"native_application_support.h", "native_library_runner.h",
] ]
deps = [ deps = [
...@@ -86,7 +86,7 @@ source_set("lib") { ...@@ -86,7 +86,7 @@ source_set("lib") {
deps = [ deps = [
":child_process_base", ":child_process_base",
":native_application_support", ":native_library_runner",
"//base:base_static", "//base:base_static",
"//base:i18n", "//base:i18n",
"//services/shell/public/cpp:sources", "//services/shell/public/cpp:sources",
......
...@@ -33,17 +33,17 @@ ...@@ -33,17 +33,17 @@
#include "mojo/public/cpp/system/core.h" #include "mojo/public/cpp/system/core.h"
#include "services/shell/runner/common/switches.h" #include "services/shell/runner/common/switches.h"
#include "services/shell/runner/host/child_process_base.h" #include "services/shell/runner/host/child_process_base.h"
#include "services/shell/runner/host/native_application_support.h" #include "services/shell/runner/host/native_library_runner.h"
#include "services/shell/runner/init.h" #include "services/shell/runner/init.h"
namespace shell { namespace shell {
namespace { namespace {
void RunNativeLibrary(base::NativeLibrary app_library, void RunNativeLibrary(base::NativeLibrary library,
mojom::ServiceRequest service_request) { mojom::ServiceRequest service_request) {
if (!RunNativeApplication(app_library, std::move(service_request))) { if (!RunServiceInNativeLibrary(library, std::move(service_request))) {
LOG(ERROR) << "Failure to RunNativeApplication()"; LOG(ERROR) << "Failure to RunServiceInNativeLibrary()";
} }
} }
...@@ -54,17 +54,17 @@ int ChildProcessMain() { ...@@ -54,17 +54,17 @@ int ChildProcessMain() {
const base::CommandLine& command_line = const base::CommandLine& command_line =
*base::CommandLine::ForCurrentProcess(); *base::CommandLine::ForCurrentProcess();
base::NativeLibrary app_library = 0; base::NativeLibrary library = 0;
// Load the application library before we engage the sandbox. // Load the application library before we engage the sandbox.
base::FilePath app_library_path = base::FilePath library_path =
command_line.GetSwitchValuePath(switches::kChildProcess); command_line.GetSwitchValuePath(switches::kChildProcess);
if (!app_library_path.empty()) if (!library_path.empty())
app_library = LoadNativeApplication(app_library_path); library = LoadNativeLibrary(library_path);
base::i18n::InitializeICU(); base::i18n::InitializeICU();
if (app_library) if (library)
CallLibraryEarlyInitialization(app_library); CallLibraryEarlyInitialization(library);
ChildProcessMainWithCallback(base::Bind(&RunNativeLibrary, app_library)); ChildProcessMainWithCallback(base::Bind(&RunNativeLibrary, library));
return 0; return 0;
} }
......
...@@ -57,7 +57,7 @@ std::unique_ptr<LinuxSandbox> InitializeSandbox() { ...@@ -57,7 +57,7 @@ std::unique_ptr<LinuxSandbox> InitializeSandbox() {
#endif #endif
// Should be created and initialized on the main thread and kept alive as long // Should be created and initialized on the main thread and kept alive as long
// a Mojo application is running in the current process. // a Service is running in the current process.
class ScopedAppContext : public mojo::edk::ProcessDelegate { class ScopedAppContext : public mojo::edk::ProcessDelegate {
public: public:
ScopedAppContext() ScopedAppContext()
......
...@@ -50,7 +50,7 @@ class ChildProcessHost { ...@@ -50,7 +50,7 @@ class ChildProcessHost {
// |name| is just for debugging ease. We will spawn off a process so that it // |name| is just for debugging ease. We will spawn off a process so that it
// can be sandboxed if |start_sandboxed| is true. |app_path| is a path to the // can be sandboxed if |start_sandboxed| is true. |app_path| is a path to the
// mojo application we wish to start. // service we wish to start.
ChildProcessHost(base::TaskRunner* launch_process_runner, ChildProcessHost(base::TaskRunner* launch_process_runner,
NativeRunnerDelegate* delegate, NativeRunnerDelegate* delegate,
bool start_sandboxed, bool start_sandboxed,
......
...@@ -16,17 +16,17 @@ ...@@ -16,17 +16,17 @@
#include "base/threading/platform_thread.h" #include "base/threading/platform_thread.h"
#include "base/threading/thread_task_runner_handle.h" #include "base/threading/thread_task_runner_handle.h"
#include "mojo/public/cpp/bindings/interface_request.h" #include "mojo/public/cpp/bindings/interface_request.h"
#include "services/shell/runner/host/native_application_support.h" #include "services/shell/runner/host/native_library_runner.h"
#include "services/shell/runner/host/out_of_process_native_runner.h" #include "services/shell/runner/host/out_of_process_native_runner.h"
#include "services/shell/runner/init.h" #include "services/shell/runner/init.h"
namespace shell { namespace shell {
InProcessNativeRunner::InProcessNativeRunner() : app_library_(nullptr) {} InProcessNativeRunner::InProcessNativeRunner() : library_(nullptr) {}
InProcessNativeRunner::~InProcessNativeRunner() { InProcessNativeRunner::~InProcessNativeRunner() {
// It is important to let the thread exit before unloading the DSO (when // It is important to let the thread exit before unloading the DSO (when
// app_library_ is destructed), because the library may have registered // library_ is destructed), because the library may have registered
// thread-local data and destructors to run on thread termination. // thread-local data and destructors to run on thread termination.
if (thread_) { if (thread_) {
DCHECK(thread_->HasBeenStarted()); DCHECK(thread_->HasBeenStarted());
...@@ -36,26 +36,26 @@ InProcessNativeRunner::~InProcessNativeRunner() { ...@@ -36,26 +36,26 @@ InProcessNativeRunner::~InProcessNativeRunner() {
} }
mojom::ServicePtr InProcessNativeRunner::Start( mojom::ServicePtr InProcessNativeRunner::Start(
const base::FilePath& app_path, const base::FilePath& library_path,
const Identity& target, const Identity& target,
bool start_sandboxed, bool start_sandboxed,
const base::Callback<void(base::ProcessId)>& pid_available_callback, const base::Callback<void(base::ProcessId)>& pid_available_callback,
const base::Closure& app_completed_callback) { const base::Closure& service_completed_callback) {
app_path_ = app_path; library_path_ = library_path;
DCHECK(!request_.is_pending()); DCHECK(!request_.is_pending());
mojom::ServicePtr client; mojom::ServicePtr client;
request_ = GetProxy(&client); request_ = GetProxy(&client);
DCHECK(app_completed_callback_runner_.is_null()); DCHECK(service_completed_callback_runner_.is_null());
app_completed_callback_runner_ = base::Bind( service_completed_callback_runner_ = base::Bind(
&base::TaskRunner::PostTask, base::ThreadTaskRunnerHandle::Get(), &base::TaskRunner::PostTask, base::ThreadTaskRunnerHandle::Get(),
FROM_HERE, app_completed_callback); FROM_HERE, service_completed_callback);
DCHECK(!thread_); DCHECK(!thread_);
std::string thread_name = "Service Thread"; std::string thread_name = "Service Thread";
#if defined(OS_WIN) #if defined(OS_WIN)
thread_name = base::WideToUTF8(app_path_.BaseName().value()); thread_name = base::WideToUTF8(library_path_.BaseName().value());
#endif #endif
thread_.reset(new base::DelegateSimpleThread(this, thread_name)); thread_.reset(new base::DelegateSimpleThread(this, thread_name));
thread_->Start(); thread_->Start();
...@@ -65,27 +65,27 @@ mojom::ServicePtr InProcessNativeRunner::Start( ...@@ -65,27 +65,27 @@ mojom::ServicePtr InProcessNativeRunner::Start(
} }
void InProcessNativeRunner::Run() { void InProcessNativeRunner::Run() {
DVLOG(2) << "Loading/running Mojo app in process from library: " DVLOG(2) << "Loading/running Service in process from library: "
<< app_path_.value() << library_path_.value()
<< " thread id=" << base::PlatformThread::CurrentId(); << " thread id=" << base::PlatformThread::CurrentId();
// TODO(vtl): ScopedNativeLibrary doesn't have a .get() method! // TODO(vtl): ScopedNativeLibrary doesn't have a .get() method!
base::NativeLibrary app_library = LoadNativeApplication(app_path_); base::NativeLibrary library = LoadNativeLibrary(library_path_);
app_library_.Reset(app_library); library_.Reset(library);
// This hangs on Windows in the component build, so skip it since it's // This hangs on Windows in the component build, so skip it since it's
// unnecessary. // unnecessary.
#if !(defined(COMPONENT_BUILD) && defined(OS_WIN)) #if !(defined(COMPONENT_BUILD) && defined(OS_WIN))
CallLibraryEarlyInitialization(app_library); CallLibraryEarlyInitialization(library);
#endif #endif
RunNativeApplication(app_library, std::move(request_)); RunServiceInNativeLibrary(library, std::move(request_));
app_completed_callback_runner_.Run(); service_completed_callback_runner_.Run();
app_completed_callback_runner_.Reset(); service_completed_callback_runner_.Reset();
} }
std::unique_ptr<NativeRunner> InProcessNativeRunnerFactory::Create( std::unique_ptr<NativeRunner> InProcessNativeRunnerFactory::Create(
const base::FilePath& app_path) { const base::FilePath& library_path) {
// Non-Mojo apps are always run in a new process. // Executables are always run in a new process.
if (!app_path.MatchesExtension(FILE_PATH_LITERAL(".library"))) { if (!library_path.MatchesExtension(FILE_PATH_LITERAL(".library"))) {
return base::MakeUnique<OutOfProcessNativeRunner>(launch_process_runner_, return base::MakeUnique<OutOfProcessNativeRunner>(launch_process_runner_,
nullptr); nullptr);
} }
......
...@@ -13,7 +13,6 @@ ...@@ -13,7 +13,6 @@
#include "base/scoped_native_library.h" #include "base/scoped_native_library.h"
#include "base/threading/simple_thread.h" #include "base/threading/simple_thread.h"
#include "services/shell/native_runner.h" #include "services/shell/native_runner.h"
#include "services/shell/runner/host/native_application_support.h"
namespace base { namespace base {
class TaskRunner; class TaskRunner;
...@@ -21,8 +20,8 @@ class TaskRunner; ...@@ -21,8 +20,8 @@ class TaskRunner;
namespace shell { namespace shell {
// An implementation of |NativeRunner| that loads/runs the given app (from the // An implementation of |NativeRunner| that loads/runs the given service (from
// file system) on a separate thread (in the current process). // the file system) on a separate thread (in the current process).
class InProcessNativeRunner : public NativeRunner, class InProcessNativeRunner : public NativeRunner,
public base::DelegateSimpleThread::Delegate { public base::DelegateSimpleThread::Delegate {
public: public:
...@@ -31,21 +30,21 @@ class InProcessNativeRunner : public NativeRunner, ...@@ -31,21 +30,21 @@ class InProcessNativeRunner : public NativeRunner,
// NativeRunner: // NativeRunner:
mojom::ServicePtr Start( mojom::ServicePtr Start(
const base::FilePath& app_path, const base::FilePath& library_path,
const Identity& target, const Identity& target,
bool start_sandboxed, bool start_sandboxed,
const base::Callback<void(base::ProcessId)>& pid_available_callback, const base::Callback<void(base::ProcessId)>& pid_available_callback,
const base::Closure& app_completed_callback) override; const base::Closure& service_completed_callback) override;
private: private:
// |base::DelegateSimpleThread::Delegate| method: // |base::DelegateSimpleThread::Delegate| method:
void Run() override; void Run() override;
base::FilePath app_path_; base::FilePath library_path_;
mojom::ServiceRequest request_; mojom::ServiceRequest request_;
base::Callback<bool(void)> app_completed_callback_runner_; base::Callback<bool(void)> service_completed_callback_runner_;
base::ScopedNativeLibrary app_library_; base::ScopedNativeLibrary library_;
std::unique_ptr<base::DelegateSimpleThread> thread_; std::unique_ptr<base::DelegateSimpleThread> thread_;
DISALLOW_COPY_AND_ASSIGN(InProcessNativeRunner); DISALLOW_COPY_AND_ASSIGN(InProcessNativeRunner);
...@@ -57,7 +56,8 @@ class InProcessNativeRunnerFactory : public NativeRunnerFactory { ...@@ -57,7 +56,8 @@ class InProcessNativeRunnerFactory : public NativeRunnerFactory {
: launch_process_runner_(launch_process_runner) {} : launch_process_runner_(launch_process_runner) {}
~InProcessNativeRunnerFactory() override {} ~InProcessNativeRunnerFactory() override {}
std::unique_ptr<NativeRunner> Create(const base::FilePath& app_path) override; std::unique_ptr<NativeRunner> Create(
const base::FilePath& library_path) override;
private: private:
base::TaskRunner* const launch_process_runner_; base::TaskRunner* const launch_process_runner_;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "services/shell/runner/host/native_application_support.h" #include "services/shell/runner/host/native_library_runner.h"
#include <stddef.h> #include <stddef.h>
...@@ -29,7 +29,7 @@ bool SetThunks(Thunks (*make_thunks)(), ...@@ -29,7 +29,7 @@ bool SetThunks(Thunks (*make_thunks)(),
Thunks thunks = make_thunks(); Thunks thunks = make_thunks();
size_t expected_size = set_thunks(&thunks); size_t expected_size = set_thunks(&thunks);
if (expected_size > sizeof(Thunks)) { if (expected_size > sizeof(Thunks)) {
LOG(ERROR) << "Invalid app library: expected " << function_name LOG(ERROR) << "Invalid library: expected " << function_name
<< " to return thunks of size: " << expected_size; << " to return thunks of size: " << expected_size;
return false; return false;
} }
...@@ -38,28 +38,28 @@ bool SetThunks(Thunks (*make_thunks)(), ...@@ -38,28 +38,28 @@ bool SetThunks(Thunks (*make_thunks)(),
} // namespace } // namespace
base::NativeLibrary LoadNativeApplication(const base::FilePath& app_path) { base::NativeLibrary LoadNativeLibrary(const base::FilePath& path) {
DVLOG(2) << "Loading Mojo app in process from library: " << app_path.value(); DVLOG(2) << "Loading Service in process from library: " << path.value();
base::NativeLibraryLoadError error; base::NativeLibraryLoadError error;
base::NativeLibrary app_library = base::LoadNativeLibrary(app_path, &error); base::NativeLibrary library = base::LoadNativeLibrary(path, &error);
LOG_IF(ERROR, !app_library) LOG_IF(ERROR, !library)
<< "Failed to load app library (path: " << app_path.value() << "Failed to load library (path: " << path.value()
<< " reason: " << error.ToString() << ")"; << " reason: " << error.ToString() << ")";
return app_library; return library;
} }
bool RunNativeApplication(base::NativeLibrary app_library, bool RunServiceInNativeLibrary(base::NativeLibrary library,
mojom::ServiceRequest request) { mojom::ServiceRequest request) {
// Tolerate |app_library| being null, to make life easier for callers. // Tolerate |library| being null, to make life easier for callers.
if (!app_library) if (!library)
return false; return false;
// Thunks aren't needed/used in component build, since the thunked methods // Thunks aren't needed/used in component build, since the thunked methods
// just live in their own dynamically loaded library. // just live in their own dynamically loaded library.
#if !defined(COMPONENT_BUILD) #if !defined(COMPONENT_BUILD)
if (!SetThunks(&mojo::edk::MakeSystemThunks, "MojoSetSystemThunks", if (!SetThunks(&mojo::edk::MakeSystemThunks, "MojoSetSystemThunks",
app_library)) { library)) {
LOG(ERROR) << "MojoSetSystemThunks not found"; LOG(ERROR) << "MojoSetSystemThunks not found";
return false; return false;
} }
...@@ -67,12 +67,12 @@ bool RunNativeApplication(base::NativeLibrary app_library, ...@@ -67,12 +67,12 @@ bool RunNativeApplication(base::NativeLibrary app_library,
#if !defined(OS_WIN) #if !defined(OS_WIN)
// On Windows, initializing base::CommandLine with null parameters gets the // On Windows, initializing base::CommandLine with null parameters gets the
// process's command line from the OS. Other platforms need it to be passed // process's command line from the OS. Other platforms need it to be passed
// in. This needs to be passed in before the app initializes the command line, // in. This needs to be passed in before the service initializes the command
// which is done as soon as it loads. // line, which is done as soon as it loads.
typedef void (*InitCommandLineArgs)(int, const char* const*); typedef void (*InitCommandLineArgs)(int, const char* const*);
InitCommandLineArgs init_command_line_args = InitCommandLineArgs init_command_line_args =
reinterpret_cast<InitCommandLineArgs>( reinterpret_cast<InitCommandLineArgs>(
base::GetFunctionPointerFromNativeLibrary(app_library, base::GetFunctionPointerFromNativeLibrary(library,
"InitCommandLineArgs")); "InitCommandLineArgs"));
if (init_command_line_args) { if (init_command_line_args) {
int argc = 0; int argc = 0;
...@@ -88,7 +88,7 @@ bool RunNativeApplication(base::NativeLibrary app_library, ...@@ -88,7 +88,7 @@ bool RunNativeApplication(base::NativeLibrary app_library,
typedef MojoResult (*ServiceMainFunction)(MojoHandle); typedef MojoResult (*ServiceMainFunction)(MojoHandle);
ServiceMainFunction main_function = reinterpret_cast<ServiceMainFunction>( ServiceMainFunction main_function = reinterpret_cast<ServiceMainFunction>(
base::GetFunctionPointerFromNativeLibrary(app_library, "ServiceMain")); base::GetFunctionPointerFromNativeLibrary(library, "ServiceMain"));
if (!main_function) { if (!main_function) {
LOG(ERROR) << "ServiceMain not found"; LOG(ERROR) << "ServiceMain not found";
return false; return false;
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef SERVICES_SHELL_RUNNER_HOST_NATIVE_APPLICATION_SUPPORT_H_ #ifndef SERVICES_SHELL_RUNNER_HOST_NATIVE_LIBRARY_RUNNER_H_
#define SERVICES_SHELL_RUNNER_HOST_NATIVE_APPLICATION_SUPPORT_H_ #define SERVICES_SHELL_RUNNER_HOST_NATIVE_LIBRARY_RUNNER_H_
#include "base/native_library.h" #include "base/native_library.h"
#include "mojo/public/cpp/bindings/interface_request.h" #include "mojo/public/cpp/bindings/interface_request.h"
...@@ -15,24 +15,24 @@ class FilePath; ...@@ -15,24 +15,24 @@ class FilePath;
namespace shell { namespace shell {
// Loads the native Mojo application from the DSO specified by |app_path|. // Loads the native Service from the DSO specified by |app_path|.
// Returns the |base::NativeLibrary| for the application on success (or null on // Returns the |base::NativeLibrary| for the service on success (or null on
// failure). // failure).
// //
// Note: The caller may choose to eventually unload the returned DSO. If so, // Note: The caller may choose to eventually unload the returned DSO. If so,
// this should be done only after the thread on which |LoadNativeApplication()| // this should be done only after the thread on which |LoadNativeLibrary()|
// and |RunNativeApplication()| were called has terminated, so that any // and |RunServiceInNativeLibrary()| were called has terminated, so that any
// thread-local destructors have been executed. // thread-local destructors have been executed.
base::NativeLibrary LoadNativeApplication(const base::FilePath& app_path); base::NativeLibrary LoadNativeLibrary(const base::FilePath& app_path);
// Runs the native Mojo application from the DSO that was loaded using // Runs the native Service from the DSO that was loaded using
// |LoadNativeApplication()|; this tolerates |app_library| being null. This // |LoadNativeLibrary()|; this tolerates |library| being null. This should be
// should be called on the same thread as |LoadNativeApplication()|. Returns // called on the same thread as |LoadNativeLibrary()|. Returns true if
// true if |ServiceMain()| was called (even if it returns an error), and false // |ServiceMain()| was called (even if it returns an error), and false
// otherwise. // otherwise.
bool RunNativeApplication(base::NativeLibrary app_library, bool RunServiceInNativeLibrary(base::NativeLibrary library,
mojom::ServiceRequest request); mojom::ServiceRequest request);
} // namespace shell } // namespace shell
#endif // SERVICES_SHELL_RUNNER_HOST_NATIVE_APPLICATION_SUPPORT_H_ #endif // SERVICES_SHELL_RUNNER_HOST_NATIVE_LIBRARY_RUNNER_H_
...@@ -75,7 +75,7 @@ void WaitForDebuggerIfNecessary() { ...@@ -75,7 +75,7 @@ void WaitForDebuggerIfNecessary() {
} }
void CallLibraryEarlyInitialization(base::NativeLibrary app_library) { void CallLibraryEarlyInitialization(base::NativeLibrary app_library) {
// Do whatever warming that the mojo application wants. // Do whatever warming that the service wants.
#if ICU_UTIL_DATA_IMPL == ICU_UTIL_DATA_FILE #if ICU_UTIL_DATA_IMPL == ICU_UTIL_DATA_FILE
typedef void (*LibraryEarlyInitFunction)(const uint8_t*); typedef void (*LibraryEarlyInitFunction)(const uint8_t*);
......
...@@ -22,8 +22,8 @@ ...@@ -22,8 +22,8 @@
#include "services/shell/public/interfaces/service_factory.mojom.h" #include "services/shell/public/interfaces/service_factory.mojom.h"
#include "services/shell/tests/connect/connect_test.mojom.h" #include "services/shell/tests/connect/connect_test.mojom.h"
// Tests that multiple applications can be packaged in a single Mojo application // Tests that multiple services can be packaged in a single service by
// implementing ServiceFactory; that these applications can be specified by // implementing ServiceFactory; that these services can be specified by
// the package's manifest and are thus registered with the PackageManager. // the package's manifest and are thus registered with the PackageManager.
namespace shell { namespace shell {
......
...@@ -19,8 +19,8 @@ ...@@ -19,8 +19,8 @@
#include "services/shell/public/interfaces/service_manager.mojom.h" #include "services/shell/public/interfaces/service_manager.mojom.h"
#include "services/shell/tests/connect/connect_test.mojom.h" #include "services/shell/tests/connect/connect_test.mojom.h"
// Tests that multiple applications can be packaged in a single Mojo application // Tests that multiple services can be packaged in a single service by
// implementing ServiceFactory; that these applications can be specified by // implementing ServiceFactory; that these services can be specified by
// the package's manifest and are thus registered with the PackageManager. // the package's manifest and are thus registered with the PackageManager.
namespace shell { namespace shell {
......
...@@ -29,12 +29,8 @@ namespace { ...@@ -29,12 +29,8 @@ namespace {
base::LazyInstance<base::Lock>::Leaky g_singleton_lock = base::LazyInstance<base::Lock>::Leaky g_singleton_lock =
LAZY_INSTANCE_INITIALIZER; LAZY_INSTANCE_INITIALIZER;
// Whether we are the first TracingImpl to be created in this mojo // Whether we are the first TracingImpl to be created in this service. The first
// application. The first TracingImpl in a physical mojo application connects // TracingImpl in a physical service connects to the tracing service.
// to the mojo:tracing service.
//
// If this is a ContentHandler, it will outlive all its served Applications. If
// this is a raw mojo application, it is the only Application served.
bool g_tracing_singleton_created = false; bool g_tracing_singleton_created = false;
} }
......
...@@ -25,9 +25,9 @@ class GpuService; ...@@ -25,9 +25,9 @@ class GpuService;
namespace demo { namespace demo {
// A simple MUS Demo mojo app. This app connects to the mojo:ui, creates a new // A simple MUS Demo service. This service connects to the mojo:ui, creates a
// window and draws a spinning square in the center of the window. Provides a // new window and draws a spinning square in the center of the window. Provides
// simple way to demonstrate that the graphic stack works as intended. // a simple way to demonstrate that the graphic stack works as intended.
class MusDemo : public shell::Service, class MusDemo : public shell::Service,
public WindowTreeClientDelegate, public WindowTreeClientDelegate,
public WindowManagerDelegate { public WindowManagerDelegate {
......
...@@ -9,7 +9,7 @@ import "cc/ipc/returned_resource.mojom"; ...@@ -9,7 +9,7 @@ import "cc/ipc/returned_resource.mojom";
// A Surface is an interface for receiving CompositorFrame structs. This is a // A Surface is an interface for receiving CompositorFrame structs. This is a
// separate interface to allow CompositorFrames to be delivered from // separate interface to allow CompositorFrames to be delivered from
// supplementary (not main) threads of a mojo app. // supplementary (not main) threads of a service.
interface Surface { interface Surface {
// After the submitted frame is drawn for the first time, the receiver will // After the submitted frame is drawn for the first time, the receiver will
// respond to the SubmitFrame message. Clients should use this acknowledgement // respond to the SubmitFrame message. Clients should use this acknowledgement
......
...@@ -160,7 +160,7 @@ ViewsMusTestSuite::~ViewsMusTestSuite() {} ...@@ -160,7 +160,7 @@ ViewsMusTestSuite::~ViewsMusTestSuite() {}
void ViewsMusTestSuite::Initialize() { void ViewsMusTestSuite::Initialize() {
PlatformTestHelper::SetIsMus(); PlatformTestHelper::SetIsMus();
// Let other mojo apps know that we're running in tests. Do this with a // Let other services know that we're running in tests. Do this with a
// command line flag to avoid making blocking calls to other processes for // command line flag to avoid making blocking calls to other processes for
// setup for tests (e.g. to unlock the screen in the window manager). // setup for tests (e.g. to unlock the screen in the window manager).
EnsureCommandLineSwitch(ui::switches::kUseTestConfig); EnsureCommandLineSwitch(ui::switches::kUseTestConfig);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment