Commit graph

67 commits

Author SHA1 Message Date
Milan Sreckovic
62671480ab Bug 1364146: Only reset the prefs dirty flag when we save to the default prefs file, not on a save to another file. r=bsmedberg
MozReview-Commit-ID: ITskObzuTTb

--HG--
extra : rebase_source : 20ae4d707b6a517ee7741dd5dcb7867bc2059db2
2017-05-16 13:10:40 -04:00
Ehsan Akhgari
35235d7ca2 Bug 1361842 - Add a profiler pseudo label to detect writes to the prefs DB more easily for BHR; r=froydnj 2017-05-03 18:32:08 -04:00
Masatoshi Kimura
81f44024c4 Bug 1353936 - Use PREF_RegisterPriorityCallback from Add*VarCache. r=froydnj
MozReview-Commit-ID: LOxPTBqol9X

--HG--
extra : rebase_source : a91abf88ac69c4b402d04795ed8bbadadcbea3e9
2017-04-12 00:17:52 +09:00
Eric Rahm
200e538796 Bug 1354613 - Part 3: Stop mutating the pref branch name when retrieving it. r=froydnj
This adds a PrefName wrapper that allows use to avoid copying the pref name
string in the fast root pref branch case, but also allows to create a new
string in the slower non-root pref branch case. By creating a new string we
avoid the odd behavior of mutating the pref branch name with each retrieval.

MozReview-Commit-ID: HGCLbpGmKrr
2017-04-11 14:00:19 -07:00
Nathan Froyd
d337918230 Bug 1355097 - adjust asserts in Preferences::InitStaticMembers to account for Stylo; r=Manishearth 2017-04-11 09:39:32 -04:00
Boris Zbarsky
7525ff0157 Bug 1343677 part 1. Add a way to get the current preferences init phase in debug builds. r=billm
MozReview-Commit-ID: JtHhLuFDu2d
2017-03-16 17:43:17 -04:00
Brad Lassey
9e864be6a5 bug 1341414 - Functions like GetBoolVarCache shouldn't assert when used early in startup r=billm 2017-02-21 22:17:52 -05:00
Brad Lassey
a5e07b93bf bug 1303096 - Stop sending sync messages soon after content process start-up r=billm 2017-02-05 00:52:38 -05:00
Sebastian Hengst
122ebc553b Backed out changeset e9d8a75a0dcc (bug 1303096) for failing various tests on Android 4.3 debug (e.g. test_saveHeapSnapshot_e10s_01.html). r=backout 2017-02-05 10:26:28 +01:00
Brad Lassey
ecdf363246 bug 1303096 - Stop sending sync messages soon after content process start-up r=billm 2017-02-05 00:52:38 -05:00
Nicholas Nethercote
c2306345d5 Bug 1297658 - Avoid unnecessary checking in memory reporters. r=erahm.
This patch removes checking of all the callback calls in memory reporter
CollectReport() functions, because it's not useful.

The patch also does some associated clean-up.

- Replaces some uses of nsIMemoryReporterCallback with the preferred
  nsIHandleReportCallback typedef.

- Replaces aCallback/aCb/aClosure with aHandleRepor/aData for CollectReports()
  parameter names, for consistency.

- Adds MOZ_MUST_USE/[must_use] in a few places in nsIMemoryReporter.idl.

- Uses the MOZ_COLLECT_REPORT macro in all suitable places.

Overall the patch reduces code size by ~300 lines and reduces the size of
libxul by about 37 KiB on my Linux64 builds.

--HG--
extra : rebase_source : e94323614bd10463a0c5134a7276238a7ca1cf23
2016-08-24 15:23:45 +10:00
Nicholas Nethercote
e7f10a07fd Bug 1293603 (part 2) - Make Run() declarations consistent. r=erahm.
This patch makes most Run() declarations in subclasses of nsIRunnable have the
same form: |NS_IMETHOD Run() override|.

As a result of these changes, I had to add |override| to a couple of other
functions to satisfy clang's -Winconsistent-missing-override warning.

