Bug 1406829 (part 3) - Use `[ptr] native` for nsAtom pointers in .idl files. r=froydnj.
authorNicholas Nethercote <nnethercote@mozilla.com>
Wed, 11 Oct 2017 08:34:38 +1100
changeset 385837 723d04bc0b4cc37ef8686dacaeabb8f7c75b1dfc
parent 385836 23cac97e75ff9768cfe545cdc44ee8506de53b70
child 385838 51ff2d13e50c1e8f7731e4c7243064bb96d2e4d0
push id32669
push userarchaeopteryx@coole-files.de
push dateThu, 12 Oct 2017 21:58:56 +0000
treeherdermozilla-central@25aad10380b1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfroydnj
bugs1406829
milestone58.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 1406829 (part 3) - Use `[ptr] native` for nsAtom pointers in .idl files. r=froydnj. Even though it's more verbose because of the `%{C++` section, it's the proper way to do this kind of thing, rather than faking it with `interface`.
dom/xul/templates/nsIXULTemplateBuilder.idl
dom/xul/templates/nsIXULTemplateQueryProcessor.idl
dom/xul/templates/nsIXULTemplateResult.idl
rdf/base/nsIRDFXMLSerializer.idl
rdf/base/nsIRDFXMLSink.idl
--- a/dom/xul/templates/nsIXULTemplateBuilder.idl
+++ b/dom/xul/templates/nsIXULTemplateBuilder.idl
@@ -1,25 +1,29 @@
 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "domstubs.idl"
 
-interface nsAtom;  // not a real interface; used in [noscript] methods only
 interface nsIContent;
 interface nsIXULBuilderListener;
 interface nsIXULTemplateResult;
 interface nsIXULTemplateRuleFilter;
 interface nsIXULTemplateQueryProcessor;
 interface nsIRDFResource;
 interface nsIRDFCompositeDataSource;
 interface nsIDOMDataTransfer;
 
+%{C++
+class nsAtom;
+%}
+[ptr] native nsAtomPtr(nsAtom);
+
 /**
  * A template builder, given an input source of data, a template, and a
  * reference point, generates a list of results from the input, and copies
  * part of the template for each result. Templates may generate content
  * recursively, using the same template, but with the previous iteration's
  * results as the reference point. As an example, for an XML datasource the
  * initial reference point would be a specific node in the DOM tree and a
  * template might generate a list of all child nodes. For the next iteration,
@@ -263,17 +267,17 @@ interface nsIXULTemplateBuilder : nsISup
      * intended to be called only by the RDF query processor. If aTag is set,
      * the content must have a tag name that matches aTag. aTag may be ignored
      * for builders that don't generate real DOM content.
      *
      * @param aNode node to check
      * @param aTag tag that must match
      */
     [noscript] boolean hasGeneratedContent(in nsIRDFResource aNode,
-                                           in nsAtom aTag);
+                                           in nsAtomPtr aTag);
 
     /**
      * Adds a rule filter for a given rule, which may be used for specialized
      * rule filtering. Any existing filter on the rule is removed. The default
      * conditions specified inside the <rule> tag are applied before the
      * rule filter is applied, meaning that the filter may be used to further
      * filter out results but not reaccept results that have already been
      * rejected.
--- a/dom/xul/templates/nsIXULTemplateQueryProcessor.idl
+++ b/dom/xul/templates/nsIXULTemplateQueryProcessor.idl
@@ -1,22 +1,26 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "domstubs.idl"
 
-interface nsAtom;  // not a real interface; used in [noscript] methods only
 interface nsIArray;
 interface nsISimpleEnumerator;
 interface nsIXULTemplateResult;
 interface nsIXULTemplateRuleFilter;
 interface nsIXULTemplateBuilder;
 
+%{C++
+class nsAtom;
+%}
+[ptr] native nsAtomPtr(nsAtom);
+
 /**
  * A query processor takes a template query and generates results for it given
  * a datasource and a reference point. There is a one-to-one relationship
  * between a template builder and a query processor. The template builder
  * creates the query processor, and there is no other means to retrieve it.
  *
  * A template query is the contents inside a <query> element within the
  * template. The actual syntax is opaque to the template builder and defined
@@ -159,18 +163,18 @@ interface nsIXULTemplateQueryProcessor :
    * @param aQuery <query> node to compile
    * @param aRefVariable the reference variable
    * @param aMemberVariable the member variable
    *
    * @returns a compiled query object
    */
   [noscript] nsISupports compileQuery(in nsIXULTemplateBuilder aBuilder,
                                       in nsIDOMNode aQuery,
-                                      in nsAtom aRefVariable,
-                                      in nsAtom aMemberVariable);
+                                      in nsAtomPtr aRefVariable,
+                                      in nsAtomPtr aMemberVariable);
 
   /**
    * Generate the results of a query and return them in an enumerator. The
    * enumerator must contain nsIXULTemplateResult objects. If there are no
    * results, an empty enumerator must be returned.
    *
    * The datasource will be the same as the one passed to the earlier
    * initializeForBuilding method. The context reference (aRef) is a reference
@@ -218,18 +222,18 @@ interface nsIXULTemplateQueryProcessor :
    * the syntax '+2' to mean add two to the reference.
    *
    * @param aRuleNode rule to add the binding to
    * @param aVar variable that will be bound
    * @param aRef variable that holds reference value
    * @param aExpr expression used to compute the value to assign
    */
   [noscript] void addBinding(in nsIDOMNode aRuleNode,
-                             in nsAtom aVar,
-                             in nsAtom aRef,
+                             in nsAtomPtr aVar,
+                             in nsAtomPtr aRef,
                              in AString aExpr);
 
   /**
    * Translate a ref attribute string into a result. This is used as the
    * reference point by the template builder when generating the first level
    * of content. For recursive generation, the result from the parent
    * generation phase will be used directly as the reference so a translation
    * is not needed. This allows all levels to be generated using objects that
@@ -266,11 +270,11 @@ interface nsIXULTemplateQueryProcessor :
    * @param aLeft the left result to compare
    * @param aRight the right result to compare
    * @param aVar variable to compare
    *
    * @param returns -1 if less, 0 if equal, or 1 if greater
    */
    [noscript] int32_t compareResults(in nsIXULTemplateResult aLeft,
                                      in nsIXULTemplateResult aRight,
-                                     in nsAtom aVar,
+                                     in nsAtomPtr aVar,
                                      in unsigned long aSortHints);
 };
