Skip to content

Commit

Permalink
Change Service contract to pass ServiceInfo instead of Identity
Browse files Browse the repository at this point in the history
R=rockot@chromium.org

Review-Url: https://codereview.chromium.org/2435153004
Cr-Commit-Position: refs/heads/master@{#427430}
  • Loading branch information
ben authored and Commit bot committed Oct 25, 2016
1 parent 064a1ca commit 5d37ee7
Show file tree
Hide file tree
Showing 81 changed files with 195 additions and 191 deletions.
6 changes: 3 additions & 3 deletions ash/autoclick/mus/autoclick_application.cc
Original file line number Diff line number Diff line change
Expand Up @@ -75,16 +75,16 @@ AutoclickApplication::AutoclickApplication()

AutoclickApplication::~AutoclickApplication() {}

void AutoclickApplication::OnStart(const service_manager::Identity& identity) {
void AutoclickApplication::OnStart(const service_manager::ServiceInfo& info) {
aura_init_.reset(new views::AuraInit(connector(), "views_mus_resources.pak"));
window_manager_connection_ =
views::WindowManagerConnection::Create(connector(), identity);
views::WindowManagerConnection::Create(connector(), info.identity);
autoclick_controller_common_.reset(new AutoclickControllerCommon(
base::TimeDelta::FromMilliseconds(kDefaultAutoclickDelayMs), this));
}

bool AutoclickApplication::OnConnect(
const service_manager::Identity& remote_identity,
const service_manager::ServiceInfo& remote_info,
service_manager::InterfaceRegistry* registry) {
registry->AddInterface<mash::mojom::Launchable>(this);
registry->AddInterface<mojom::AutoclickController>(this);
Expand Down
4 changes: 2 additions & 2 deletions ash/autoclick/mus/autoclick_application.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ class AutoclickApplication

private:
// service_manager::Service:
void OnStart(const service_manager::Identity& identity) override;
bool OnConnect(const service_manager::Identity& remote_identity,
void OnStart(const service_manager::ServiceInfo& info) override;
bool OnConnect(const service_manager::ServiceInfo& remote_info,
service_manager::InterfaceRegistry* registry) override;

// mojom::Launchable:
Expand Down
10 changes: 5 additions & 5 deletions ash/mus/window_manager_application.cc
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ void WindowManagerApplication::ShutdownComponents() {
}

void WindowManagerApplication::OnStart(
const service_manager::Identity& identity) {
const service_manager::ServiceInfo& info) {
aura_init_.reset(new views::AuraInit(connector(), "ash_mus_resources.pak",
"ash_mus_resources_200.pak"));
gpu_service_ = ui::GpuService::Create(connector());
Expand All @@ -142,7 +142,7 @@ void WindowManagerApplication::OnStart(

MaterialDesignController::Initialize();

tracing_.Initialize(connector(), identity.name());
tracing_.Initialize(connector(), info.identity.name());

std::unique_ptr<ui::WindowTreeClient> window_tree_client =
base::MakeUnique<ui::WindowTreeClient>(window_manager_.get(),
Expand All @@ -157,15 +157,15 @@ void WindowManagerApplication::OnStart(
}

bool WindowManagerApplication::OnConnect(
const service_manager::Identity& remote_identity,
const service_manager::ServiceInfo& remote_info,
service_manager::InterfaceRegistry* registry) {
// Register services used in both classic ash and mash.
mojo_interface_factory::RegisterInterfaces(
registry, base::ThreadTaskRunnerHandle::Get());

registry->AddInterface<ui::mojom::AcceleratorRegistrar>(this);
if (remote_identity.name() == "service:mash_session") {
connector()->ConnectToInterface(remote_identity, &session_);
if (remote_info.identity.name() == "service:mash_session") {
connector()->ConnectToInterface(remote_info.identity, &session_);
session_->AddScreenlockStateListener(
screenlock_state_listener_binding_.CreateInterfacePtrAndBind());
}
Expand Down
4 changes: 2 additions & 2 deletions ash/mus/window_manager_application.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ class WindowManagerApplication
void ShutdownComponents();

// service_manager::Service:
void OnStart(const service_manager::Identity& identity) override;
bool OnConnect(const service_manager::Identity& remote_identity,
void OnStart(const service_manager::ServiceInfo& info) override;
bool OnConnect(const service_manager::ServiceInfo& remote_info,
service_manager::InterfaceRegistry* registry) override;

// service_manager::InterfaceFactory<ui::mojom::AcceleratorRegistrar>:
Expand Down
6 changes: 3 additions & 3 deletions ash/touch_hud/mus/touch_hud_application.cc
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,14 @@ class TouchHudUI : public views::WidgetDelegateView,
TouchHudApplication::TouchHudApplication() : binding_(this) {}
TouchHudApplication::~TouchHudApplication() {}

void TouchHudApplication::OnStart(const service_manager::Identity& identity) {
void TouchHudApplication::OnStart(const service_manager::ServiceInfo& info) {
aura_init_.reset(new views::AuraInit(connector(), "views_mus_resources.pak"));
window_manager_connection_ =
views::WindowManagerConnection::Create(connector(), identity);
views::WindowManagerConnection::Create(connector(), info.identity);
}

bool TouchHudApplication::OnConnect(
const service_manager::Identity& remote_identity,
const service_manager::ServiceInfo& remote_info,
service_manager::InterfaceRegistry* registry) {
registry->AddInterface<mash::mojom::Launchable>(this);
return true;
Expand Down
4 changes: 2 additions & 2 deletions ash/touch_hud/mus/touch_hud_application.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ class TouchHudApplication

private:
// service_manager::Service:
void OnStart(const service_manager::Identity& identity) override;
bool OnConnect(const service_manager::Identity& remote_identity,
void OnStart(const service_manager::ServiceInfo& info) override;
bool OnConnect(const service_manager::ServiceInfo& remote_info,
service_manager::InterfaceRegistry* registry) override;

// mojom::Launchable:
Expand Down
6 changes: 3 additions & 3 deletions components/filesystem/file_system_app.cc
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ FileSystemApp::FileSystemApp() : lock_table_(new LockTable) {}

FileSystemApp::~FileSystemApp() {}

void FileSystemApp::OnStart(const service_manager::Identity& identity) {
tracing_.Initialize(connector(), identity.name());
void FileSystemApp::OnStart(const service_manager::ServiceInfo& info) {
tracing_.Initialize(connector(), info.identity.name());
}

bool FileSystemApp::OnConnect(const service_manager::Identity& remote_identity,
bool FileSystemApp::OnConnect(const service_manager::ServiceInfo& remote_info,
service_manager::InterfaceRegistry* registry) {
registry->AddInterface<mojom::FileSystem>(this);
return true;
Expand Down
4 changes: 2 additions & 2 deletions components/filesystem/file_system_app.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ class FileSystemApp
static base::FilePath GetUserDataDir();

// |service_manager::Service| override:
void OnStart(const service_manager::Identity& identity) override;
bool OnConnect(const service_manager::Identity& remote_identity,
void OnStart(const service_manager::ServiceInfo& info) override;
bool OnConnect(const service_manager::ServiceInfo& remote_info,
service_manager::InterfaceRegistry* registry) override;

// |InterfaceFactory<Files>| implementation:
Expand Down
6 changes: 3 additions & 3 deletions components/font_service/font_service_app.cc
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ FontServiceApp::FontServiceApp() {}

FontServiceApp::~FontServiceApp() {}

void FontServiceApp::OnStart(const service_manager::Identity& identity) {
tracing_.Initialize(connector(), identity.name());
void FontServiceApp::OnStart(const service_manager::ServiceInfo& info) {
tracing_.Initialize(connector(), info.identity.name());
}

bool FontServiceApp::OnConnect(const service_manager::Identity& remote_identity,
bool FontServiceApp::OnConnect(const service_manager::ServiceInfo& remote_info,
service_manager::InterfaceRegistry* registry) {
registry->AddInterface(this);
return true;
Expand Down
4 changes: 2 additions & 2 deletions components/font_service/font_service_app.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ class FontServiceApp

private:
// service_manager::Service:
void OnStart(const service_manager::Identity& identity) override;
bool OnConnect(const service_manager::Identity& remote_identity,
void OnStart(const service_manager::ServiceInfo& info) override;
bool OnConnect(const service_manager::ServiceInfo& remote_info,
service_manager::InterfaceRegistry* registry) override;

// service_manager::InterfaceFactory<mojom::FontService>:
Expand Down
6 changes: 3 additions & 3 deletions components/leveldb/leveldb_app.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ LevelDBApp::LevelDBApp() {}

LevelDBApp::~LevelDBApp() {}

void LevelDBApp::OnStart(const service_manager::Identity& identity) {
tracing_.Initialize(connector(), identity.name());
void LevelDBApp::OnStart(const service_manager::ServiceInfo& info) {
tracing_.Initialize(connector(), info.identity.name());
}

bool LevelDBApp::OnConnect(const service_manager::Identity& remote_identity,
bool LevelDBApp::OnConnect(const service_manager::ServiceInfo& remote_info,
service_manager::InterfaceRegistry* registry) {
registry->AddInterface<mojom::LevelDBService>(this);
return true;
Expand Down
4 changes: 2 additions & 2 deletions components/leveldb/leveldb_app.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ class LevelDBApp

private:
// |Service| override:
void OnStart(const service_manager::Identity& identity) override;
bool OnConnect(const service_manager::Identity& remote_identity,
void OnStart(const service_manager::ServiceInfo& info) override;
bool OnConnect(const service_manager::ServiceInfo& remote_info,
service_manager::InterfaceRegistry* registry) override;

// |InterfaceFactory<mojom::LevelDBService>| implementation:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,19 +218,19 @@ class ServiceManagerConnectionImpl::IOThreadContext
/////////////////////////////////////////////////////////////////////////////
// service_manager::Service implementation

void OnStart(const service_manager::Identity& identity) override {
void OnStart(const service_manager::ServiceInfo& info) override {
DCHECK(io_thread_checker_.CalledOnValidThread());
DCHECK(!initialize_handler_.is_null());
id_ = identity;
id_ = info.identity;

InitializeCallback handler = base::ResetAndReturn(&initialize_handler_);
callback_task_runner_->PostTask(FROM_HERE, base::Bind(handler, identity));
callback_task_runner_->PostTask(FROM_HERE, base::Bind(handler, id_));
}

bool OnConnect(const service_manager::Identity& remote_identity,
bool OnConnect(const service_manager::ServiceInfo& remote_info,
service_manager::InterfaceRegistry* registry) override {
DCHECK(io_thread_checker_.CalledOnValidThread());
std::string remote_service = remote_identity.name();
std::string remote_service = remote_info.identity.name();
if (remote_service == "service:service_manager") {
// Only expose the ServiceFactory interface to the Service Manager.
registry->AddInterface<service_manager::mojom::ServiceFactory>(this);
Expand All @@ -241,12 +241,12 @@ class ServiceManagerConnectionImpl::IOThreadContext
{
base::AutoLock lock(lock_);
for (auto& entry : connection_filters_) {
accept |= entry.second->OnConnect(remote_identity, registry,
accept |= entry.second->OnConnect(remote_info.identity, registry,
service_context_->connector());
}
}

if (remote_identity.name() == "service:content_browser" &&
if (remote_service == "service:content_browser" &&
!has_browser_connection_) {
has_browser_connection_ = true;
registry->set_default_binder(default_browser_binder_);
Expand Down
4 changes: 2 additions & 2 deletions content/public/test/test_service.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ TestService::TestService() : service_binding_(this) {
TestService::~TestService() {
}

bool TestService::OnConnect(const service_manager::Identity& remote_identity,
bool TestService::OnConnect(const service_manager::ServiceInfo& remote_info,
service_manager::InterfaceRegistry* registry) {
requestor_name_ = remote_identity.name();
requestor_name_ = remote_info.identity.name();
registry->AddInterface<mojom::TestService>(this);
return true;
}
Expand Down
2 changes: 1 addition & 1 deletion content/public/test/test_service.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class TestService

private:
// service_manager::Service:
bool OnConnect(const service_manager::Identity& remote_identity,
bool OnConnect(const service_manager::ServiceInfo& remote_info,
service_manager::InterfaceRegistry* registry) override;

// service_manager::InterfaceFactory<mojom::TestService>:
Expand Down
4 changes: 2 additions & 2 deletions mash/app_driver/app_driver.cc
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,11 @@ void AppDriver::OnAvailableCatalogEntries(
}
}

void AppDriver::OnStart(const service_manager::Identity& identity) {
void AppDriver::OnStart(const service_manager::ServiceInfo& info) {
AddAccelerators();
}

bool AppDriver::OnConnect(const service_manager::Identity& remote_identity,
bool AppDriver::OnConnect(const service_manager::ServiceInfo& remote_info,
service_manager::InterfaceRegistry* registry) {
return true;
}
Expand Down
4 changes: 2 additions & 2 deletions mash/app_driver/app_driver.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ class AppDriver : public service_manager::Service,
void OnAvailableCatalogEntries(std::vector<catalog::mojom::EntryPtr> entries);

// service_manager::Service:
void OnStart(const service_manager::Identity& identity) override;
bool OnConnect(const service_manager::Identity& remote_identity,
void OnStart(const service_manager::ServiceInfo& info) override;
bool OnConnect(const service_manager::ServiceInfo& remote_info,
service_manager::InterfaceRegistry* registry) override;
bool OnStop() override;

Expand Down
8 changes: 4 additions & 4 deletions mash/browser/browser.cc
Original file line number Diff line number Diff line change
Expand Up @@ -867,16 +867,16 @@ std::unique_ptr<navigation::View> Browser::CreateView() {
return base::MakeUnique<navigation::View>(std::move(factory));
}

void Browser::OnStart(const service_manager::Identity& identity) {
tracing_.Initialize(connector(), identity.name());
void Browser::OnStart(const service_manager::ServiceInfo& info) {
tracing_.Initialize(connector(), info.identity.name());

aura_init_.reset(
new views::AuraInit(connector(), "views_mus_resources.pak"));
window_manager_connection_ =
views::WindowManagerConnection::Create(connector(), identity);
views::WindowManagerConnection::Create(connector(), info.identity);
}

bool Browser::OnConnect(const service_manager::Identity& remote_identity,
bool Browser::OnConnect(const service_manager::ServiceInfo& remote_info,
service_manager::InterfaceRegistry* registry) {
registry->AddInterface<mojom::Launchable>(this);
return true;
Expand Down
4 changes: 2 additions & 2 deletions mash/browser/browser.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ class Browser : public service_manager::Service,

private:
// service_manager::Service:
void OnStart(const service_manager::Identity& identity) override;
bool OnConnect(const service_manager::Identity& remote_identity,
void OnStart(const service_manager::ServiceInfo& info) override;
bool OnConnect(const service_manager::ServiceInfo& remote_info,
service_manager::InterfaceRegistry* registry) override;

// mojom::Launchable:
Expand Down
8 changes: 4 additions & 4 deletions mash/catalog_viewer/catalog_viewer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -165,16 +165,16 @@ void CatalogViewer::RemoveWindow(views::Widget* window) {
base::MessageLoop::current()->QuitWhenIdle();
}

void CatalogViewer::OnStart(const service_manager::Identity& identity) {
tracing_.Initialize(connector(), identity.name());
void CatalogViewer::OnStart(const service_manager::ServiceInfo& info) {
tracing_.Initialize(connector(), info.identity.name());

aura_init_.reset(
new views::AuraInit(connector(), "views_mus_resources.pak"));
window_manager_connection_ =
views::WindowManagerConnection::Create(connector(), identity);
views::WindowManagerConnection::Create(connector(), info.identity);
}

bool CatalogViewer::OnConnect(const service_manager::Identity& remote_identity,
bool CatalogViewer::OnConnect(const service_manager::ServiceInfo& remote_info,
service_manager::InterfaceRegistry* registry) {
registry->AddInterface<mojom::Launchable>(this);
return true;
Expand Down
4 changes: 2 additions & 2 deletions mash/catalog_viewer/catalog_viewer.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ class CatalogViewer

private:
// service_manager::Service:
void OnStart(const service_manager::Identity& identity) override;
bool OnConnect(const service_manager::Identity& remote_identity,
void OnStart(const service_manager::ServiceInfo& info) override;
bool OnConnect(const service_manager::ServiceInfo& remote_info,
service_manager::InterfaceRegistry* registry) override;

// mojom::Launchable:
Expand Down
8 changes: 4 additions & 4 deletions mash/example/views_examples/views_examples.cc
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ class ViewsExamples

private:
// service_manager::Service:
void OnStart(const service_manager::Identity& identity) override {
tracing_.Initialize(connector(), identity.name());
void OnStart(const service_manager::ServiceInfo& info) override {
tracing_.Initialize(connector(), info.identity.name());
aura_init_.reset(
new views::AuraInit(connector(), "views_mus_resources.pak"));
window_manager_connection_ =
views::WindowManagerConnection::Create(connector(), identity);
views::WindowManagerConnection::Create(connector(), info.identity);
}
bool OnConnect(const service_manager::Identity& remote_identity,
bool OnConnect(const service_manager::ServiceInfo& remote_info,
service_manager::InterfaceRegistry* registry) override {
registry->AddInterface<mash::mojom::Launchable>(this);
return true;
Expand Down
6 changes: 3 additions & 3 deletions mash/example/window_type_launcher/window_type_launcher.cc
Original file line number Diff line number Diff line change
Expand Up @@ -469,15 +469,15 @@ void WindowTypeLauncher::RemoveWindow(views::Widget* window) {
base::MessageLoop::current()->QuitWhenIdle();
}

void WindowTypeLauncher::OnStart(const service_manager::Identity& identity) {
void WindowTypeLauncher::OnStart(const service_manager::ServiceInfo& info) {
aura_init_.reset(
new views::AuraInit(connector(), "views_mus_resources.pak"));
window_manager_connection_ =
views::WindowManagerConnection::Create(connector(), identity);
views::WindowManagerConnection::Create(connector(), info.identity);
}

bool WindowTypeLauncher::OnConnect(
const service_manager::Identity& remote_identity,
const service_manager::ServiceInfo& remote_info,
service_manager::InterfaceRegistry* registry) {
registry->AddInterface<mash::mojom::Launchable>(this);
return true;
Expand Down
4 changes: 2 additions & 2 deletions mash/example/window_type_launcher/window_type_launcher.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ class WindowTypeLauncher

private:
// service_manager::Service:
void OnStart(const service_manager::Identity& identity) override;
bool OnConnect(const service_manager::Identity& remote_identity,
void OnStart(const service_manager::ServiceInfo& info) override;
bool OnConnect(const service_manager::ServiceInfo& remote_info,
service_manager::InterfaceRegistry* registry) override;

// mash::mojom::Launchable:
Expand Down
Loading

0 comments on commit 5d37ee7

Please sign in to comment.