--HG--
extra : rebase_source : 815d0018b0b13329bb5698c410f500dddcc3ee12
2016-08-08 12:18:10 +10:00
Milan Sreckovic
f49db94bcc Bug 1287945: Return the number of modified/filled preferences and use it for subsequent operations. r=aklotz 2016-07-19 15:10:00 +02:00
Milan Sreckovic
8d2fafb036 Bug 1287215: Replace preferences gDirty global with a callback. r=aklotz,Gijs
MozReview-Commit-ID: 7m5d5ddMTva

--HG--
extra : rebase_source : 6561ded096d914ca6b87d8eeda785538bbc225ac
2016-07-21 15:46:15 -04:00
David Anderson
d1ac63e903 Don't initialize gfxPrefs with libpref in the GPU process. (bug 1280822 part 1, r=milan) 2016-06-26 23:33:14 -07:00
Wes Kocher
1587b12aa9 Backed out 4 changesets (bug 1280822) for leaking nsTArray_base
Backed out changeset b9a0567cd7c1 (bug 1280822)
Backed out changeset 93d483583ffa (bug 1280822)
Backed out changeset 91715d8e468f (bug 1280822)
Backed out changeset 3db77f57cef4 (bug 1280822)
2016-06-24 14:43:41 -07:00
David Anderson
3d57c3eefa Don't initialize gfxPrefs with libpref in the GPU process. (bug 1280822 part 1, r=milan)
--HG--
extra : rebase_source : abe16841b668fb899b69f3ea9d941d5edb68ed21
2016-06-24 16:14:45 -07:00
Andrew McCreight
f9c73e6cf3 Bug 1272707, part 2 - Limit the size of preference values sent to child processes. r=bsmedberg
Don't send any preferences that have a string value that is longer
than MAX_ADVISABLE_PREF_LENGTH. This is intended to mitigate OOM
issues, as I've seen a parent process crash trying to create a 100mb
message to send to the child. Such users likely cannot use e10s at
all.

This has a test for all combinations of setting the default and user
values of a preference to large or small string values, or not setting
them at all.

I manually verified that filtering out preferences reduces the size of
the IPC::Message that is sent to the child by printing out the size of
the reply message in PContentParent::OnMessageReceived().
2016-05-17 07:55:49 -07:00
Matt Woodrow
6451cce121 Bug 1267868 - Make AddXXXVarCache only match exact prefs, not prefixes. r=froydnj 2016-05-04 12:26:04 +12:00
Kyle Huey
c73656947b Bug 1265927: Move nsRunnable to mozilla::Runnable, CancelableRunnable to mozilla::CancelableRunnable. r=froydnj 2016-04-25 17:23:21 -07:00
Milan Sreckovic
779e30cf76 Bug 278878: Send preference parsing errors to browser console. r=bsmedberg
MozReview-Commit-ID: 61mi71dZbO8

--HG--
extra : rebase_source : 87e32940aa557acd809ba0753fda08caf70ed0f9
2016-04-22 15:35:01 -04:00
Julian Seward
96a413ffed Bug 1248915 - TSan: data race on global 'mozilla::net::CacheObserver::sDiskCacheCapacity'. r=honzab.moz, n.nethercote. 2016-03-20 10:08:57 +01:00
Milan Sreckovic
eefe011285 Bug 1249157 - prefapi enums into class enums, explicit conversion, cleanup. r=bsmedberg 2016-02-22 09:15:00 +01:00
Wes Kocher
952924118d Backed out changeset dd911452e3f7 (bug 1249157) for build bustage CLOSED TREE
--HG--
extra : commitid : 9S2zNfX2mUX
2016-02-22 09:05:21 -08:00
Milan Sreckovic
3336950f44 Bug 1249157: prefapi enums into class enums, explicit conversion, cleanup. r=bsmedberg
MozReview-Commit-ID: nvvOD8ajV4

