Commit Graph

2442 Commits

Author SHA1 Message Date
Sebastian Hengst
5c00b8540d merge mozilla-inbound to mozilla-central. r=merge a=merge
MozReview-Commit-ID: AlcL6XYDkf
2017-10-12 23:58:31 +02:00
Nicholas Nethercote
1de4b467c1 Bug 1406829 (part 2) - Use initializer lists more in nsAtom constructors. r=froydnj. 2017-09-26 16:43:31 +10:00
Nicholas Nethercote
b54a014b55 Bug 1406829 (part 1) - Add a comment about nsAtom::hash(). r=froydnj. 2017-09-26 16:20:57 +10:00
Mike Hommey
404ef7af3e Bug 1407838 - Remove the remains of NS_Alloc/NS_Realloc/NS_Free. r=njn
Bug 1134923 removed the use of those functions in gecko, and left some
for the XPCOM standalone glue. The XPCOM standalone glue was severely
stripped down in bug 1306327, with the effect of removing the
implementation for those functions.

The remains in nsXPCOM.h are:
XPCOM_API(void*) NS_Alloc(size_t aSize);
XPCOM_API(void*) NS_Realloc(void* aPtr, size_t aSize);
XPCOM_API(void) NS_Free(void* aPtr);

With no implementation left, the first arm is never actually used, and
the second arm means every remaining use of those functions in the tree
is a macro expansion to one of moz_xmalloc, moz_xrealloc or free.

--HG--
extra : rebase_source : fd1669abc5a25d8edbd5c3a8522e22a5c3f558e2
2017-10-12 11:08:44 +09:00
Sebastian Hengst
051f888cef Backed out changeset 759a43ebc6bf (bug 1405541) for asserting in devtools/client/performance/test/browser_perf-console-record-03.js on Windows 7. r=backout
--HG--
extra : amend_source : 3df3e75c561cbc42db104ec1a6f6026ef021e3c7
2017-10-11 13:15:26 +02:00
Nicholas Nethercote
add7e65972 Bug 1405541 - Split AUTO_PROFILER_LABEL_DYNAMIC into three macros. r=mstange.
It's easy to mess up the scoping so that (a) the label is pushed and then
immediately popped, and/or (b) the string doesn't live long enough. It's also
easy to do a utf16-to-utf8 conversion unnecessarily when the profiler is
inactive.

This patch splits that macro into three new ones that are harder to mess up.

- AUTO_PROFILER_LABEL_DYNAMIC_CSTR: same as current.
- AUTO_PROFILER_LABEL_DYNAMIC_NSCSTRING: for nsCStrings.
- AUTO_PROFILER_LABEL_DYNAMIC_LOSSY_NSSTRING: for nsStrings.

--HG--
extra : rebase_source : 53c8b43b6a1be06d00618a133e28bf95c46a3ba3
2017-10-11 13:03:34 +02:00
Phil Ringnalda
bd5ca8f40d Backed out changeset 901a16fec9fc (bug 1405541) for Windows assertion failures
MozReview-Commit-ID: DRGWXU4Tbfk
2017-10-10 23:28:33 -07:00
Nicholas Nethercote
b23fb68ae3 Bug 1405541 - Split AUTO_PROFILER_LABEL_DYNAMIC into three macros. r=mstange.
It's easy to mess up the scoping so that (a) the label is pushed and then
immediately popped, and/or (b) the string doesn't live long enough. It's also
easy to do a utf16-to-utf8 conversion unnecessarily when the profiler is
inactive.

This patch splits that macro into three new ones that are harder to mess up.

- AUTO_PROFILER_LABEL_DYNAMIC_CSTR: same as current.
- AUTO_PROFILER_LABEL_DYNAMIC_NSCSTRING: for nsCStrings.
- AUTO_PROFILER_LABEL_DYNAMIC_LOSSY_NSSTRING: for nsStrings.

--HG--
extra : rebase_source : 59f77df0124249bfd11fee3585420a17b4201d37
2017-10-04 13:44:24 +11:00
Sebastian Hengst
6ea9396481 merge mozilla-central to mozilla-inbound. r=merge a=merge 2017-10-09 11:29:05 +02:00
Jon Coppeard
b6270c9da7 Bug 1400003 - Mark Heap<T> and barrier classes as MOZ_NON_MEMMOVABLE r=sfink r=froydnj 2017-10-09 10:03:20 +01:00
Nicholas Nethercote
d225f7151b Bug 1400460 - Rename nsIAtom as nsAtom. r=hiro.
(Path is actually r=froydnj.)

