Index: mojo/public/cpp/application/lib/application.cc |
diff --git a/mojo/public/cpp/application/lib/application.cc b/mojo/public/cpp/application/lib/application.cc |
index fb2a897a906f2f1335a95d2db6c3594c56d48f7f..bda12a8a6dc3d6196adeb7aaf78e6a4e3992ee3b 100644 |
--- a/mojo/public/cpp/application/lib/application.cc |
+++ b/mojo/public/cpp/application/lib/application.cc |
@@ -6,62 +6,29 @@ |
namespace mojo { |
-Application::Application() {} |
+Application::Application() : service_registry_(this) {} |
Application::Application(ScopedMessagePipeHandle service_provider_handle) |
- : internal::ServiceConnectorBase::Owner(service_provider_handle.Pass()) { |
-} |
+ : service_registry_(this, service_provider_handle.Pass()) {} |
Application::Application(MojoHandle service_provider_handle) |
- : internal::ServiceConnectorBase::Owner( |
- mojo::MakeScopedHandle( |
- MessagePipeHandle(service_provider_handle)).Pass()) {} |
- |
-Application::~Application() { |
- 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 Application::Initialize() {} |
+ : service_registry_( |
+ this, |
darin (slow to review)
2014/06/12 16:11:51
nit: 4 spaces indent from "service_registry_"?
DaveMoore
2014/06/12 16:28:14
Done.
|
+ mojo::MakeScopedHandle( |
+ MessagePipeHandle(service_provider_handle)).Pass()) {} |
-void Application::AddServiceConnector( |
- internal::ServiceConnectorBase* service_connector) { |
- name_to_service_connector_[service_connector->name()] = service_connector; |
- set_service_connector_owner(service_connector, this); |
-} |
+Application::~Application() {} |
-void Application::RemoveServiceConnector( |
- internal::ServiceConnectorBase* service_connector) { |
- NameToServiceConnectorMap::iterator it = |
- name_to_service_connector_.find(service_connector->name()); |
- assert(it != name_to_service_connector_.end()); |
- delete it->second; |
- name_to_service_connector_.erase(it); |
- if (name_to_service_connector_.empty()) |
- service_provider_.reset(); |
+bool Application::IsConnectionValid(const mojo::String& service_name, |
+ const mojo::String& requestor_url) { |
+ return true; |
} |
void Application::BindServiceProvider( |
- ScopedMessagePipeHandle service_provider_handle) { |
- service_provider_.Bind(service_provider_handle.Pass()); |
- service_provider_.set_client(this); |
+ ScopedMessagePipeHandle service_provider_handle) { |
+ service_registry_.BindServiceProvider(service_provider_handle.Pass()); |
} |
-void Application::ConnectToService(const mojo::String& service_url, |
- const mojo::String& service_name, |
- ScopedMessagePipeHandle client_handle, |
- const mojo::String& requestor_url) { |
- internal::ServiceConnectorBase* service_connector = |
- name_to_service_connector_[service_name]; |
- assert(service_connector); |
- // requestor_url is ignored because the service_connector stores the url |
- // of the requestor safely. |
- return service_connector->ConnectToService( |
- service_url, service_name, client_handle.Pass()); |
-} |
+void Application::Initialize() {} |
} // namespace mojo |