Граф коммитов

59 Коммитов

Автор SHA1 Сообщение Дата
Jean-Yves Avenard 1b9b84bbce Bug 1672072 - P12. Add constructor for WeakPtr(RefPtr). r=sg
This allows for nice template type deducation.

Differential Revision: https://phabricator.services.mozilla.com/D96368
2020-11-13 04:21:17 +00:00
Bogdan Tara 266d9ad46c Backed out 13 changesets (bug 1672072) for short.mp4.firstframe.html failures CLOSED TREE
Backed out changeset f093b7969e8b (bug 1672072)
Backed out changeset 28db8276ec2b (bug 1672072)
Backed out changeset ff8fe1b856b3 (bug 1672072)
Backed out changeset 091b9449c786 (bug 1672072)
Backed out changeset 89d9a12c0737 (bug 1672072)
Backed out changeset 9cb71fd4b43b (bug 1672072)
Backed out changeset 09adad7416e1 (bug 1672072)
Backed out changeset 9905650335ef (bug 1672072)
Backed out changeset 6f1d99e9c3a1 (bug 1672072)
Backed out changeset b59655b7a595 (bug 1672072)
Backed out changeset 1ef9d6d10508 (bug 1672072)
Backed out changeset fbf0b5117655 (bug 1672072)
Backed out changeset 65cd3b9de5c6 (bug 1672072)
2020-11-13 06:13:22 +02:00
Jean-Yves Avenard 5b9a3683e4 Bug 1672072 - P12. Add constructor for WeakPtr(RefPtr). r=sg
This allows for nice template type deducation.

Differential Revision: https://phabricator.services.mozilla.com/D96368
2020-11-12 22:54:14 +00:00
Emilio Cobos Álvarez 061fc9d988 Bug 1658571 - Add MainThreadWeakPtr and use it in PreloaderBase::RedirectSink. r=sg,smaug
Per matrix discussion, this is safer to uplift (instead of relying on
the RedirectSink being released on the main thread).

Differential Revision: https://phabricator.services.mozilla.com/D91270
2020-09-24 16:38:35 +00:00
Sylvestre Ledru 843f943758 Bug 1519636 - Reformat recent changes to the Google coding style r=andi
# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D85678
2020-08-02 15:29:15 +00:00
Emilio Cobos Álvarez ff61891772 Bug 1653011 - Simplify and make WeakPtr<Derived> usable and compact. r=froydnj,sg,geckoview-reviewers,jgilbert,kvark,snorp
Having two classes in the inheritance chain inherit from SupportsWeakPtr
now won't compile, but you can use WeakPtr<Derived> when any base class
inherits from SupportsWeakPtr.

Differential Revision: https://phabricator.services.mozilla.com/D83674
2020-07-23 14:51:46 +00:00
Jean-Yves Avenard bd648e63b9 Bug 1649974 - P1. Make WeakPtr work with generic taskqueue. r=froydnj
It worked until now as IPC's MessageChannel was only used with background taskqueue; which use a threadpool made of a single thread only.

Differential Revision: https://phabricator.services.mozilla.com/D82499
2020-07-10 01:36:12 +00:00
Razvan Maries 05fa077757 Backed out 5 changesets (bug 1650996, bug 1649974) for perma failures on Android 7.0. CLOSED TREE
Backed out changeset 8f8174ba409d (bug 1650996)
Backed out changeset 374598f9c37a (bug 1650996)
Backed out changeset 236757acc073 (bug 1650996)
Backed out changeset 89d5cabfa2df (bug 1649974)
Backed out changeset 6e475ddbd18c (bug 1649974)
2020-07-09 10:33:45 +03:00
Jean-Yves Avenard 09c6a1b3f4 Bug 1649974 - P1. Make WeakPtr work with generic taskqueue. r=froydnj
It worked until now as IPC's MessageChannel was only used with background taskqueue; which use a threadpool made of a single thread only.

Differential Revision: https://phabricator.services.mozilla.com/D82499
2020-07-09 06:10:24 +00:00
Mihai Alexandru Michis b29ef28dc4 Backed out 2 changesets (bug 1649974) as requested by jyavenard.
CLOSED TREE

