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

4 Коммитов

Автор SHA1 Сообщение Дата
Lina Cambridge 35f0c7a7f9 Bug 1482608 - Add owning thread pointer holders for Rust code. r=nika,myk
This commit adds `ThreadPtr{Handle, Holder}` to wrap an `XpCom` object
with thread-safe refcounting. These are analagous to
`nsMainThreadPtr{Handle, Holder}`, but can hold references to
objects from any thread, not just the main thread.

`ThreadPtrHolder` is similar to `ThreadBoundRefPtr`. However, it's
not possible to clone a `ThreadBoundRefPtr`, so it can't be shared
among tasks. This is fine for objects that are only used once, like
callbacks. However, `ThreadBoundRefPtr` doesn't work well for loggers
or event emitters, which might need to be called multiple times on
the owning thread.

Unlike a `ThreadBoundRefPtr`, it's allowed and expected to
clone and drop a `ThreadPtrHolder` on other threads. Internally,
the holder keeps an atomic refcount, and releases the wrapped object
on the owning thread once the count reaches zero.

This commit also changes `TaskRunnable` to support dispatching from
threads other than the main thread.

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

--HG--
extra : moz-landing-system : lando
2019-03-25 04:49:24 +00: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
Bevis Tseng 03f90b6e33 Bug 1372453 - Part 1: Support to name the callers of ProxyReleaseEvent. r=froydnj
MozReview-Commit-ID: 8rmwqzPrzM7
2017-06-13 18:10:13 +08:00
Benjamin Smedberg 60cd8481eb Bug 1332631 part D - file moves from xpcom/glue to xpcom/threads, r=froydnj
MozReview-Commit-ID: kDBGvlYjyW

--HG--
rename : xpcom/glue/BlockingResourceBase.cpp => xpcom/threads/BlockingResourceBase.cpp
rename : xpcom/glue/BlockingResourceBase.h => xpcom/threads/BlockingResourceBase.h
rename : xpcom/glue/CondVar.h => xpcom/threads/CondVar.h
rename : xpcom/glue/DeadlockDetector.h => xpcom/threads/DeadlockDetector.h
rename : xpcom/glue/MainThreadUtils.h => xpcom/threads/MainThreadUtils.h
rename : xpcom/glue/Monitor.h => xpcom/threads/Monitor.h
rename : xpcom/glue/Mutex.h => xpcom/threads/Mutex.h
rename : xpcom/glue/ReentrantMonitor.h => xpcom/threads/ReentrantMonitor.h
rename : xpcom/glue/nsProxyRelease.cpp => xpcom/threads/nsProxyRelease.cpp
rename : xpcom/glue/nsProxyRelease.h => xpcom/threads/nsProxyRelease.h
rename : xpcom/glue/nsThreadUtils.cpp => xpcom/threads/nsThreadUtils.cpp
rename : xpcom/glue/nsThreadUtils.h => xpcom/threads/nsThreadUtils.h
extra : rebase_source : 5f908c04835192c1949bed0828d7bd086e795f64
extra : histedit_source : 26a8dbfd9b082c9200fbe7b176f6593e406c98ce
2017-01-20 14:13:57 -05:00