Bug 1400459 devirtualized nsIAtom so that it is no longer a subclass of
nsISupports. This means that nsAtom is now a better name for it than nsIAtom.

MozReview-Commit-ID: 91U22X2NydP

--HG--
rename : xpcom/ds/nsIAtom.h => xpcom/ds/nsAtom.h
extra : rebase_source : ac3e904a21b8b48e74534fff964f1623ee937c67
2017-10-03 09:05:19 +11:00
Emilio Cobos Álvarez
76571cb8eb Bug 1404897: Some fixes to allow storing non-copyable types in nsDataHashtable. r=froydnj
MozReview-Commit-ID: HaBT0igj9Yn

--HG--
extra : rebase_source : 19cc5135601931bd5a47157e3bbbd6e064b1961e
2017-10-02 15:24:59 +02:00
Sebastian Hengst
636468f6d3 Backed out changeset e3352dc9d701 (bug 1404897) 2017-10-04 12:55:22 +02:00
Emilio Cobos Álvarez
c59ce1be20 Bug 1404897: Some fixes to allow storing non-copyable types in nsDataHashtable. r=froydnj
MozReview-Commit-ID: HaBT0igj9Yn

--HG--
extra : rebase_source : bf20cddb302f4de3a20797afe0872dcb43b8bdae
2017-10-02 15:24:59 +02:00
Sebastian Hengst
2dbbc650a4 Backed out changeset 9389dd982590 (bug 1404897) 2017-10-04 11:24:36 +02:00
Emilio Cobos Álvarez
0ed05a9a4e Bug 1404897: Some fixes to allow storing non-copyable types in nsDataHashtable. r=froydnj
MozReview-Commit-ID: HaBT0igj9Yn
2017-10-04 11:01:31 +02:00
Philippe Normand
e22abc7e90 Bug 1404302 - Include nsQuickSort.h in nsCOMArray.cpp. r=froydnj
This fixes the build in non-unified mode, as nsCOMArray::Sort() method uses
NS_QuickSort().


MozReview-Commit-ID: CDBLIX8D3mL

--HG--
extra : rebase_source : 67902cf10b9311adbd97fecf7906762bb86c52e4
2017-09-28 14:30:29 +01:00
Nicholas Nethercote
dfd3b7e7aa Bug 1400459 (part 2) - Devirtualize nsIAtom. r=heycam.
This patch merges nsAtom into nsIAtom. For the moment, both names can be used
interchangeably due to a typedef. The patch also devirtualizes nsIAtom, by
making it not inherit from nsISupports, removing NS_DECL_NSIATOM, and dropping
the use of NS_IMETHOD_. It also removes nsIAtom's IIDs.

These changes trigger knock-on changes throughout the codebase, changing the
types of lots of things as follows.

- nsCOMPtr<nsIAtom> --> RefPtr<nsIAtom>

- nsCOMArray<nsIAtom> --> nsTArray<RefPtr<nsIAtom>>
  - Count() --> Length()
  - ObjectAt() --> ElementAt()
  - AppendObject() --> AppendElement()
  - RemoveObjectAt() --> RemoveElementAt()

- ns*Hashtable<nsISupportsHashKey, ...> -->
  ns*Hashtable<nsRefPtrHashKey<nsIAtom>, ...>

- nsInterfaceHashtable<T, nsIAtom> --> nsRefPtrHashtable<T, nsIAtom>
  - This requires adding a Get() method to nsRefPtrHashtable that it lacks but
    nsInterfaceHashtable has.

- nsCOMPtr<nsIMutableArray> --> nsTArray<RefPtr<nsIAtom>>
  - nsArrayBase::Create() --> nsTArray()
  - GetLength() --> Length()
  - do_QueryElementAt() --> operator[]

The patch also has some changes to Rust code that manipulates nsIAtom.

MozReview-Commit-ID: DykOl8aEnUJ

--HG--
extra : rebase_source : 254404e318e94b4c93ec8d4081ff0f0fda8aa7d1
2017-09-26 08:33:21 +10:00
Nicholas Nethercote
041d2fa02a Bug 1400459 (part 1) - Remove return value from nsIAtom::ToUTF8String(). r=froydnj.
It's infallible.

