Bug 1257037 part 7. Make the binding Configuration a non-workers DescriptorProvider. r=khuey
authorBoris Zbarsky <bzbarsky@mit.edu>
Fri, 08 Jul 2016 00:37:54 -0400
changeset 304146 2de33eb0bb321a55cd66168d2440281b5420d466
parent 304145 64424f160c3a9c5c8daa38bdc9414146c44f03c4
child 304147 4c5ea0b7a3d109be6e8f20e623c3530205432f63
push id79254
push userbzbarsky@mozilla.com
push dateFri, 08 Jul 2016 04:38:07 +0000
treeherdermozilla-inbound@a92d0eec5c91 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskhuey
bugs1257037
milestone50.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1257037 part 7. Make the binding Configuration a non-workers DescriptorProvider. r=khuey
dom/bindings/Configuration.py
--- a/dom/bindings/Configuration.py
+++ b/dom/bindings/Configuration.py
@@ -4,22 +4,40 @@
 
 from WebIDL import IDLImplementsStatement
 import os
 from collections import defaultdict
 
 autogenerated_comment = "/* THIS FILE IS AUTOGENERATED - DO NOT EDIT */\n"
 
 
-class Configuration:
+class DescriptorProvider:
+    """
+    A way of getting descriptors for interface names
+    """
+    def __init__(self, config, workers):
+        self.config = config
+        self.workers = workers
+
+    def getDescriptor(self, interfaceName):
+        """
+        Gets the appropriate descriptor for the given interface name given the
+        context of the current descriptor. This selects the appropriate
+        implementation for cases like workers.
+        """
+        return self.config.getDescriptor(interfaceName, self.workers)
+
+
+class Configuration(DescriptorProvider):
     """
     Represents global configuration state based on IDL parse data and
     the configuration file.
     """
     def __init__(self, filename, parseData, generatedEvents=[]):
+        DescriptorProvider.__init__(self, self, False)
 
         # Read the configuration file.
         glbl = {}
         execfile(filename, glbl)
         config = glbl['DOMInterfaces']
 
         # Build descriptors for all the interfaces we have in the parse data.
         # This allows callers to specify a subset of interfaces by filtering
@@ -299,33 +317,16 @@ class Configuration:
         return DescriptorProvider(self, workers)
 
 
 class NoSuchDescriptorError(TypeError):
     def __init__(self, str):
         TypeError.__init__(self, str)
 
 
-class DescriptorProvider:
-    """
-    A way of getting descriptors for interface names
-    """
-    def __init__(self, config, workers):
-        self.config = config
-        self.workers = workers
-
-    def getDescriptor(self, interfaceName):
-        """
-        Gets the appropriate descriptor for the given interface name given the
-        context of the current descriptor. This selects the appropriate
-        implementation for cases like workers.
-        """
-        return self.config.getDescriptor(interfaceName, self.workers)
-
-
 def methodReturnsJSObject(method):
     assert method.isMethod()
     if method.returnsPromise():
         return True
 
     for signature in method.signatures():
         returnType = signature[0]
         if returnType.isObject() or returnType.isSpiderMonkeyInterface():