Backed out changeset f38852711f38 (bug 1320905) for bustage on a CLOSED TREE
authorCarsten "Tomcat" Book <cbook@mozilla.com>
Mon, 05 Dec 2016 16:13:36 +0100
changeset 325290 2d08aeb18ac99e1078a762cf0146a6a124a76018
parent 325289 bbbe3c47bd0b88bd6f1b6ca39a1f8d68bd89f4e7
child 325291 1e7ee9c3b11432576e6bff68aa9a96650c3130a0
push id24
push usermaklebus@msu.edu
push dateTue, 20 Dec 2016 03:11:33 +0000
bugs1320905
milestone53.0a1
backs outf38852711f383117b245c47db466764cd0a0b8b8
Backed out changeset f38852711f38 (bug 1320905) for bustage on a CLOSED TREE
js/public/RefCounted.h
js/public/UniquePtr.h
js/src/jsapi-tests/testIntTypesABI.cpp
js/src/jsapi.h
js/src/moz.build
mfbt/RefCounted.h
deleted file mode 100644
--- a/js/public/RefCounted.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
- * vim: set ts=8 sts=4 et sw=4 tw=99:
- * 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/. */
-
-#ifndef js_RefCounted_h
-#define js_RefCounted_h
-
-#include "mozilla/RefCounted.h"
-
-#include "js/Utility.h"
-
-namespace js {
-
-// Replacement for mozilla::RefCounted and mozilla::external::AtomicRefCounted
-// that default to JS::DeletePolicy.
-
-template <typename T, typename D = JS::DeletePolicy<T>>
-using RefCounted = mozilla::RefCounted<T, D>;
-
-template <typename T, typename D = JS::DeletePolicy<T>>
-using AtomicRefCounted = mozilla::external::AtomicRefCounted<T, D>;
-
-} // namespace js
-
-#endif /* js_RefCounted_h */
--- a/js/public/UniquePtr.h
+++ b/js/public/UniquePtr.h
@@ -8,17 +8,17 @@
 #define js_UniquePtr_h
 
 #include "mozilla/UniquePtr.h"
 
 #include "js/Utility.h"
 
 namespace js {
 
-// Replacement for mozilla::UniquePtr that defaults to JS::DeletePolicy.
+// Replacement for mozilla::UniquePtr that defaults to js::DefaultDelete.
 template <typename T, typename D = JS::DeletePolicy<T>>
 using UniquePtr = mozilla::UniquePtr<T, D>;
 
 namespace detail {
 
 template<typename T>
 struct UniqueSelector
 {
--- a/js/src/jsapi-tests/testIntTypesABI.cpp
+++ b/js/src/jsapi-tests/testIntTypesABI.cpp
@@ -21,17 +21,16 @@
 #include "js/Debug.h"
 #include "js/GCAPI.h"
 #include "js/HashTable.h"
 #include "js/HeapAPI.h"
 #include "js/Id.h"
 /* LegacyIntTypes.h is deliberately exempted from this requirement */
 #include "js/MemoryMetrics.h"
 #include "js/ProfilingStack.h"
-#include "js/RefCounted.h"
 #include "js/RequiredDefines.h"
 #include "js/RootingAPI.h"
 #include "js/SliceBudget.h"
 #include "js/StructuredClone.h"
 #include "js/TracingAPI.h"
 #include "js/TrackedOptimizationInfo.h"
 #include "js/TypeDecls.h"
 #include "js/UbiNode.h"
--- a/js/src/jsapi.h
+++ b/js/src/jsapi.h
@@ -9,16 +9,17 @@
 #ifndef jsapi_h
 #define jsapi_h
 
 #include "mozilla/AlreadyAddRefed.h"
 #include "mozilla/FloatingPoint.h"
 #include "mozilla/MemoryReporting.h"
 #include "mozilla/Range.h"
 #include "mozilla/RangedPtr.h"
+#include "mozilla/RefCounted.h"
 #include "mozilla/RefPtr.h"
 #include "mozilla/Variant.h"
 
 #include <stdarg.h>
 #include <stddef.h>
 #include <stdint.h>
 #include <stdio.h>
 
@@ -28,17 +29,16 @@
 #include "js/CallArgs.h"
 #include "js/CharacterEncoding.h"
 #include "js/Class.h"
 #include "js/GCVector.h"
 #include "js/HashTable.h"
 #include "js/Id.h"
 #include "js/Principals.h"
 #include "js/Realm.h"
-#include "js/RefCounted.h"
 #include "js/RootingAPI.h"
 #include "js/TracingAPI.h"
 #include "js/Utility.h"
 #include "js/Value.h"
 #include "js/Vector.h"
 
 /************************************************************************/
 
@@ -6082,17 +6082,17 @@ SetBuildIdOp(JSContext* cx, BuildIdOp bu
  * still valid (as described above). DeserializeWasmModule is then called to
  * construct a JS::WasmModule (also on the background thread), passing the
  * bytecode file descriptor and, if valid, the compiled-code file descriptor.
  * The JS::WasmObject is then transported to the JSRuntime thread (which
  * originated the request) and the wrapping WebAssembly.Module object is created
  * by calling createObject().
  */
 
-struct WasmModule : js::AtomicRefCounted<WasmModule>
+struct WasmModule : mozilla::external::AtomicRefCounted<WasmModule>
 {
     MOZ_DECLARE_REFCOUNTED_TYPENAME(WasmModule)
     virtual ~WasmModule() {}
 
     virtual void serializedSize(size_t* bytecodeSize, size_t* compiledSize) const = 0;
     virtual void serialize(uint8_t* bytecodeBegin, size_t bytecodeSize,
                            uint8_t* compiledBegin, size_t compiledSize) const = 0;
 
--- a/js/src/moz.build
+++ b/js/src/moz.build
@@ -128,17 +128,16 @@ EXPORTS.js += [
     '../public/Initialization.h',
     '../public/LegacyIntTypes.h',
     '../public/MemoryMetrics.h',
     '../public/Principals.h',
     '../public/ProfilingFrameIterator.h',
     '../public/ProfilingStack.h',
     '../public/Proxy.h',
     '../public/Realm.h',
-    '../public/RefCounted.h',
     '../public/RequiredDefines.h',
     '../public/Result.h',
     '../public/RootingAPI.h',
     '../public/SliceBudget.h',
     '../public/StructuredClone.h',
     '../public/SweepingAPI.h',
     '../public/TraceKind.h',
     '../public/TracingAPI.h',
--- a/mfbt/RefCounted.h
+++ b/mfbt/RefCounted.h
@@ -11,17 +11,16 @@
 
 #include "mozilla/AlreadyAddRefed.h"
 #include "mozilla/Assertions.h"
 #include "mozilla/Atomics.h"
 #include "mozilla/Attributes.h"
 #include "mozilla/Move.h"
 #include "mozilla/RefCountType.h"
 #include "mozilla/TypeTraits.h"
-#include "mozilla/UniquePtr.h"
 
 #if defined(MOZILLA_INTERNAL_API)
 #include "nsXPCOM.h"
 #endif
 
 #if defined(MOZILLA_INTERNAL_API) && \
     (defined(DEBUG) || defined(FORCE_BUILD_REFCNT_LOGGING))
 #define MOZ_REFCOUNTED_LEAK_CHECKING
@@ -82,17 +81,17 @@ public:
 
 // This is used WeakPtr.h as well as this file.
 enum RefCountAtomicity
 {
   AtomicRefCount,
   NonAtomicRefCount
 };
 
-template<typename T, RefCountAtomicity Atomicity, typename D>
+template<typename T, RefCountAtomicity Atomicity>
 class RefCounted
 {
 protected:
   RefCounted() : mRefCnt(0) {}
   ~RefCounted() { MOZ_ASSERT(mRefCnt == detail::DEAD); }
 
 public:
   // Compatibility with nsRefPtr.
@@ -128,17 +127,17 @@ public:
     if (0 == cnt) {
       // Because we have atomically decremented the refcount above, only
       // one thread can get a 0 count here, so as long as we can assume that
       // everything else in the system is accessing this object through
       // RefPtrs, it's safe to access |this| here.
 #ifdef DEBUG
       mRefCnt = detail::DEAD;
 #endif
-      D()(const_cast<T*>(static_cast<const T*>(this)));
+      delete static_cast<const T*>(this);
     }
   }
 
   // Compatibility with wtf::RefPtr.
   void ref() { AddRef(); }
   void deref() { Release(); }
   MozRefCountType refCount() const { return mRefCnt; }
   bool hasOneRef() const
@@ -167,18 +166,18 @@ private:
 // two small inline functions which will hopefully get eliminated by the linker
 // in non-leak-checking builds.
 #define MOZ_DECLARE_REFCOUNTED_TYPENAME(T) \
   const char* typeName() const { return #T; } \
   size_t typeSize() const { return sizeof(*this); }
 
 } // namespace detail
 
-template<typename T, class D = DefaultDelete<T>>
-class RefCounted : public detail::RefCounted<T, detail::NonAtomicRefCount, D>
+template<typename T>
+class RefCounted : public detail::RefCounted<T, detail::NonAtomicRefCount>
 {
 public:
   ~RefCounted()
   {
     static_assert(IsBaseOf<RefCounted, T>::value,
                   "T must derive from RefCounted<T>");
   }
 };
@@ -187,19 +186,19 @@ namespace external {
 
 /**
  * AtomicRefCounted<T> is like RefCounted<T>, with an atomically updated
  * reference counter.
  *
  * NOTE: Please do not use this class, use NS_INLINE_DECL_THREADSAFE_REFCOUNTING
  * instead.
  */
-template<typename T, typename D = DefaultDelete<T>>
+template<typename T>
 class AtomicRefCounted :
-  public mozilla::detail::RefCounted<T, mozilla::detail::AtomicRefCount, D>
+  public mozilla::detail::RefCounted<T, mozilla::detail::AtomicRefCount>
 {
 public:
   ~AtomicRefCounted()
   {
     static_assert(IsBaseOf<AtomicRefCounted, T>::value,
                   "T must derive from AtomicRefCounted<T>");
   }
 };