--HG--
extra : rebase_source : 0b1e03c65233a227d84efeb9717a7cb1c464e4c8
2017-09-25 16:38:18 +10:00
Nicholas Nethercote
5018bb4f9b Bug 1401873 - Remove nsHtml5Atom. r=froydnj,hsivonen.
nsHtml5Atoms are very similar to dynamic nsAtoms. This patch removes the former
in favour of the latter, which leaves nsAtom as the only subclass of nsIAtom.

nsAtom::mKind is still used to distinguish dynamic atoms from HTML5 atoms, and
the HTML5 parser still uses manual memory management to handle its HTML5 atoms.

nsHtml5AtomEntry::mAtom had to be changed from an nsAutoPtr to a raw pointer
because nsAtom's destructor is private.

MozReview-Commit-ID: 1pBzwkog3ut

--HG--
extra : rebase_source : fbb819e527cb30606348da9ce3eede62e00fb936
2017-09-21 14:02:05 +10:00
Nicholas Nethercote
de07428d79 Bug 1401873 - Expose nsAtom in nsIAtom.h. r=froydnj.
This patch moves nsAtom's declaration to nsIAtom.h. In order to keep most of
nsAtom's members private the patch also does the following.

- It introduces a new class, nsAtomFriend, which encapsulates the functions
  that will need access to nsAtom's private members.

- It moves GCKind, GCAtomTable(), and GCAtomTableLocked() out of nsAtom.

- It removes the factory methods, and replaces their uses with direct
  constructor calls.

MozReview-Commit-ID: L8vfrHsR2cS

--HG--
extra : rebase_source : d38a65515ae82c355966ca80ab235bea11b638af
2017-09-25 16:30:32 +10:00
Nicholas Nethercote
fcd9a33eac Bug 1401873 - Rename Atom as nsAtom. r=froydnj.
Because it's going to be exposed via nsIAtom.h in the next few patches.

MozReview-Commit-ID: A81s1nWrvmB

--HG--
extra : rebase_source : 43990feb460fc7343c994f72fb6c6679a3aeb1cc
2017-09-21 12:36:53 +10:00
Nicholas Nethercote
225f3a87e4 Bug 1400193 (part 2) - Shrink PLDHashTable. r=froydnj.
This patch reduces sizeof(PLDHashTable) as follows.

- 64-bit: from 40 bytes to 32
- 32-bit: from 28 bytes to 20

It does this by doing the following.

- It moves mGeneration from EntryStore to PLDHashTable, to avoid unnecessary
  padding on 64-bit. This requires tweaking EntryStore::Set() as explained in a
  comment.

- It also shrinks mGeneration from uint32_t to uint16_t, saving 2 bytes of
  data.

- It shrinks mEntrySize from uint32_t to uint8_t, to cut 3 bytes of data.

- It shrinks mHashShift from int16_t to uint8_t, trimming another byte of data,
  and moves it, saving another 2 bytes of padding.

And it reorders the fields so the word-sized ones are at the start, which makes
it easier to imagine the memory layout.

The patch also adds a test, and fixes some misordered function arguments in
existing tests.

--HG--
extra : rebase_source : 6ed6f7be68477fd4a82f07dd2f51c1f1d9b92dcc
2017-09-15 20:04:29 +10:00
Nicholas Nethercote
6061f358d7 Bug 1400193 (part 1) - Fix subtle bug in PLDHashTable's move constructor. r=froydnj.
The current code replaces one PLDHashTable's mGeneration with another. If the
two generation values happen to be equal, it will look as though the storage
hasn't changed when really it has.

The fix is to use EntryStore::Set() to update mEntryStore, which increments
mGeneration appropriately.

--HG--
extra : rebase_source : d1779a143746c8d1a3e67bc3685e703496206b0f
2017-09-15 20:02:33 +10:00
Gerald Squelart
7dbe315e25 Bug 1398999 - nsDequeFunctor::operator() doesn't need to return anything - r=froydnj
Its return value is never used, and most implementations return nullptr anyway.

MozReview-Commit-ID: 8rxC053mmE8

--HG--
extra : rebase_source : 61a0b8b1373396182efd27d3c01b96e5e5541364
2017-02-09 14:06:36 +11:00
Xidorn Quan
306241f7a1 Bug 1397130 - Use signed integer for gUnusedAtomCount. r=froydnj
MozReview-Commit-ID: 9KweZdyu5WF

