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

Unified Diff: mojo/public/python/mojo_bindings/reflection.py

Issue 796373006: Content handler for python. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: 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/python/mojo_bindings/reflection.py
diff --git a/mojo/public/python/mojo_bindings/reflection.py b/mojo/public/python/mojo_bindings/reflection.py
index 5432691c3e783147eeb67d699b6a54ff413d7320..6b0d4dcc888e5afde2be3ca80c9abac678cd2f07 100644
--- a/mojo/public/python/mojo_bindings/reflection.py
+++ b/mojo/public/python/mojo_bindings/reflection.py
@@ -182,8 +182,10 @@ class MojoInterfaceType(type):
for method in methods:
dictionary[method.name] = _NotImplemented
client_class_getter = descriptor.get('client', None)
+ normalized_name = descriptor['normalized_name']
qsr 2015/01/14 18:08:41 I would use fully_qualified_name instead of normal
etiennej 2015/01/15 00:03:07 Done.
- interface_manager = InterfaceManager(name, methods, client_class_getter)
+ interface_manager = InterfaceManager(normalized_name, methods,
+ client_class_getter)
dictionary.update({
'client': None,
'manager': None,
@@ -282,7 +284,7 @@ class InterfaceManager(object):
# Give an instance manager to the implementation to allow it to close
# the connection.
- impl.manager = InstanceManager(router)
+ impl.manager = InstanceManager(router, error_handler)
router.Start()
@@ -304,7 +306,7 @@ class InterfaceManager(object):
proxy = self._proxy_class(router, error_handler)
# Give an instance manager to the proxy to allow to close the connection.
- proxy.manager = InstanceManager(router)
+ proxy.manager = InstanceManager(router, error_handler)
return proxy
def _Stub(self, impl):
@@ -327,14 +329,18 @@ class InstanceManager(object):
Manager for the implementation of an interface or a proxy. The manager allows
to control the connection over the pipe.
"""
- def __init__(self, router):
- self.router = router
+ def __init__(self, router, error_handler):
+ self._router = router
+ self._error_handler = error_handler
def Close(self):
- self.router.Close()
+ self._router.Close()
def PassMessagePipe(self):
- return self.router.PassMessagePipe()
+ return self._router.PassMessagePipe()
+
+ def AddOnErrorCallback(self, callback):
+ self._error_handler.AddCallback(lambda _: callback())
class _MethodDescriptor(object):

Powered by Google App Engine
This is Rietveld 408576698