Skip to content

Commit

Permalink
Purge references of "Mojo Application" from comments & var names.
Browse files Browse the repository at this point in the history
Replace with Service.

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

Review-Url: https://codereview.chromium.org/2397353002
Cr-Commit-Position: refs/heads/master@{#423865}
  • Loading branch information
ben authored and Commit bot committed Oct 7, 2016
1 parent 1bb1fb7 commit eef69a4
Show file tree
Hide file tree
Showing 30 changed files with 139 additions and 143 deletions.
4 changes: 2 additions & 2 deletions ash/mus/app_list_presenter_mus.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class Connector;
namespace ash {

// 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 {
public:
explicit AppListPresenterMus(::shell::Connector* connector);
Expand All @@ -30,7 +30,7 @@ class AppListPresenterMus : public app_list::AppListPresenter {
bool GetTargetVisibility() const override;

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.
void ConnectIfNeeded();

Expand Down
8 changes: 4 additions & 4 deletions base/i18n/icu_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ BASE_I18N_EXPORT const uint8_t* GetRawIcuMemory();
//
// 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
// non-component builds. (The big example is mojo: the shell will have a copy
// of base linked in, and the majority of mojo applications will have base
// linked in but in non-component builds, these will be separate copies of
// base.)
// non-component builds. (The big example is standalone service libraries: the
// Service Manager will have a copy of base linked in, and the majority of
// service libraries will have base linked in but in non-component builds,
// these will be separate copies of base.)
BASE_I18N_EXPORT bool InitializeICUFromRawMemory(const uint8_t* raw_memory);
#endif // ICU_UTIL_DATA_IMPL == ICU_UTIL_DATA_FILE
#endif // !defined(OS_NACL)
Expand Down
6 changes: 3 additions & 3 deletions components/leveldb/env_mojo.cc
Original file line number Diff line number Diff line change
Expand Up @@ -359,9 +359,9 @@ Status MojoEnv::UnlockFile(FileLock* lock) {

Status MojoEnv::GetTestDirectory(std::string* path) {
// 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
// probably won't use it since the mojo filesystem actually handles temporary
// filesystems just fine.
// leveldb. And when we go and port that test stuff to a shell::ServiceTest,
// we probably won't use it since the mojo filesystem actually handles
// temporary filesystems just fine.
NOTREACHED();
return Status::OK();
}
Expand Down
4 changes: 2 additions & 2 deletions content/browser/renderer_host/render_widget_host_view_mus.cc
Original file line number Diff line number Diff line change
Expand Up @@ -186,11 +186,11 @@ void RenderWidgetHostViewMus::SetIsLoading(bool is_loading) {

void RenderWidgetHostViewMus::TextInputStateChanged(
const TextInputState& params) {
// TODO(fsamuel): Implement an IME mojo app.
// TODO(fsamuel): Implement an IME service.
}

void RenderWidgetHostViewMus::ImeCancelComposition() {
// TODO(fsamuel): Implement an IME mojo app.
// TODO(fsamuel): Implement an IME service.
}

void RenderWidgetHostViewMus::ImeCompositionRangeChanged(
Expand Down
8 changes: 4 additions & 4 deletions mojo/edk/embedder/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
from src/mojo/edk/system).

Example uses: Mojo shell, to set up the Mojo environment for Mojo apps; Chromium
code, to set up the Mojo IPC system for use between processes. Note that most
code should use the Mojo Public API (under src/mojo/public) instead. The
Embedder API should only be used to initialize the environment, set up the
Example uses: Service Manager, to set up the Mojo environment for Services;
Chromium code, to set up the Mojo IPC system for use between processes. Note
that most code should use the Mojo Public API (under src/mojo/public) instead.
The Embedder API should only be used to initialize the environment, set up the
initial MessagePipe between two processes, etc.
2 changes: 1 addition & 1 deletion mojo/public/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Platform
--------

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.

Tools
Expand Down
2 changes: 1 addition & 1 deletion mojo/public/c/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ System
------

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.

Though the message protocol is stable, the implementation of the transport is
Expand Down
2 changes: 1 addition & 1 deletion mojo/public/cpp/bindings/lib/interface_endpoint_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class ResponderThunk : public MessageReceiverWithStatus {
task_runner_(std::move(runner)) {}
~ResponderThunk() override {
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.
// We raise an error to signal the calling application that an error
// condition occurred. Without this the calling application would have no
Expand Down
2 changes: 1 addition & 1 deletion mojo/public/cpp/bindings/lib/router.cc
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class ResponderThunk : public MessageReceiverWithStatus {
task_runner_(std::move(runner)) {}
~ResponderThunk() override {
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.
// We raise an error to signal the calling application that an error
// condition occurred. Without this the calling application would have no
Expand Down
2 changes: 1 addition & 1 deletion mojo/public/js/threading.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// Note: This file is for documentation purposes only. The code here is not
// 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
// intended to be used by Mojo JS application started by the JS
// content handler.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ class {{class_name}}_{{method.name}}_ProxyToResponder {
~{{class_name}}_{{method.name}}_ProxyToResponder() {
#if DCHECK_IS_ON()
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?
responder_->DCheckInvalid("The callback passed to "
"{{class_name}}::{{method.name}}() was never run.");
Expand Down
4 changes: 2 additions & 2 deletions services/shell/public/interfaces/capabilities.mojom
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

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.
// In a CapabilitySpec, an interface is represented by its fully qualified name,
Expand Down
2 changes: 1 addition & 1 deletion services/shell/public/interfaces/connector.mojom
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ struct ClientProcessConnection {
handle<message_pipe> pid_receiver_request;
};

// Encapsulates establishing connections with other Mojo applications.
// Encapsulates establishing connections with other Services.
interface Connector {
// Requests a connection with another application. The application originating
// the request is referred to as the "source" and the one receiving the
Expand Down
2 changes: 1 addition & 1 deletion services/shell/runner/common/switches.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
namespace switches {

// 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.
const char kChildProcess[] = "child-process";

Expand Down
8 changes: 4 additions & 4 deletions services/shell/runner/host/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ group("host") {
]
}

source_set("native_application_support") {
source_set("native_library_runner") {
sources = [
"native_application_support.cc",
"native_application_support.h",
"native_library_runner.cc",
"native_library_runner.h",
]

deps = [
Expand Down Expand Up @@ -86,7 +86,7 @@ source_set("lib") {

deps = [
":child_process_base",
":native_application_support",
":native_library_runner",
"//base:base_static",
"//base:i18n",
"//services/shell/public/cpp:sources",
Expand Down
22 changes: 11 additions & 11 deletions services/shell/runner/host/child_process.cc
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,17 @@
#include "mojo/public/cpp/system/core.h"
#include "services/shell/runner/common/switches.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"

namespace shell {

namespace {

void RunNativeLibrary(base::NativeLibrary app_library,
void RunNativeLibrary(base::NativeLibrary library,
mojom::ServiceRequest service_request) {
if (!RunNativeApplication(app_library, std::move(service_request))) {
LOG(ERROR) << "Failure to RunNativeApplication()";
if (!RunServiceInNativeLibrary(library, std::move(service_request))) {
LOG(ERROR) << "Failure to RunServiceInNativeLibrary()";
}
}

Expand All @@ -54,17 +54,17 @@ int ChildProcessMain() {
const base::CommandLine& command_line =
*base::CommandLine::ForCurrentProcess();

base::NativeLibrary app_library = 0;
base::NativeLibrary library = 0;
// Load the application library before we engage the sandbox.
base::FilePath app_library_path =
base::FilePath library_path =
command_line.GetSwitchValuePath(switches::kChildProcess);
if (!app_library_path.empty())
app_library = LoadNativeApplication(app_library_path);
if (!library_path.empty())
library = LoadNativeLibrary(library_path);
base::i18n::InitializeICU();
if (app_library)
CallLibraryEarlyInitialization(app_library);
if (library)
CallLibraryEarlyInitialization(library);

ChildProcessMainWithCallback(base::Bind(&RunNativeLibrary, app_library));
ChildProcessMainWithCallback(base::Bind(&RunNativeLibrary, library));

return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion services/shell/runner/host/child_process_base.cc
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ std::unique_ptr<LinuxSandbox> InitializeSandbox() {
#endif

// 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 {
public:
ScopedAppContext()
Expand Down
2 changes: 1 addition & 1 deletion services/shell/runner/host/child_process_host.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class ChildProcessHost {

// |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
// mojo application we wish to start.
// service we wish to start.
ChildProcessHost(base::TaskRunner* launch_process_runner,
NativeRunnerDelegate* delegate,
bool start_sandboxed,
Expand Down
42 changes: 21 additions & 21 deletions services/shell/runner/host/in_process_native_runner.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,17 @@
#include "base/threading/platform_thread.h"
#include "base/threading/thread_task_runner_handle.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/init.h"

namespace shell {

InProcessNativeRunner::InProcessNativeRunner() : app_library_(nullptr) {}
InProcessNativeRunner::InProcessNativeRunner() : library_(nullptr) {}

InProcessNativeRunner::~InProcessNativeRunner() {
// 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.
if (thread_) {
DCHECK(thread_->HasBeenStarted());
Expand All @@ -36,26 +36,26 @@ InProcessNativeRunner::~InProcessNativeRunner() {
}

mojom::ServicePtr InProcessNativeRunner::Start(
const base::FilePath& app_path,
const base::FilePath& library_path,
const Identity& target,
bool start_sandboxed,
const base::Callback<void(base::ProcessId)>& pid_available_callback,
const base::Closure& app_completed_callback) {
app_path_ = app_path;
const base::Closure& service_completed_callback) {
library_path_ = library_path;

DCHECK(!request_.is_pending());
mojom::ServicePtr client;
request_ = GetProxy(&client);

DCHECK(app_completed_callback_runner_.is_null());
app_completed_callback_runner_ = base::Bind(
DCHECK(service_completed_callback_runner_.is_null());
service_completed_callback_runner_ = base::Bind(
&base::TaskRunner::PostTask, base::ThreadTaskRunnerHandle::Get(),
FROM_HERE, app_completed_callback);
FROM_HERE, service_completed_callback);

DCHECK(!thread_);
std::string thread_name = "Service Thread";
#if defined(OS_WIN)
thread_name = base::WideToUTF8(app_path_.BaseName().value());
thread_name = base::WideToUTF8(library_path_.BaseName().value());
#endif
thread_.reset(new base::DelegateSimpleThread(this, thread_name));
thread_->Start();
Expand All @@ -65,27 +65,27 @@ mojom::ServicePtr InProcessNativeRunner::Start(
}

void InProcessNativeRunner::Run() {
DVLOG(2) << "Loading/running Mojo app in process from library: "
<< app_path_.value()
DVLOG(2) << "Loading/running Service in process from library: "
<< library_path_.value()
<< " thread id=" << base::PlatformThread::CurrentId();

// TODO(vtl): ScopedNativeLibrary doesn't have a .get() method!
base::NativeLibrary app_library = LoadNativeApplication(app_path_);
app_library_.Reset(app_library);
base::NativeLibrary library = LoadNativeLibrary(library_path_);
library_.Reset(library);
// This hangs on Windows in the component build, so skip it since it's
// unnecessary.
#if !(defined(COMPONENT_BUILD) && defined(OS_WIN))
CallLibraryEarlyInitialization(app_library);
CallLibraryEarlyInitialization(library);
#endif
RunNativeApplication(app_library, std::move(request_));
app_completed_callback_runner_.Run();
app_completed_callback_runner_.Reset();
RunServiceInNativeLibrary(library, std::move(request_));
service_completed_callback_runner_.Run();
service_completed_callback_runner_.Reset();
}

std::unique_ptr<NativeRunner> InProcessNativeRunnerFactory::Create(
const base::FilePath& app_path) {
// Non-Mojo apps are always run in a new process.
if (!app_path.MatchesExtension(FILE_PATH_LITERAL(".library"))) {
const base::FilePath& library_path) {
// Executables are always run in a new process.
if (!library_path.MatchesExtension(FILE_PATH_LITERAL(".library"))) {
return base::MakeUnique<OutOfProcessNativeRunner>(launch_process_runner_,
nullptr);
}
Expand Down
18 changes: 9 additions & 9 deletions services/shell/runner/host/in_process_native_runner.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,15 @@
#include "base/scoped_native_library.h"
#include "base/threading/simple_thread.h"
#include "services/shell/native_runner.h"
#include "services/shell/runner/host/native_application_support.h"

namespace base {
class TaskRunner;
}

namespace shell {

// An implementation of |NativeRunner| that loads/runs the given app (from the
// file system) on a separate thread (in the current process).
// An implementation of |NativeRunner| that loads/runs the given service (from
// the file system) on a separate thread (in the current process).
class InProcessNativeRunner : public NativeRunner,
public base::DelegateSimpleThread::Delegate {
public:
Expand All @@ -31,21 +30,21 @@ class InProcessNativeRunner : public NativeRunner,

// NativeRunner:
mojom::ServicePtr Start(
const base::FilePath& app_path,
const base::FilePath& library_path,
const Identity& target,
bool start_sandboxed,
const base::Callback<void(base::ProcessId)>& pid_available_callback,
const base::Closure& app_completed_callback) override;
const base::Closure& service_completed_callback) override;

private:
// |base::DelegateSimpleThread::Delegate| method:
void Run() override;

base::FilePath app_path_;
base::FilePath library_path_;
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_;

DISALLOW_COPY_AND_ASSIGN(InProcessNativeRunner);
Expand All @@ -57,7 +56,8 @@ class InProcessNativeRunnerFactory : public NativeRunnerFactory {
: launch_process_runner_(launch_process_runner) {}
~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:
base::TaskRunner* const launch_process_runner_;
Expand Down
Loading

0 comments on commit eef69a4

Please sign in to comment.