Bug 1312936 - Part 1. Use ACString for nsITranserable.getAnyTransferData. r=masayuki
authorMakoto Kato <m_kato@ga2.so-net.ne.jp>
Wed, 26 Oct 2016 11:07:16 +0900
changeset 364598 80687b4d7461cac239159b73181566b3442b1a25
parent 364597 18e1ee2de339a5c1020bb194b2797924117da11b
child 364599 357f4f16be12fa88136a382aaf34d08792ce55d9
push id1369
push userjlorenzo@mozilla.com
push dateMon, 27 Feb 2017 14:59:41 +0000
treeherdermozilla-release@d75a1dba431f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmasayuki
bugs1312936
milestone52.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 1312936 - Part 1. Use ACString for nsITranserable.getAnyTransferData. r=masayuki MozReview-Commit-ID: L8eWccMBtVj
widget/nsITransferable.idl
widget/nsTransferable.cpp
--- a/widget/nsITransferable.idl
+++ b/widget/nsITransferable.idl
@@ -137,17 +137,18 @@ interface nsITransferable : nsISupports
   /**
     * Returns the best flavor in the transferable, given those that have
     * been added to it with |AddFlavor()|
     *
     * @param  aFlavor (out parameter) the flavor of data that was retrieved
     * @param  aData the data. Some variant of class in nsISupportsPrimitives.idl
     * @param  aDataLen the length of the data
     */
-  void getAnyTransferData ( out string aFlavor, out nsISupports aData, out unsigned long aDataLen ) ;
+  void getAnyTransferData ( out ACString aFlavor, out nsISupports aData,
+                            out unsigned long aDataLen ) ;
 
   /**
     * Returns true if the data is large.
     */
   boolean isLargeDataSet ( ) ;
   
 
     ///////////////////////////////
--- a/widget/nsTransferable.cpp
+++ b/widget/nsTransferable.cpp
@@ -368,26 +368,27 @@ nsTransferable::GetTransferData(const ch
 
 //
 // GetAnyTransferData
 //
 // Returns the data of the first flavor found. Caller is responsible for deleting the
 // flavor string.
 //
 NS_IMETHODIMP
-nsTransferable::GetAnyTransferData(char **aFlavor, nsISupports **aData, uint32_t *aDataLen)
+nsTransferable::GetAnyTransferData(nsACString& aFlavor, nsISupports **aData,
+                                   uint32_t *aDataLen)
 {
   MOZ_ASSERT(mInitialized);
 
-  NS_ENSURE_ARG_POINTER(aFlavor && aData && aDataLen);
+  NS_ENSURE_ARG_POINTER(aData && aDataLen);
 
   for (size_t i = 0; i < mDataArray.Length(); ++i) {
     DataStruct& data = mDataArray.ElementAt(i);
     if (data.IsDataAvailable()) {
-      *aFlavor = ToNewCString(data.GetFlavor());
+      aFlavor.Assign(data.GetFlavor());
       data.GetData(aData, aDataLen);
       return NS_OK;
     }
   }
 
   return NS_ERROR_FAILURE;
 }