Commit Graph

2600 Commits

Author SHA1 Message Date
Gerald Squelart
10f1b864f2 Bug 1316432 - nsCOMPtr construction/assignment from nullptr - r=froydnj
MozReview-Commit-ID: 4KW3g2WSJaC

--HG--
extra : rebase_source : de8fc2f900abbf7f0bf763ffac8f23f9cde298b4
2016-11-11 07:57:38 +11:00
Gerald Squelart
47f1821983 Bug 1316432 - Replace 0's with nullptr in nsCOMPtr.* - r=froydnj
Just a mechanical find/replace of all zero pointers, before the next patch.

MozReview-Commit-ID: DSzSZunAXWu

--HG--
extra : rebase_source : a5a9a064335254a7456a7ec48805c4ec08fd18af
2016-11-10 14:19:56 +11:00
Gerald Squelart
06c4e95cd0 Bug 1316206 - Make RefPtr(decltype(nullptr)) MOZ_IMPLICIT - r=froydnj
Making this constructor non-explicit will permit automatic conversions from
'nullptr' into RefPtr types, which I think are not dangerous.

The one spot that this affects is in 'UserDataType nsBaseHashtable::Get(KeyType)',
which does a 'return 0;' into the UserDataType, which could be a bool, an int, a
RefPtr or other. I'm changing that into a C++11 "value initialization", which
falls back to "zero initialization" for PODs: 'return UserDataType{};'.

Also fixed the comment to clarify not-found return values, as Get(KeyType) was
not only used for pointers anyway.

MozReview-Commit-ID: F41VlvTNOZU

--HG--
extra : rebase_source : 71d5dacac75ca188e5c55d45f48a5fca76d953c6
2016-11-08 15:12:33 +11:00
Andreas Farre
3aecf57375 Bug 1198381 - Implement the requestIdleCallback feature, r=froydnj,mattwoodrow,smaug
Expose requestIdleCallback on Window and implement running callbacks
in idle periods by posting rICs to the main threads idle queue.

MozReview-Commit-ID: KSYQsyaZ6is

--HG--
extra : rebase_source : 6abd41c2de96b39004f1b2c3c740e81de570970c
2016-08-22 14:52:45 +02:00
Andreas Farre
d87b4d239b Bug 1198381 - Extend nsIThread with idleDispatch, r=froydnj,smaug
The intent of idleDispatch is the possibility to have a runnable
executed when the thread is idle. This is accomplished by adding an
event queue for idle tasks that will only be considered when the main
event queue is empty and the caller of ProcessNextEvent doesn't
require that we wait until there is an event on the main event queue.

MozReview-Commit-ID: IDWQfzZqWpZ

--HG--
extra : rebase_source : 0d5bfeebd08e01597c2cd8b76e8e848d9f9c58f0
2016-08-24 16:18:06 +02:00
Carsten "Tomcat" Book
e42af6918c Backed out changeset 333a899fb5e6 (bug 1198381) 2016-10-25 12:32:56 +02:00
Carsten "Tomcat" Book
1895ce466b Backed out changeset eb2606332cb8 (bug 1198381) 2016-10-25 12:32:54 +02:00
Andreas Farre
1380385c69 Bug 1198381 - Implement the requestIdleCallback feature, r=froydnj,mattwoodrow,smaug
Expose requestIdleCallback on Window and implement running callbacks
in idle periods by posting rICs to the main threads idle queue.

MozReview-Commit-ID: KSYQsyaZ6is

--HG--
extra : rebase_source : 4bdd578b654d05cab600489d30d859452d1bc888
2016-08-22 14:52:45 +02:00
Andreas Farre
60a3a10742 Bug 1198381 - Extend nsIThread with idleDispatch, r=froydnj,smaug
The intent of idleDispatch is the possibility to have a runnable
executed when the thread is idle. This is accomplished by adding an
event queue for idle tasks that will only be considered when the main
event queue is empty and the caller of ProcessNextEvent doesn't
require that we wait until there is an event on the main event queue.

MozReview-Commit-ID: IDWQfzZqWpZ