Backed out changeset 4d7301e8eeb3 (bug 1649974)
Backed out changeset 69bacb6e8287 (bug 1649974)
2020-07-09 05:43:59 +03:00
Jean-Yves Avenard d7560b65c6 Bug 1649974 - P1. Make WeakPtr work with generic taskqueue. r=froydnj
It worked until now as IPC's MessageChannel was only used with background taskqueue; which use a threadpool made of a single thread only.

Differential Revision: https://phabricator.services.mozilla.com/D82499
2020-07-08 13:15:42 +00:00
Bogdan Tara 0867b964e2 Backed out 5 changesets (bug 1650996, bug 1649974) for hazard failures CLOSED TREE
Backed out changeset de5e55b59a31 (bug 1650996)
Backed out changeset 35faa46f46f1 (bug 1650996)
Backed out changeset 6f779a3875a8 (bug 1650996)
Backed out changeset fac1e5a07a6c (bug 1649974)
Backed out changeset 3c5157a9e872 (bug 1649974)
2020-07-08 16:07:56 +03:00
Jean-Yves Avenard 9194155201 Bug 1649974 - P1. Make WeakPtr work with generic taskqueue. r=froydnj
It worked until now as IPC's MessageChannel was only used with background taskqueue; which use a threadpool made of a single thread only.

Differential Revision: https://phabricator.services.mozilla.com/D82499
2020-07-08 03:58:18 +00:00
André Bargull 14ca007916 Bug 1625138 - Part 41: Remove no longer needed includes for mozilla/TypeTraits. r=froydnj
Also adds missing includes in some files, these were previously only transivitely
included through mozilla/TypeTraits.h.

Differential Revision: https://phabricator.services.mozilla.com/D68561

--HG--
extra : moz-landing-system : lando
2020-03-28 16:00:09 +00:00
André Bargull 32cb16fc45 Bug 1625138 - Part 32: Replace mozilla::RemoveConst with std::remove_const. r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D68551

--HG--
extra : moz-landing-system : lando
2020-03-28 13:57:19 +00:00
Kris Maglione 64a2c8bb8f Bug 1535617: Part 1 - Add macros to clear weak references on unlink. r=mccr8
Differential Revision: https://phabricator.services.mozilla.com/D63961

--HG--
extra : moz-landing-system : lando
2020-02-25 19:44:27 +00:00
Emilio Cobos Álvarez e363a41bd4 Bug 1607595 - Remove uses of mozilla::IsBaseOf. r=froydnj
Automatically generated by:

$ rg 'IsBaseOf<' | cut -d : -f 1 | xargs sed -i 's/mozilla::IsBaseOf</std::is_base_of</g'
$ rg 'IsBaseOf<' | cut -d : -f 1 | xargs sed -i 's/IsBaseOf</std::is_base_of</g

Differential Revision: https://phabricator.services.mozilla.com/D59013

--HG--
extra : moz-landing-system : lando
2020-01-08 14:52:10 +00:00
Honza Bambas 1c65af06ec Bug 1580921 - Do more thread-safety checks in mozilla::WeakPtr, r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D45872

--HG--
extra : moz-landing-system : lando
2019-09-13 17:23:16 +00:00
Honza Bambas 431cc4a42d Bug 1580182 - Allow mozilla::SupportsWeakPtr be on base classes as well, r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D45515

--HG--
extra : moz-landing-system : lando
2019-09-11 19:44:17 +00:00
Ehsan Akhgari e5e885ae31 Bug 1521000 - Part 2: Adjust our clang-format rules to include spaces after the hash for nested preprocessor directives r=sylvestre
# ignore-this-changeset

--HG--
extra : amend_source : 7221c8d15a765df71171099468e7c7faa648f37c
extra : histedit_source : a0cce6015636202bff09e35a13f72e03257a7695
2019-01-18 10:16:18 +01:00
Sylvestre Ledru 265e672179 Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
# ignore-this-changeset