--HG--
extra : rebase_source : 81981c706fbde89b18168e39b15dee0cbff27cca
2017-09-06 15:06:16 +10:00
Xidorn Quan
749154c86c Bug 1397052 - Add gtest for concurrent accessing. r=froydnj
MozReview-Commit-ID: K3enhwjyGYE

--HG--
extra : rebase_source : 0c714a453e584ba3ceeef7e46e2c13bd6016a179
2017-09-07 10:08:31 +10:00
Nicholas Nethercote
42a8532893 Bug 1396694 (part 2) - Replace nsIAtom.idl with nsIAtom.h. r=froydnj.
Now that nsIAtom is non-scriptable, a .idl file isn't needed.

I made the new nsIAtom.h file by starting with a generated nsIAtom.h file, and
then cleaning it up and removing some stuff that wasn't necessary.

--HG--
extra : rebase_source : 9655fd38984512bd96cf5555048f7774414f6d92
2017-09-05 16:07:32 +10:00
Nicholas Nethercote
4a2bc82d4c Bug 1396694 (part 1) - Make nsIAtom non-scriptable. r=froydnj.
This also lets us remove a couple of IDL methods.

--HG--
extra : rebase_source : a62d3f340c77ae8028e35aa9f01f72c5eadf0ed1
2017-09-05 16:06:43 +10:00
Nicholas Nethercote
d5f5450783 Bug 1392884 - Remove nsIAtomService. r=froydnj.
It's no longer used, and we're in the process of making nsIAtom not usable from
scripts, so we don't want it to be used.
2017-08-25 17:06:58 +10:00
Andrea Marchesini
74a5faef65 Bug 1395140 - Implement "http-on-stop-request" notification, r=mayhemer 2017-09-01 11:55:37 +02:00
Jory A. Pratt
e59d72ca8a Bug 1320560 - Use C99 math isfinite, finite has been depreciated and all modern libc implementations use isfinite. r=froydnj 2017-01-08 11:34:00 -05:00
Nicholas Nethercote
0a0c70a23a Bug 1392881 - Merge StaticAtom and DynamicAtom. r=froydnj.
There's no reason for them to be separate, and we can use the |kind| field to
distinguish the two kinds when necessary.

This lets us remove the duplication of ScriptableToString(), ToUTF8String(),
and ScriptableEquals().

It also lets us use |Atom*| pointers instead of |nsIAtom*| pointers in various
places within nsAtomTable.cpp, which de-virtualizes various calls and removes
the need for some static_casts.

--HG--
extra : rebase_source : 2f9183323446e353f8cc5dcedf57d9dc9a38f0a7
2017-08-24 11:10:04 +10:00
Andrew Osmond
42266555ed Bug 1389479 - Part 1. Add nsExpirationTracker::NotifyEndTransaction(Locked) callbacks for subclasses to know when an aging iteration is complete. r=froydnj 2017-08-15 15:02:14 -04:00
Bevis Tseng
41242cf89a Bug 1367497 - Part 1: Improve Error Handling in {Add|Remove}ObjectLocked(). r=froydnj
MozReview-Commit-ID: 6ecIS6PnVdj

--HG--
extra : source : 0a273c823e19e1048d78f9e6b1ddedf8cc034bd6
2017-05-26 14:36:17 +08:00
Sebastian Hengst
7b4e0b8924 Backed out changeset 0a273c823e19 (bug 1367497) for intermittently crashing in mochitest-chrome-3's layout/style/test/chrome/test_stylesheet_clone_import_rule.html on debug. r=backout 2017-08-15 18:47:29 +02:00
Bevis Tseng
4b1a41e00e Bug 1367497 - Part 1: Improve Error Handling in {Add|Remove}ObjectLocked(). r=froydnj
MozReview-Commit-ID: 6ecIS6PnVdj
2017-05-26 14:36:17 +08:00
Bevis Tseng
b31fd1ee95 Backed out changeset c29f8828b859
--HG--
extra : rebase_source : 4a32c7d30c128dd9041e209c6226030c7fba567c
2017-08-15 10:45:28 +08:00
Bevis Tseng
c12623dcbe Bug 1367497 - Part 1: Improve Error Handling in {Add|Remove}ObjectLocked(). r=froydnj
MozReview-Commit-ID: 6ecIS6PnVdj
2017-05-26 14:36:17 +08:00
Eric Rahm
ee8cbfef96 Bug 1382001 - Part 1: Handle gperf-like preamble in make_dafsa. r=froydnj
This updates make_dafsa.py to include anything preceding the first '%%' in the
generated header.