--HG--
extra : rebase_source : b16ff65d7a9b2fa16216a9ce8756358014d7ad96
2016-08-24 16:18:06 +02:00
Nathan Froyd
d1108c1e52 Bug 1311068 - remove InitializerList.h; r=botond
We needed this polyfill for <initializer_list> when some of our C++
standard libraries did not support said header.  They all do now, so the
polyfill is redundant.
2016-10-19 00:33:14 -04:00
Eric Rahm
5b5f49eb80 Bug 1308317 - Part 9: Remove nsSupportsArray::Compact. r=froydnj
This removes the scriptable method |Compact| which is unused in
our codebase and turns up no references in the plugins repo.

MozReview-Commit-ID: 5sJtO5COJpB
2016-10-18 11:36:39 -07:00
Eric Rahm
7fde5ad2f6 Bug 1308317 - Part 8: Remove nsSupportsArray::LastIndexOf. r=froydnj
This removes the scriptable method |GetLastIndexOf| which is unused in
our codebase and turns up no references in the plugins repo. This allows to
remove the non-scriptable |LastIndexOf|.

MozReview-Commit-ID: 54Ux7yZMh4F
2016-10-18 11:36:38 -07:00
Eric Rahm
d4f6772880 Bug 1308317 - Part 6: Remove nsSupportsArray::GetIndexOfStartingAt. r=froydnj
This removes the scriptable method |GetIndexOfStartingAt| which is unused in
our codebase and turns up no references in the plugins repo. This allows to
remove the non-scriptable |IndexOfStartingAt| which is folded into |IndexOf|.

MozReview-Commit-ID: 2ADz5mLIvMU
2016-10-18 11:36:36 -07:00
Eric Rahm
1cd7bbde2c Bug 1308317 - Part 5: Remove nsSupportsArray::DeleteLastElement. r=froydnj
|DeleteLastElement| is scriptable, but a search of our add-on repo turned up
no hits and there were no references in gecko code. This also allows us to
remove the non-scriptable |RemoveLastElement| which was only called by
|DeleteLastElement|.

MozReview-Commit-ID: 20FXBrosacA
2016-10-18 11:36:35 -07:00
Carsten "Tomcat" Book
ac6a598542 Backed out changeset 476a831ca87e (bug 1308317) 2016-10-14 14:58:40 +02:00
Carsten "Tomcat" Book
b79e4e00cc Backed out changeset 8c2984643f74 (bug 1308317) 2016-10-14 14:58:38 +02:00
Carsten "Tomcat" Book
b474cb6353 merge mozilla-inbound to mozilla-central a=merge 2016-10-14 11:59:12 +02:00
Eric Rahm
b3bce28ad5 Bug 1308317 - Part 6: Remove nsSupportsArray::GetIndexOfStartingAt. r=froydnj
This removes the scriptable method |GetIndexOfStartingAt| which is unused in
our codebase and turns up no references in the plugins repo. This allows to
remove the non-scriptable |IndexOfStartingAt| which is folded into |IndexOf|.

MozReview-Commit-ID: 2ADz5mLIvMU
2016-10-13 22:04:39 -07:00
Eric Rahm
08e653d2cf Bug 1308317 - Part 5: Remove nsSupportsArray::DeleteLastElement. r=froydnj
|DeleteLastElement| is scriptable, but a search of our add-on repo turned up
no hits and there were no references in gecko code. This also allows us to
remove the non-scriptable |RemoveLastElement| which was only called by
|DeleteLastElement|.

MozReview-Commit-ID: 20FXBrosacA
2016-10-13 22:04:38 -07:00
Xidorn Quan
320a08b33e Bug 1309794 - Make RefCnt types non-copyable. r=froydnj
MozReview-Commit-ID: Lx344xrXDZT

--HG--
extra : rebase_source : 31ef46add0b2b4b2e62b425d0740199f0e4d4f85
2016-10-13 16:52:54 +11:00
Sebastian Hengst
cdcc9e20da Bug 1304829 - rename RELEASE_BUILD to RELEASE_OR_BETA: main part. r=ted,Mossop
MozReview-Commit-ID: 1lCt0xTMV5O
2016-10-08 11:14:49 +02:00
Phil Ringnalda
0e26fa186a Backed out changeset 3851e5f51530 (bug 1299489) for unfathomable bustage of Linux32 debug test_peerConnection_capturedVideo.html
CLOSED TREE