--HG--
extra : rebase_source : cbdaea69100559893e8386c3618a5594ff38433d
2016-02-18 13:27:06 -05:00
Nicholas Nethercote
9fed28582d Bug 1245393 - Measure s{,Default}RootBranch in the Preferences memory reporter. r=froydnj. 2016-02-03 17:30:54 +11:00
Nicholas Nethercote
b80cb9f1e0 Bug 1244982 - Fix minor double-reporting of memory in prefs code. r=erahm.
--HG--
extra : rebase_source : 3d93515169f0355aeb6ac074d13564bfedec2b57
2016-02-02 14:31:49 +11:00
Nathan Froyd
ddf1ea7512 Bug 1233234 - part 3 - clean up UniquePtr usage in WritePrefFile; r=njn
We shouldn't use .get() on UniquePtr<T[]> unless we have to, and it
makes the code clearer to not use pointer incrementing in any event.
2015-12-06 09:11:55 -05:00
Nathan Froyd
b88ea2e0d7 Bug 1233234 - part 2 - use UniquePtr<T[]> instead of nsAutoArrayPtr<T> in pref_savePrefs; r=njn
Returning outparams with UniquePtr is not convenient or idiomatic, so in
addition to removing nsAutoArrayPtr usage, let's return a UniquePtr from
the function directly.
2015-12-06 09:06:02 -05:00
Nathan Froyd
bd9c024bdb Bug 1233234 - part 1 - use UniquePtr<T[]> instead of nsAutoArrayPtr<T> in openPrefFile; r=njn 2015-12-06 08:13:36 -05:00
Birunthan Mohanathas
1cc56207d5 Bug 1227569 - Remove unsupported OpenVMS code. r=mccr8 2015-12-18 15:02:50 +02:00
Nicholas Nethercote
7e4bd1e0e1 Bug 1187152 (part 3) - Replace nsBaseHashtable::Enumerate() calls in modules/ with iterators. r=froydnj. 2015-11-22 18:52:40 -08:00
Nathan Froyd
65fd1f7783 Bug 1219310 - part 2 - keep track of how much pref file we have read; r=njn
Looking at a preference file read with strace typically looks like:

open("...", O_RDONLY) = X
...
read(X, "...", SIZE) = SIZE
read(X, "...", SIZE) = 0
...

There's no reason to call Read() and make another syscall to determine
there's no data left for reading.  We can keep track of how much we've
read at minimal cost and thus determine for ourselves when we are done.
2015-10-28 12:19:03 -04:00
Nathan Froyd
17b7d5be31 Bug 1219310 - part 1 - ask the prefs file for its size directly; r=njn
Calling nsIInputStream::Available on nsIFileInputStreams is relatively
expensive, as it requires three system calls: one to determine the
current file position, one to seek to the end file position, and one to
rewind to the previous file position.

We can do better by asking the file for its size directly, prior to
opening the stream.  This only requires one system call, stat, and is
thus superior--at least in considering the number of system calls.
2015-10-28 12:16:33 -04: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
Xidorn Quan
f062c6a861 Bug 1213123 - Make Preferences::SetString accept char16ptr_t instead of char16_t*. r=froydnj
--HG--
extra : source : 201ba51e2d2c674f3b6088ac255e2e6331d1a162
2015-10-10 12:19:23 +11:00
Nicholas Nethercote
647b520991 Bug 1201135 - Rename pldhash.{h,cpp} to PLDHashTable.{h,cpp}. r=mccr8.
--HG--
rename : xpcom/glue/pldhash.cpp => xpcom/glue/PLDHashTable.cpp
rename : xpcom/glue/pldhash.h => xpcom/glue/PLDHashTable.h
extra : rebase_source : 06b9d30db96ed78500fd44d9c0b51609103508a3
2015-09-15 20:49:53 -07:00
Nicholas Nethercote
d98d14fa1e Bug 1189156 (part 4) - Don't use enumeration style for nsBaseHashtable::SizeOf{In,Ex}cludingThis(). r=erahm,jfkthame.
After this change, we have ShallowSizeOf{In,Ex}cludingThis(), which don't do
anything to measure children. (They can be combined with iteration to measure
children.)

