Commit Graph

9 Commits

Author SHA1 Message Date
Ehsan Akhgari
76272a36ed Bug 923554 - Backout the atomic weak pointer implementation because it's neither atomic nor thread-safe; r=froydnj 2013-10-16 13:48:34 -04:00
Ehsan Akhgari
5ee21d6d3f Bug 895322 - Part 1: Replace the usages of MOZ_STATIC_ASSERT with C++11 static_assert; r=Waldo
This patch was mostly generated by running the following scripts on the codebase, with some
manual changes made afterwards:

# static_assert.sh
#!/bin/bash
# Command to convert an NSPR integer type to the equivalent standard integer type

function convert() {
echo "Converting $1 to $2..."
find . ! -wholename "*nsprpub*" \
       ! -wholename "*security/nss*" \
       ! -wholename "*/.hg*" \
       ! -wholename "obj-ff-dbg*" \
       ! -name nsXPCOMCID.h \
       ! -name prtypes.h \
         -type f \
      \( -iname "*.cpp" \
         -o -iname "*.h" \
         -o -iname "*.cc" \
         -o -iname "*.mm" \) | \
    xargs -n 1 `dirname $0`/assert_replacer.py #sed -i -e "s/\b$1\b/$2/g"
}

convert MOZ_STATIC_ASSERT static_assert
hg rev --no-backup mfbt/Assertions.h \
                   media/webrtc/signaling/src/sipcc/core/includes/ccapi.h \
                   modules/libmar/src/mar_private.h \
                   modules/libmar/src/mar.h


# assert_replacer.py
#!/usr/bin/python

import sys
import re

pattern = re.compile(r"\bMOZ_STATIC_ASSERT\b")

def replaceInPlace(fname):
  print fname
  f = open(fname, "rw+")
  lines = f.readlines()
  for i in range(0, len(lines)):
    while True:
      index = re.search(pattern, lines[i])
      if index != None:
        index = index.start()
        lines[i] = lines[i][0:index] + "static_assert" + lines[i][index+len("MOZ_STATIC_ASSERT"):]
        for j in range(i + 1, len(lines)):
          if lines[j].find("                 ", index) == index:
            lines[j] = lines[j][0:index] + lines[j][index+4:]
          else:
            break
      else:
        break
  f.seek(0, 0)
  f.truncate()
  f.write("".join(lines))
  f.close()

argc = len(sys.argv)
for i in range(1, argc):
  replaceInPlace(sys.argv[i])

--HG--
extra : rebase_source : 4b4a4047d82f2c205b9fad8d56dfc3f1afc0b045
2013-07-18 13:59:53 -04:00
Ms2ger
28a9e7aa20 Bug 896341 - Update include guards and modelines in MFBT; r=Waldo 2013-07-24 09:41:39 +02:00
Mike Hommey
6334a79a0e Bug 864035 - Add an atomic RefCounted and WeakPtr implementation. r=Waldo 2013-05-18 09:52:53 +02:00
Ehsan Akhgari
8b9a514d5f Bug 863884 - Prepare WeakPtr to support a thread-safe variant; r=Waldo 2013-04-19 17:59:01 -04:00
Nicholas Nethercote
1d9c94fd87 Bug 563195: Avoid triggering -Wshadow warnings in mfbt/. r=Waldo 2013-02-17 22:56:32 -08:00
Jeff Muizelaar
2eb25e2d11 Bug 821804 - Allow unitialized WeakPtrs to work properly. r=Waldo
This ensures that the WeakPtr always points at a valid object and avoids the
need to test for that during operations.
2012-12-18 11:37:14 -05:00
Joe Drew
101fab9469 Bug 801120 - Support T* WeakPtr<T>::get(). r=Ms2ger,ehsan
--HG--
extra : rebase_source : 662ef6f39966956be5588d9bd7508dbe59a2c537
2012-10-12 18:17:58 -04:00
Jeff Muizelaar
644f4e96df Bug 792954. Add a WeakPtr implementation to use instead of nsISupportsWeakReference. r=joe,ehsan,Waldo
This patch also replaces the usage of nsISupportsWeakReference in RasterImage as an example.

--HG--
extra : rebase_source : ac6a039dcc3227a04ac4c2221f38856bb308c695
2012-10-04 15:45:07 -04:00