MozReview-Commit-ID: I6HSmVRtucs
2016-10-05 19:25:24 -07:00
Michael Layzell
025811ca63 Bug 1299489 - Change nsTArray to use a custom iterator based on index instead of pointers to improve iterator invalidation safety of ranged for loops, r=froydnj
MozReview-Commit-ID: CahPOcRYvES
2016-10-05 11:54:51 -04:00
Tom Schuster
774a8bf34d Bug 1302163 - Change code to use SprintfLiteral instead of snprintf. r=ehsan 2016-10-04 17:57:51 +02:00
Nils Ohlmeier [:drno]
565956109b Bug 1305159: replace NSAddImage with dlopen on OSX. r=froydnj
MozReview-Commit-ID: FHZthgRxPha

--HG--
extra : rebase_source : a6f7f61a4016b515ea96073f943aec06fea224b7
2016-09-23 15:31:39 -07:00
Andrew McCreight
5b9c57b7a2 Bug 1301301, part 1 - Unify NoteJSObject and NoteJSScript into NoteJSChild. r=smaug
This will let my next patch pass in other GC things.

This should not change behavior in any important way.

MozReview-Commit-ID: FykviKKvQzI
2016-09-23 15:42:13 -07:00
Michael Layzell
030fcbd018 Bug 1303472 - Add a move constructor to nsCOMPtr, r=froydnj
MozReview-Commit-ID: 6ECLDmA9Ol
2016-09-20 11:36:14 -04:00
Xidorn Quan
7d4ca9c88b Bug 1303302 - Add IsDestructible trait in TypeTraits and use it for refcounted type static check. r=froydnj
MozReview-Commit-ID: G3YFhrJngq0

--HG--
extra : rebase_source : da0aa325eb7772c1a156440ed46be9d0d429c91e
2016-09-16 17:23:55 +10:00
Jan de Mooij
a53986bf29 Bug 1302448 part 1 - Rename CycleCollectedJSRuntime to CycleCollectedJSContext. r=mccr8
--HG--
rename : xpcom/base/CycleCollectedJSRuntime.cpp => xpcom/base/CycleCollectedJSContext.cpp
rename : xpcom/base/CycleCollectedJSRuntime.h => xpcom/base/CycleCollectedJSContext.h
extra : rebase_source : 075214b5057f151520926715b6154e99ae80a0b3
2016-09-14 15:47:32 +02:00
Nicholas Nethercote
34dcc7b852 Bug 1299384 - Use MOZ_MUST_USE with NS_warn_if_impl(). r=erahm.
This change avoids lots of false positives for Coverity's CHECKED_RETURN
warning, caused by NS_WARN_IF's current use in both statement-style and
expression-style.

In the case where the code within the NS_WARN_IF has side-effects, I made the
following change.

> NS_WARN_IF(NS_FAILED(FunctionWithSideEffects()));
> -->
> Unused << NS_WARN_IF(NS_FAILED(FunctionWithSideEffects()));

In the case where the code within the NS_WARN_IF lacks side-effects, I made the
following change.

> NS_WARN_IF(!condWithoutSideEffects);
> -->
> NS_WARNING_ASSERTION(condWithoutSideEffects, "msg");

This has two improvements.
- The condition is not evaluated in non-debug builds.
- The sense of the condition is inverted to the familiar "this condition should
  be true" sense used in assertions.

A common variation on the side-effect-free case is the following.

> nsresult rv = Fn();
> NS_WARN_IF_(NS_FAILED(rv));
> -->
> DebugOnly<nsresult rv> = Fn();
> NS_WARNING_ASSERTION(NS_SUCCEEDED(rv), "Fn failed");

--HG--
extra : rebase_source : 58788245021096efa8372a9dc1d597a611d45611
2016-09-02 17:12:24 +10:00
Nicholas Nethercote
b71747b2ac Bug 1299727 - Rename NS_WARN_IF_FALSE as NS_WARNING_ASSERTION. r=erahm.
The new name makes the sense of the condition much clearer. E.g. compare:

  NS_WARN_IF_FALSE(!rv.Failed());