--HG--
extra : amend_source : 4d301d3b0b8711c4692392aa76088ba7fd7d1022
2018-11-30 11:46:48 +01:00
Jed Davis 08bc6b93f0 Bug 1493045 - Assert thread-safety when destroying WeakPtr r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D7353

--HG--
extra : moz-landing-system : lando
2018-10-03 16:41:10 +00:00
Bill McCloskey 7e43e5439d Bug 1384395 - Use nsAutoOwningThread for mfbt/WeakPtr.h thread assertions (r=froydnj)
MozReview-Commit-ID: DF4DiffL4Qq
2017-07-28 13:11:44 -07:00
Cameron McCormack a5624c6f9d Bug 1356103 - Part 1: Add WeakPtrTraits to allow SupportsWeakPtr classes to opt in to more permissive thread ownership assertions. r=bholley
MozReview-Commit-ID: 62pJc2N8aIo

--HG--
extra : rebase_source : b1fed73b2c03d1cc1261a674a44fe578c2fe7d99
2017-04-30 12:14:06 +08:00
Iris Hsiao 0a6db9e69f Backed out 12 changesets (bug 1356103) for build bustage at PostTraversalTask.h
Backed out changeset 9fb487252c28 (bug 1356103)
Backed out changeset 301237c65945 (bug 1356103)
Backed out changeset 7bc3a4861a39 (bug 1356103)
Backed out changeset 2f383d89184b (bug 1356103)
Backed out changeset a03112e1c9d5 (bug 1356103)
Backed out changeset c60b4c9cbd83 (bug 1356103)
Backed out changeset 34280baeaabe (bug 1356103)
Backed out changeset 31a0881cfb47 (bug 1356103)
Backed out changeset 529d037f9c33 (bug 1356103)
Backed out changeset 1c7831db6b07 (bug 1356103)
Backed out changeset 559f06e32df3 (bug 1356103)
Backed out changeset 784865d234cd (bug 1356103)
2017-05-04 17:56:25 +08:00
Cameron McCormack e94f4a51be Bug 1356103 - Part 1: Add WeakPtrTraits to allow SupportsWeakPtr classes to opt in to more permissive thread ownership assertions. r=bholley
MozReview-Commit-ID: 62pJc2N8aIo

--HG--
extra : rebase_source : b1fed73b2c03d1cc1261a674a44fe578c2fe7d99
2017-04-30 12:14:06 +08:00
Tom Ritter 4d9bda0d08 Bug 1317642 Disable WeakPtr thread assertions on MinGW r=froydnj
MinGW has two threading models: win32 API based, which disables std::thread,
and POSIX based which enables it but requires an emulation library (winpthreads).

Rather than attempting to switch to pthread emulation at this point, we are
disabling the std::thread based assertion checking for WeakPtr on MinGW.

MozReview-Commit-ID: BmHo70n6AuK

--HG--
extra : rebase_source : 08495775b2925a797c8098216911d30c0b79ef3d
2017-01-13 13:50:21 -06:00
Honza Bambas e4eacf065d Bug 956338 - Add checks to WeakPtr/nsWeakReference and related classes to assert single-thread usage. r=nfroyd
--HG--
extra : rebase_source : 140fa149eb94f027e9319a44be0bbee34648222a
2016-08-01 13:16:16 +02:00
Nathan Froyd 01583602a9 Bug 1207245 - part 6 - rename nsRefPtr<T> to RefPtr<T>; r=ehsan; a=Tomcat
The bulk of this commit was generated with a script, executed at the top
level of a typical source code checkout.  The only non-machine-generated
part was modifying MFBT's moz.build to reflect the new naming.

CLOSED TREE makes big refactorings like this a piece of cake.

 # The main substitution.
find . -name '*.cpp' -o -name '*.cc' -o -name '*.h' -o -name '*.mm' -o -name '*.idl'| \
    xargs perl -p -i -e '
 s/nsRefPtr\.h/RefPtr\.h/g; # handle includes
 s/nsRefPtr ?</RefPtr</g;   # handle declarations and variables
