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

Unified Diff: mojo/public/python/mojo_application/service_provider_impl.py

Issue 1508613003: Require an explicit ServiceName annotation for interfaces in Python. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years 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/python/mojo_application/service_provider_impl.py
diff --git a/mojo/public/python/mojo_application/service_provider_impl.py b/mojo/public/python/mojo_application/service_provider_impl.py
index 0166c766d37e5f99655e5a3cf1b07d8d331ea730..b804c487fc4501cb3dbb319e8cececd8eb7b457f 100644
--- a/mojo/public/python/mojo_application/service_provider_impl.py
+++ b/mojo/public/python/mojo_application/service_provider_impl.py
@@ -13,8 +13,13 @@ class ServiceProviderImpl(service_provider_mojom.ServiceProvider):
self._provider = provider
self._name_to_service_connector = {}
- def AddService(self, service_class):
- self._name_to_service_connector[service_class.manager.name] = service_class
+ def AddService(self, service_class, service_name=None):
+ if service_name is None:
+ service_name = service_class.service_name
+ if service_name is None:
+ logging.error("No ServiceName specified for %s." % service_class.__name__)
+ return
+ self._name_to_service_connector[service_name] = service_class
def ConnectToService(self, interface_name, pipe):
if interface_name in self._name_to_service_connector:

Powered by Google App Engine
This is Rietveld 408576698