with:

  NS_WARNING_ASSERTION(!rv.Failed());

The new name also makes it clearer that it only has effect in debug builds,
because that's standard for assertions.

--HG--
extra : rebase_source : 886e57a9e433e0cb6ed635cc075b34b7ebf81853
2016-09-01 15:01:16 +10:00
Nicholas Nethercote
819433bae0 Bug 1299389 - Replace some raw pointers in nsThreadManager. r=froydnj.
nsThreadManager::get() can return a reference. This lets us remove some
redundant assertions.

nsThreadArray elements can be NotNull<>s.

--HG--
extra : rebase_source : fd49010167101bc15f7f6d01bf95fd63b81d60fb
2016-06-10 16:04:49 +10: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
Gerald Squelart
fb84b054bc Bug 1295763 - Allow ThreadSafeAutoRefCnt with XPCOM_GLUE - r=froydnj
Removed '#ifndef XPCOM_GLUE' that blocked usage of thread-safe ref-counting
from XPCOM_GLUE code.

MozReview-Commit-ID: Hm0rdTKK46l

--HG--
extra : rebase_source : cd2779d0b39c5319cfdb5d12e8f4ac6f38945e7b
2016-08-16 14:07:16 +10:00
Kan-Ru Chen
b6d880aca1 Bug 1297276 - Rename mfbt/unused.h to mfbt/Unused.h for consistency. r=froydnj
The patch is generated from following command:

  rgrep -l unused.h|xargs sed -i -e s,mozilla/unused.h,mozilla/Unused.h,

MozReview-Commit-ID: AtLcWApZfES


--HG--
rename : mfbt/unused.h => mfbt/Unused.h
2016-08-24 14:47:04 +08:00
Andrew McCreight
edbb47a7d7 Bug 1288870, part 1 - Add NS_INLINE_DECL_REFCOUNTING_WITH_DESTROY. r=froydnj
This is the same basic idea as NS_IMPL_RELEASE_WITH_DESTROY. I need
this because I am making XPCNativeInterface refcounted, and it uses
some weird placement new stuff requiring a special function to
deallocate the object. (It does this to store an array of arbitrary
length inline, presumably for some sort of time or space reason.)

MozReview-Commit-ID: 5I7BgY6YlLl
2016-08-23 05:59:56 -07:00
Xidorn Quan
fab96c1410 Bug 1291707 part 2 - Add GetAndRemove to nsDataHashtable. r=froydnj
MozReview-Commit-ID: 24zlYwsRGsF

--HG--
extra : rebase_source : 904c62cd779133666904d3167cb7e7c31f95a412
extra : source : 6c1df15aad607e70547b51011bd352d8a8bf826d
2016-08-23 10:31:26 +10:00
Kan-Ru Chen
b4cf4bec61 Bug 1264642 - Part 6. Mark JSStructuredCloneData as MOZ_NON_MEMMOVABLE and add specializations in nsTArray.h. r=froydnj
MozReview-Commit-ID: HltgzBnxMsn
2016-08-23 00:40:47 +08:00
Nathan Froyd
e255fd3842 Bug 1262826 - specialize nsTHashtable<nsPtrHashKey<T>> to share a common implementation; r=erahm
We have a number of nsTHashtable<nsPtrHashKey<T>> instantiations, mostly
from IPDL-generated code.  There's no reason in principle that all of
these instantiations couldn't share code, since they're all storing POD
entries of the same size.  Let's specialize nsTHashtable for such types,
providing a thin layer over a hashtable that stores void pointers.  This
change saves about 90K of space (!) on x86-64 Linux.
2016-08-22 18:45:47 -04:00
Nathan Froyd
41ba39b3b0 Bug 1295197 - use non-null-checked operator new in xpcom/; r=erahm
The standard placement new function is declared to not throw, which
means that, per spec, a null check on its result is required. There are
a number of places throughout xpcom/ where we know that we are passing
non-null pointers to placement new (and receiving them as a return
value), and we are therefore doing useless work performing these null
checks.