--HG--
extra : rebase_source : f98420176f50990bbc5a25e35788328154cfeb00
2015-07-30 21:19:57 -07:00
Nicholas Nethercote
2d56c1f52e Bug 1189156 (part 1) - Don't use enumeration style for PLDHashTable::SizeOf{In,Ex}cludingThis(). r=froydnj.
After this change, we have PLDHashTable::ShallowSizeOf{In,Ex}cludingThis(),
which don't do anything to measure children. (They can be combined with
iteration to measure children.)

This patch also removes the PL_DHashTableSizeOf{In,Ex}cludingThis() functions.
They're not necessary because the methods can be used instead.

Finally, the patch deliberately converts some SizeOfExcludingThis() calls to
SizeOfIncludingThis(). These are all done on heap pointers so this change is
valid.

--HG--
extra : rebase_source : b1d51096a8e7dcac29d7efd92e28938836ff5481
2015-07-29 22:28:20 -07:00
Nicholas Nethercote
87b80f8c66 Bug 1188745 - Rename nsTArray::SizeOfExcludingThis() as ShallowSizeOfExcludingThis(). r=froydnj.
This makes it clearer that, unlike how SizeOf*() functions usually work, this
doesn't measure any children hanging off the array.

And do likewise for nsTObserverArray.

--HG--
extra : rebase_source : 6a8c8d8ffb53ad51b5773afea77126cdd767f149
2015-07-28 23:24:24 -07:00
Birunthan Mohanathas
a8939590de Bug 1182996 - Fix and add missing namespace comments. rs=ehsan
The bulk of this commit was generated by running:

  run-clang-tidy.py \
    -checks='-*,llvm-namespace-comment' \
    -header-filter=^/.../mozilla-central/.* \
    -fix
2015-07-13 08:25:42 -07:00
Emanuel Hoogeveen
7d1e52f2ff Bug 905127 - Part 1 - Make some functions from nsNetUtil not inline. r=jduell 2015-07-07 04:17:00 +02:00
Juan Gomez
258ad59e3f Bug 1171931 - Refactor duplicated code using XRE_IsParent/ContentProcess. r=froydnj 2015-07-03 18:29:00 -07:00
Nicholas Nethercote
a38880a83a Bug 1176159 (part 2) - Remove uses of PL_DHashTableEnumerate() from libpref. r=bsmedberg.
--HG--
extra : rebase_source : 15488918c1d6b4f7cc994016485d0619061d51a9
2015-06-18 17:58:24 -07:00
Nicholas Nethercote
7320c1e183 Bug 1176159 (part 1) - Remove pref_SaveTypes. r=bsmedberg.
Because SAVE_ALL is the only value ever used.

--HG--
extra : rebase_source : fbbb49dc8cc5051913d62102581db86a1fa8db49
2015-06-18 16:44:35 -07:00
Ryan VanderMeulen
5f5c327690 Backed out changeset 8b4e4083639e (bug 1171931) for B2G debug emulator bustage. 2015-06-25 19:48:42 -04:00
Juan Gomez
702a59d135 Bug 1171931 - Refactor duplicated code using XRE_IsParent/ContentProcess. r=froydnj
--HG--
extra : rebase_source : 2ecbe6c1dd8a7ad8dc529b53349ad431cf1116c9
2015-06-24 14:11:00 -04:00
Nicholas Nethercote
638d83d097 Bug 1171309 - Remove PREF_Init()'s return value. r=bsmedberg.
This is now possible because PLDHashTable initialization is infallible.

--HG--
extra : rebase_source : 395605d27234d97f52125aa78b9446614649ffec
2015-06-04 16:14:48 -07:00
Nicholas Nethercote
86da9069cd Bug 1165768 (part 7) - Convert |gHashTable| to |PLDHashTable2*|. r=froydnj.
--HG--
extra : rebase_source : 26bab7a5ffdc8759d3391288d80552e44ccd6138
2015-05-18 00:52:08 -07:00
Nicholas Nethercote
eab9ff6d25 Back out all four patches from bug 1161377. r=me.
Due to Android startup regressions (bug 1163066) and plugin crashes (bug
1165155).

--HG--
extra : rebase_source : 380f79e67dff4c4eaa2614f286a4d0669666b652
2015-05-14 21:48:43 -07:00