For example:

> #include <stdint.h>
> const uint64_t kExpiration = UINT64_C(12345);
> %%
> foo.bar.com, 1
> %%

Would generate:

> #include <stdint.h>
> const uint64_t kExpiration = UINT64_C(12345);
>
> const unsigned char kDafsa[] = {
>   ...
> };

MozReview-Commit-ID: 1oR3ssnlUyA
2017-08-11 14:12:03 -07:00
Emilio Cobos Álvarez
9f02c96781 Bug 1362338: Make nsIAtom::AddRef and nsIAtom::Release final. r=froydnj
MozReview-Commit-ID: CFWcSNocGIm

--HG--
extra : rebase_source : 6b8e28f76e2d4fff13f3a89ac68388a0b090bf74
2017-08-09 14:20:17 +02:00
Ryan VanderMeulen
64905fbd5a Backed out changesets 19b8d672b55d and 2980183d98fb (bug 1362338) for hazard analysis failures. 2017-08-09 21:12:28 -04:00
Emilio Cobos Álvarez
ea4858c92f Bug 1362338: followup: Tentatively fix windows build bustage. r=me
Windows apparently uses __stdcall for this, so need to use the ugly macros...

MozReview-Commit-ID: 4J27sCYwdHg
2017-08-09 14:45:37 +02:00
Emilio Cobos Álvarez
300ebe9ee1 Bug 1362338: Make nsIAtom::AddRef and nsIAtom::Release final. r=froydnj
MozReview-Commit-ID: CFWcSNocGIm
2017-08-09 14:20:17 +02:00
Emilio Cobos Álvarez
e99fdbe52e Bug 1362338: Take a bit from the atom's length to store a tristate. r=froydnj
MozReview-Commit-ID: Elu9EioSDXk
2017-08-09 14:19:30 +02:00
Emilio Cobos Álvarez
a7d696a18f Bug 1362338: Preliminary whitespace cleanup in nsIAtom.idl. r=froydnj
MozReview-Commit-ID: DN2tN0OMWEk
2017-08-09 14:18:15 +02:00
Eric Rahm
a750d8eb22 Bug 1380154 - Part 2: Generate a DAFSA and use it for eTLDs. r=jduell
This replaces our giant sorted array of eTLD names with a more compact DAFSA.

MozReview-Commit-ID: 3zMBzUM9QUg
2017-07-17 16:10:18 -07:00
Eric Rahm
65313fd340 Bug 1380154 - Part 1: Add the Chromium DAFSA generator. r=njn
This imports Chromium's `make_dafsa.py` script [1]. It takes in a gperf
formatted file (note: gperf is *not* required) and converts that to a compact
binary representation of the string data in the form of a deterministic
acyclic finite state automaton (DAFSA) [2].

The only change made to the script was to make it handle the arguments our
file generation script passes in to the `main` function.

It also imports the logic for traversing the DAFSA [3] almost verbatim in
`Dafsa.cpp`. A thin wrapper was added so that we can reuse the DAFSA structure
for multiple tables.

The only change made to the original logic was to swap in mozilla style
assertions and rename the not found constant from `kNotFound` to
`Dafsa::kKeyNotFound` in order to avoid a collision with `kNotFound` defined in
our nsString code.

[1] 6ba04a9056/tools/dafsa/make_dafsa.py
[2] https://en.wikipedia.org/wiki/Deterministic_acyclic_finite_state_automaton
[3] a2a90a35aa/net/base/registry_controlled_domains/registry_controlled_domain.cc (72)

MozReview-Commit-ID: Eion9POHZm5
2017-07-17 16:09:42 -07:00
Sebastian Hengst
a26fb8b04b Backed out changeset 9c41f1c5bcb8 (bug 1380154) for debug build bustage at xpcom/tests/gtest/TestExpirationTracker.cpp:83. r=backout on a CLOSED TREE 2017-08-07 21:43:08 +02:00
Sebastian Hengst
d83f1e2d58 Backed out changeset 13cc447a7fde (bug 1380154) 2017-08-07 21:42:14 +02:00