'

 # Handle a special friend declaration in gfx/layers/AtomicRefCountedWithFinalize.h.
perl -p -i -e 's/::nsRefPtr;/::RefPtr;/' gfx/layers/AtomicRefCountedWithFinalize.h

 # Handle nsRefPtr.h itself, a couple places that define constructors
 # from nsRefPtr, and code generators specially.  We do this here, rather
 # than indiscriminantly s/nsRefPtr/RefPtr/, because that would rename
 # things like nsRefPtrHashtable.
perl -p -i -e 's/nsRefPtr/RefPtr/g' \
     mfbt/nsRefPtr.h \
     xpcom/glue/nsCOMPtr.h \
     xpcom/base/OwningNonNull.h \
     ipc/ipdl/ipdl/lower.py \
     ipc/ipdl/ipdl/builtin.py \
     dom/bindings/Codegen.py \
     python/lldbutils/lldbutils/utils.py

 # In our indiscriminate substitution above, we renamed
 # nsRefPtrGetterAddRefs, the class behind getter_AddRefs.  Fix that up.
find . -name '*.cpp' -o -name '*.h' -o -name '*.idl' | \
    xargs perl -p -i -e 's/nsRefPtrGetterAddRefs/RefPtrGetterAddRefs/g'

if [ -d .git ]; then
    git mv mfbt/nsRefPtr.h mfbt/RefPtr.h
else
    hg mv mfbt/nsRefPtr.h mfbt/RefPtr.h
fi

--HG--
rename : mfbt/nsRefPtr.h => mfbt/RefPtr.h
2015-10-18 01:24:48 -04:00
Nathan Froyd 583afa0965 Bug 1207245 - part 3 - switch all uses of mozilla::RefPtr<T> to nsRefPtr<T>; r=ehsan
This commit was generated using the following script, executed at the
top level of a typical source code checkout.

 # Don't modify select files in mfbt/ because it's not worth trying to
 # tease out the dependencies currently.
 #
 # Don't modify anything in media/gmp-clearkey/0.1/ because those files
 # use their own RefPtr, defined in their own RefCounted.h.
find . -name '*.cpp' -o -name '*.h' -o -name '*.mm' -o -name '*.idl'| \
    grep -v 'mfbt/RefPtr.h' | \
    grep -v 'mfbt/nsRefPtr.h' | \
    grep -v 'mfbt/RefCounted.h' | \
    grep -v 'media/gmp-clearkey/0.1/' | \
    xargs perl -p -i -e '
 s/mozilla::RefPtr/nsRefPtr/g; # handle declarations in headers
 s/\bRefPtr</nsRefPtr</g; # handle local variables in functions
 s#mozilla/RefPtr.h#mozilla/nsRefPtr.h#; # handle #includes
 s#mfbt/RefPtr.h#mfbt/nsRefPtr.h#;       # handle strange #includes
'

 # |using mozilla::RefPtr;| is OK; |using nsRefPtr;| is invalid syntax.
find . -name '*.cpp' -o -name '*.mm' | xargs sed -i -e '/using nsRefPtr/d'

 # RefPtr.h used |byRef| for dealing with COM-style outparams.
 # nsRefPtr.h uses |getter_AddRefs|.
 # Fixup that mismatch.
find . -name '*.cpp' -o -name '*.h'| \
    xargs perl -p -i -e 's/byRef/getter_AddRefs/g'