Therefore, we should be using an operator new overload that doesn't
require the null check. MFBT has just such an overload, so use that.
2016-08-22 18:40:10 -04:00
Emilio Cobos Álvarez
00ab304ee2 Bug 1292618: Add Gecko_ClearPODTArray to clear arrays of types without destructors. r=heycam
MozReview-Commit-ID: 3RRvrXn6ZTD
Signed-off-by: Emilio Cobos Álvarez <ecoal95@gmail.com>
2016-08-19 20:24:24 -07:00
Wes Kocher
02f300c352 Backed out 4 changesets (bug 1292618) because it was making merging things difficult a=backout
Backed out changeset 14733a383b4c (bug 1292618)
Backed out changeset 17dfe8bc5f76 (bug 1292618)
Backed out changeset d04597bd1109 (bug 1292618)
Backed out changeset 30f7696fea2d (bug 1292618)
2016-08-19 18:37:09 -07:00
Emilio Cobos Álvarez
c043a5d5c5 Bug 1292618: Add Gecko_ClearPODTArray to clear arrays of types without destructors. r=heycam
MozReview-Commit-ID: 3RRvrXn6ZTD
Signed-off-by: Emilio Cobos Álvarez <ecoal95@gmail.com>
2016-08-19 18:26:35 -07:00
Ryan VanderMeulen
01c4e8cc1b Merge inbound to m-c. a=merge 2016-08-19 09:52:53 -04:00
Phil Ringnalda
b4f23026ee Backed out 5 changesets (bug 1292618) for !mImageTracked assertion failures
CLOSED TREE

Backed out changeset 1d767147e160 (bug 1292618)
Backed out changeset e6034e58efe4 (bug 1292618)
Backed out changeset 928dd363efa0 (bug 1292618)
Backed out changeset 8e274c66ae7f (bug 1292618)
Backed out changeset 6c347701d343 (bug 1292618)
2016-08-19 00:23:42 -07:00
Emilio Cobos Álvarez
242a6e6bcf Bug 1292618: Add Gecko_ClearPODTArray to clear arrays of types without destructors. r=heycam
MozReview-Commit-ID: 3RRvrXn6ZTD
2016-08-18 22:16:16 -07:00
Wes Kocher
55897634c1 Backed out 3 changesets (bug 1288870) for hazards a=backout
Backed out changeset 83bbd356da97 (bug 1288870)
Backed out changeset 4f0ab1a0d8dd (bug 1288870)
Backed out changeset 8d71aba5c1e7 (bug 1288870)
2016-08-18 16:50:13 -07:00
Andrew McCreight
f68a2b0443 Bug 1288870, part 1 - Add NS_INLINE_DECL_REFCOUNTING_WITH_DESTROY. r=froydnj
This is the same basic idea as NS_IMPL_RELEASE_WITH_DESTROY. I need
this because I am making XPCNativeInterface refcounted, and it uses
some weird placement new stuff requiring a special function to
deallocate the object. (It does this to store an array of arbitrary
length inline, presumably for some sort of time or space reason.)

MozReview-Commit-ID: 5I7BgY6YlLl
2016-08-18 15:20:48 -07:00
Emilio Cobos Álvarez
11d1b4e283 Bug 1295818: Templatize nsTArray::RemoveElementsBy to avoid a spurious allocation. r=froydnj
mozilla::function involves an allocation of the FunctionImpl type, that we can
avoid rather easily in this case.

This commit is completely optional, I guess, though the code we're using
RemoveElementsBy with the previous patch is sort of hot.

MozReview-Commit-ID: 2LoQs4cB28X
2016-08-18 10:02:39 -07:00
Sylvestre Ledru
4a4e53fe19 Bug 1296231 - Fix some missing "Missing varargs cleanup" and "Resource leaks" r=froydnj
MozReview-Commit-ID: AT1L351PjF6

--HG--
extra : rebase_source : f9c0cb1a8b478c2ad5a52f679eb5feb603e85d2e
2016-08-18 10:46:05 +02:00