Bug 94199 - Various cleanup; r=enn
authorMs2ger <ms2ger@gmail.com>
Wed, 16 Nov 2011 08:50:18 +0100
changeset 80303 b832a0860c4b7a3a8c3f9fbd5dfe6434cadcb0ef
parent 80302 52951fda6786ff865df792fd4a1fdd98c0ea8976
child 80304 fc6e597b8b9e54d00cf2ab3c3c69bdedf2f50053
push id21484
push userMs2ger@gmail.com
push dateWed, 16 Nov 2011 07:55:38 +0000
treeherdermozilla-central@d51bd1645a2f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersenn
bugs94199
milestone11.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 94199 - Various cleanup; r=enn
content/xbl/src/nsXBLProtoImpl.cpp
content/xbl/src/nsXBLProtoImplMethod.h
content/xbl/src/nsXBLSerialize.cpp
content/xbl/src/nsXBLSerialize.h
--- a/content/xbl/src/nsXBLProtoImpl.cpp
+++ b/content/xbl/src/nsXBLProtoImpl.cpp
@@ -302,17 +302,17 @@ nsXBLProtoImpl::DestroyMembers()
 
 nsresult
 nsXBLProtoImpl::Read(nsIScriptContext* aContext,
                      nsIObjectInputStream* aStream,
                      nsXBLPrototypeBinding* aBinding,
                      nsIScriptGlobalObject* aGlobal)
 {
   // Set up a class object first so that deserialization is possible
-  JSContext *cx = static_cast<JSContext *>(aContext->GetNativeContext());
+  JSContext *cx = aContext->GetNativeContext();
   JSObject *global = aGlobal->GetGlobalJSObject();
 
   void* classObject;
   nsresult rv = aBinding->InitClass(mClassName, cx, global, global, &classObject);
   NS_ENSURE_SUCCESS(rv, rv);
   NS_ENSURE_TRUE(classObject, NS_ERROR_FAILURE);
 
   mClassObject = (JSObject*) classObject;
--- a/content/xbl/src/nsXBLProtoImplMethod.h
+++ b/content/xbl/src/nsXBLProtoImplMethod.h
@@ -175,14 +175,15 @@ public:
   virtual nsresult InstallMember(nsIScriptContext* aContext,
                                  nsIContent* aBoundElement, 
                                  void* aScriptObject,
                                  void* aTargetClassObject,
                                  const nsCString& aClassStr) {
     return NS_OK;
   }
 
+  using nsXBLProtoImplMethod::Write;
   nsresult Write(nsIScriptContext* aContext,
                  nsIObjectOutputStream* aStream,
                  XBLBindingSerializeDetails aType);
 };
 
 #endif // nsXBLProtoImplMethod_h__
--- a/content/xbl/src/nsXBLSerialize.cpp
+++ b/content/xbl/src/nsXBLSerialize.cpp
@@ -10,17 +10,17 @@
  * Software distributed under the License is distributed on an "AS IS" basis,
  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  * for the specific language governing rights and limitations under the
  * License.
  *
  * The Original Code is mozilla.org code.
  *
  * The Initial Developer of the Original Code is
- *   Mozilla Corporation.
+ * the Mozilla Foundation.
  * Portions created by the Initial Developer are Copyright (C) 2011
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  *
  * Alternatively, the contents of this file may be used under the terms of
  * either the GNU General Public License Version 2 or later (the "GPL"), or
  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
@@ -40,41 +40,38 @@
 #include "nsContentUtils.h"
 #include "jsxdrapi.h"
 
 nsresult
 XBL_SerializeFunction(nsIScriptContext* aContext,
                       nsIObjectOutputStream* aStream,
                       JSObject* aFunctionObject)
 {
-  nsresult rv;
-
-  JSContext* cx = (JSContext*) aContext->GetNativeContext();
+  JSContext* cx = aContext->GetNativeContext();
   JSXDRState *xdr = ::JS_XDRNewMem(cx, JSXDR_ENCODE);
   if (!xdr)
     return NS_ERROR_OUT_OF_MEMORY;
-  xdr->userdata = (void*) aStream;
-
-  jsval funval = OBJECT_TO_JSVAL(aFunctionObject);
+  xdr->userdata = static_cast<void*>(aStream);
 
   JSAutoRequest ar(cx);
-  if (! ::JS_XDRFunctionObject(xdr, &aFunctionObject)) {
+  nsresult rv;
+  if (!JS_XDRFunctionObject(xdr, &aFunctionObject)) {
     rv = NS_ERROR_FAILURE;
   } else {
     uint32 size;
     const char* data = reinterpret_cast<const char*>
-                                         (::JS_XDRMemGetData(xdr, &size));
+                                       (JS_XDRMemGetData(xdr, &size));
     NS_ASSERTION(data, "no decoded JSXDRState data!");
 
     rv = aStream->Write32(size);
     if (NS_SUCCEEDED(rv))
       rv = aStream->WriteBytes(data, size);
   }
 
-  ::JS_XDRDestroy(xdr);
+  JS_XDRDestroy(xdr);
 
   return rv;
 }
 
 // static
 nsresult
 XBL_DeserializeFunction(nsIScriptContext* aContext,
                         nsIObjectInputStream* aStream,
@@ -90,33 +87,33 @@ XBL_DeserializeFunction(nsIScriptContext
   if (NS_FAILED(rv))
     return rv;
 
   char* data;
   rv = aStream->ReadBytes(size, &data);
   if (NS_FAILED(rv))
     return rv;
 
-  JSContext* cx = (JSContext*) aContext->GetNativeContext();
-  JSXDRState *xdr = ::JS_XDRNewMem(cx, JSXDR_DECODE);
+  JSContext* cx = aContext->GetNativeContext();
+  JSXDRState *xdr = JS_XDRNewMem(cx, JSXDR_DECODE);
   if (!xdr) {
     rv = NS_ERROR_OUT_OF_MEMORY;
   } else {
-    xdr->userdata = (void*) aStream;
+    xdr->userdata = static_cast<void*>(aStream);
     JSAutoRequest ar(cx);
-    ::JS_XDRMemSetData(xdr, data, size);
+    JS_XDRMemSetData(xdr, data, size);
 
-    if (! ::JS_XDRFunctionObject(xdr, &functionObject)) {
+    if (!JS_XDRFunctionObject(xdr, &functionObject)) {
       rv = NS_ERROR_FAILURE;
     }
 
     uint32 junk;
-    data = (char*) ::JS_XDRMemGetData(xdr, &junk);
-    ::JS_XDRMemSetData(xdr, NULL, 0);
-    ::JS_XDRDestroy(xdr);
+    data = static_cast<char*>(JS_XDRMemGetData(xdr, &junk));
+    JS_XDRMemSetData(xdr, NULL, 0);
+    JS_XDRDestroy(xdr);
   }
 
   nsMemory::Free(data);
   NS_ENSURE_SUCCESS(rv, rv);
 
   *aScriptObject = functionObject;
 
   return rv;
--- a/content/xbl/src/nsXBLSerialize.h
+++ b/content/xbl/src/nsXBLSerialize.h
@@ -10,17 +10,17 @@
  * Software distributed under the License is distributed on an "AS IS" basis,
  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  * for the specific language governing rights and limitations under the
  * License.
  *
  * The Original Code is mozilla.org code.
  *
  * The Initial Developer of the Original Code is
- *   Mozilla Corporation.
+ * the Mozilla Foundation.
  * Portions created by the Initial Developer are Copyright (C) 2011
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  *
  * Alternatively, the contents of this file may be used under the terms of
  * either the GNU General Public License Version 2 or later (the "GPL"), or
  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),