--- a/dom/xul/templates/nsIXULTemplateResult.idl
+++ b/dom/xul/templates/nsIXULTemplateResult.idl
@@ -1,19 +1,23 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nsISupports.idl"
 
-interface nsAtom;  // not a real interface; used in [noscript] methods only
 interface nsIDOMNode;
 interface nsIRDFResource;
 
+%{C++
+class nsAtom;
+%}
+[ptr] native nsAtomPtr(nsAtom);
+
 /**
  * A single result generated from a template query. Each result is identified
  * by an id, which must be unique within the set of results produced from a
  * query. The result may optionally be identified by an RDF resource.
  *
  * Generally, the result and its id will be able to uniquely identify a node
  * in the source data, such as an RDF or XML node. In other contexts, such as
  * a database query, a result would represent a particular record.
@@ -75,30 +79,30 @@ interface nsIXULTemplateResult : nsISupp
    * attribute within the action body, it will be replaced with the result
    * of this method. The question mark is considered part of the variable
    * name, thus aVar should be ?name and not simply name.
    *
    * @param aVar the variable to look up
    *
    * @return the value for the variable or a null string if it has no value
    */
-  [noscript] AString getBindingFor(in nsAtom aVar);
+  [noscript] AString getBindingFor(in nsAtomPtr aVar);
 
   /**
    * Get an object value for a variable such as ?name for this result. 
    *
    * This method may return null for a variable, even if getBindingFor returns
    * a non-null value for the same variable. This method is provided as a
    * convenience when sorting results.
    *
    * @param aVar the variable to look up
    *
    * @return the value for the variable or null if it has no value
    */
-  [noscript] nsISupports getBindingObjectFor(in nsAtom aVar);
+  [noscript] nsISupports getBindingObjectFor(in nsAtomPtr aVar);
 
   /**
    * Indicate that a particular rule of a query has matched and that output
    * will be generated for it. Both the query as compiled by the query
    * processor's compileQuery method and the XUL <rule> element are supplied.
    * The query must always be one that was compiled by the query processor
    * that created this result. The <rule> element must always be a child of
    * the <query> element that was used to compile the query.
--- a/rdf/base/nsIRDFXMLSerializer.idl
+++ b/rdf/base/nsIRDFXMLSerializer.idl
@@ -2,27 +2,30 @@
  *
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nsISupports.idl"
 #include "nsIRDFDataSource.idl"
 
-interface nsAtom;  // not a real interface; used in [noscript] methods only
+%{C++
+class nsAtom;
+%}
+[ptr] native nsAtomPtr(nsAtom);
 
 [scriptable, uuid(8ae1fbf8-1dd2-11b2-bd21-d728069cca92)]
 interface nsIRDFXMLSerializer : nsISupports
 {
     /**
      * Initialize the serializer with the specified datasource.
      * @param aDataSource the datasource from which data will be
      *   serialized
      */
     void init(in nsIRDFDataSource aDataSource);
 
     /**
      * Add the specified namespace to the serializer.
      * @param aPrefix the attribute namespace prefix
      * @param aURI the namespace URI
      */
-    [noscript] void addNameSpace(in nsAtom aPrefix, in DOMString aURI);
+    [noscript] void addNameSpace(in nsAtomPtr aPrefix, in DOMString aURI);
 };
--- a/rdf/base/nsIRDFXMLSink.idl
+++ b/rdf/base/nsIRDFXMLSink.idl
@@ -7,17 +7,20 @@
 
   Interfaces for the RDF/XML sink, which parses RDF/XML into
   a graph representation.
 
 */
 
 #include "nsISupports.idl"
 
-interface nsAtom;  // not a real interface; used in [noscript] methods only
+%{C++
+class nsAtom;
+%}
+[ptr] native nsAtomPtr(nsAtom);
 
 // XXX Until these get scriptable. See nsIRDFXMLSink::AddNameSpace()
 [ref] native nsStringRef(nsString);
 %{C++
 #include "nsStringFwd.h"
 %}
 
 interface nsIRDFXMLSink;
@@ -97,17 +100,17 @@ interface nsIRDFXMLSink : nsISupports
      */
     void endLoad();
 
     /**
      * Add namespace information to the RDF/XML sink.
      * @param aPrefix the namespace prefix
      * @param aURI the namespace URI
      */
-    [noscript] void addNameSpace(in nsAtom aPrefix,
+    [noscript] void addNameSpace(in nsAtomPtr aPrefix,
                                  [const] in nsStringRef aURI);
 
     /**
      * Add an observer that will be notified as the RDF/XML load
      * progresses.
      * <p>
      *
      * Note that the sink will acquire a strong reference to the