2015-10-18 00:40:10 -04:00
Nathan Froyd 5761751aa3 Bug 1207245 - part 1 - move RefCounted<T> to its own file
Various bits depend on RefPtr.h to provide RefCounted<T> and RefPtr<T>.
It will be easier to manage an automatic conversion from RefPtr<T> to
nsRefPtr<T> if we split out the dependency on RefCounted<T> first.
2015-09-22 21:27:34 -04:00
Olli Pettay e91dae783c Bug 1204669 optimize out hashtable lookups caused by extra GetPrototypeBinding call, r=bz,waldo 2015-09-24 03:53:31 +03:00
Andrew McCreight 0c176ddcff Bug 1062479 - Use static strings for WeakReference type names. r=ehsan 2015-04-24 09:43:01 -07:00
Brian Smith 9c3a50df68 Bug 1119776, Part 4: Avoid defining snprintf when MSVC provides it (MFBT), r=waldo
--HG--
extra : rebase_source : 22216031650057afade8cda274723574af5fee6c
2015-01-08 22:33:03 -08:00
Masatoshi Kimura bf312ad056 Bug 1120062 - Part 1: Remove most Nullptr.h includes. r=waldo 2015-01-11 11:34:52 +09:00
Ehsan Akhgari 860da94550 Bug 1114999 - Part 2: Apply MOZ_NO_ADDREF_RELEASE_ON_RETURN to all smart pointer arrow operators that can return refcounted objects; r=jrmuizel 2015-01-06 16:30:03 -05:00
Ehsan Akhgari 9297631e0b Bug 1114880 follow-up: Rename MOZ_{STRONG,WEAK}_REF to MOZ_{OWNING,NON_OWNING}_REF
--HG--
extra : rebase_source : 51fff0785d112b5b87be3c6ff723c8986b37effe
2014-12-23 21:17:50 -05:00
Ehsan Akhgari cef42d50e5 Bug 1114979 - Annotate some strong and weak references in MFBT; r=froydnj
--HG--
extra : rebase_source : 63d9ca59f8f6be06efd087600c8fd5c5f52e5cd1
2014-12-23 17:26:28 -05:00
Ehsan Akhgari 4d78ae894d Bug 1048013 - Fix some bad implicit constructors in MFBT; r=froydnj 2014-08-05 09:21:12 -04:00
Benoit Jacob c50ccf8dba Bug 1044658 - 5/6 - remove asWeakPtr - r=froydnj 2014-07-30 15:52:05 -04:00
Benoit Jacob fca4408490 Bug 1044658 - 4/6 - remove the need for asWeakPtr, and make asWeakPtr just return 'this' - r=froydnj 2014-07-30 15:52:04 -04:00
Benoit Jacob b0f63f3533 Bug 1044658 - 3/6 - make WeakPtr<const T> work - r=froydnj 2014-07-30 15:52:03 -04:00
Benoit Jacob fdea1f7900 Bug 1044658 - 2/6 - remove useless base classes around WeakPtr - r=froydnj 2014-07-30 15:52:02 -04:00
Benoit Jacob 6610e8054e Bug 1044658 - 1/6 - remove useless template parameters around WeakPtr - r=froydnj 2014-07-30 15:52:01 -04:00
Nicholas Nethercote 6c3f5d7b8e Bug 1041914 - Convert the fourth quarter of MFBT to Gecko style. r=Ms2ger.
--HG--
extra : rebase_source : 588fa9c0d1e819e1826835c4ef4a1428a927bf93
2014-07-22 20:54:41 -07:00
Nicholas Nethercote 2a0942be41 Bug 1036789 - Convert the third quarter of MFBT to Gecko style. r=Ms2ger.
--HG--
extra : rebase_source : 668cd394806203ddfa34bd4f226335ff26c846b5
2014-07-10 19:10:17 -07:00
Ehsan Akhgari 8b30e40485 Bug 1013662 - Fix bad implicit conversion constructors in MFBT; r=froydnj,Waldo 2014-06-06 23:17:06 -04:00
Ehsan Akhgari 5da1cb00cf Add a comment to WeakPtr.h which explicitly calls out the fact that it's not thread-safe, no bug, DONTBUILD 2014-03-28 00:12:30 -04:00
Ehsan Akhgari 8cd0c0f21d Bug 935778 - Part 3: Add trace-refcount logging for AddRef and Release in RefCounted objects; r=dbaron 2014-03-09 14:36:36 -04:00
Ehsan Akhgari 5704b555e2 Bug 935778 - Part 0.2: Spray some MOZ_DECLARE_REFCOUNTED_TYPENAME across the tree 2014-02-20 21:33:49 -05:00