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

Unified Diff: mojo/public/cpp/application/lib/service_registry.cc

Issue 814543006: Move //mojo/{public, edk} underneath //third_party (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase 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 side-by-side diff with in-line comments
Download patch
Index: mojo/public/cpp/application/lib/service_registry.cc
diff --git a/mojo/public/cpp/application/lib/service_registry.cc b/mojo/public/cpp/application/lib/service_registry.cc
deleted file mode 100644
index d934a166ba3c020372bf8dcd243dc1b214bfd4e9..0000000000000000000000000000000000000000
--- a/mojo/public/cpp/application/lib/service_registry.cc
+++ /dev/null
@@ -1,91 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "mojo/public/cpp/application/lib/service_registry.h"
-
-#include "mojo/public/cpp/application/application_connection.h"
-#include "mojo/public/cpp/application/application_impl.h"
-#include "mojo/public/cpp/application/lib/service_connector.h"
-
-namespace mojo {
-namespace internal {
-
-ServiceRegistry::ServiceRegistry(
- ApplicationImpl* application_impl,
- const std::string& url,
- ServiceProviderPtr remote_services,
- InterfaceRequest<ServiceProvider> local_services)
- : application_impl_(application_impl),
- url_(url),
- local_binding_(this, local_services.Pass()),
- remote_service_provider_(remote_services.Pass()) {
-}
-
-ServiceRegistry::ServiceRegistry()
- : application_impl_(nullptr), local_binding_(this) {
-}
-
-ServiceRegistry::~ServiceRegistry() {
- for (NameToServiceConnectorMap::iterator i =
- name_to_service_connector_.begin();
- i != name_to_service_connector_.end();
- ++i) {
- delete i->second;
- }
- name_to_service_connector_.clear();
-}
-
-void ServiceRegistry::AddServiceConnector(
- ServiceConnectorBase* service_connector) {
- RemoveServiceConnectorInternal(service_connector);
- name_to_service_connector_[service_connector->name()] = service_connector;
- service_connector->set_application_connection(this);
-}
-
-void ServiceRegistry::RemoveServiceConnector(
- ServiceConnectorBase* service_connector) {
- RemoveServiceConnectorInternal(service_connector);
- if (name_to_service_connector_.empty())
- remote_service_provider_.reset();
-}
-
-bool ServiceRegistry::RemoveServiceConnectorInternal(
- ServiceConnectorBase* service_connector) {
- NameToServiceConnectorMap::iterator it =
- name_to_service_connector_.find(service_connector->name());
- if (it == name_to_service_connector_.end())
- return false;
- delete it->second;
- name_to_service_connector_.erase(it);
- return true;
-}
-
-const std::string& ServiceRegistry::GetRemoteApplicationURL() {
- return url_;
-}
-
-ServiceProvider* ServiceRegistry::GetServiceProvider() {
- return remote_service_provider_.get();
-}
-
-ApplicationConnection* ServiceRegistry::ConnectToApplication(
- const std::string& url) {
- return application_impl_->ConnectToApplication(url);
-}
-
-void ServiceRegistry::ConnectToService(const mojo::String& service_name,
- ScopedMessagePipeHandle client_handle) {
- if (name_to_service_connector_.find(service_name) ==
- name_to_service_connector_.end()) {
- client_handle.reset();
- return;
- }
- internal::ServiceConnectorBase* service_connector =
- name_to_service_connector_[service_name];
- return service_connector->ConnectToService(service_name,
- client_handle.Pass());
-}
-
-} // namespace internal
-} // namespace mojo
« no previous file with comments | « mojo/public/cpp/application/lib/service_registry.h ('k') | mojo/public/cpp/application/lib/weak_service_provider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698