Commit Graph

25 Commits

Author SHA1 Message Date
Brian Birtles
4bf6785250 Bug 1074651 - Detect integer overflow in BaseTimeDuration::TicksFromMilliseconds; r=bz 2014-10-02 15:14:12 +09:00
Brian Birtles
8373a08d48 Bug 1039924 part 3 - Templatize TimeDuration so it can support different behaviors with regards to tick count arithmetic; r=froydnj
This patch prepares the way for having a separate StickyTimeDuration class
by factoring TimeDuration into a templated base class: BaseTimeDuration.
BaseTimeDuration takes a templated parameter, ValueCalculator, which is a helper
object that defines how various arithmetic operations are performed on its
mValue member (an int64_t count of ticks).

This patch does not actually define or use the ValueCalculator parameter yet but
simply performs the renaming and templatization.

With regards to the templatization, arithmetic operators are defined to take
objects with the same ValueCalculator template parameter (so that we don't, for
example, apply non-safe arithmetic to a StickyTimeDuration).
However, comparison operators are defined to also operate on objects with
a different ValueCalculator template parameter since comparison should be
independent of the type of arithmetic used.

Likewise, the constructor and assignment operator are defined to operate on
objects with a different ValueCalculator template parameter so that objects can
be converted from TimeDuration to StickyTimeDuration and vice-versa.
The constructor is marked as explicit, however, so that we don't silently
convert a StickyTimeDuration to a TimeDuration and unwittingly apply
non-safe arithmetic to a StickyTimeDuration.

TimeDuration is defined as a specialization of BaseTimeDuration that uses
TimeDurationValueCalculator as its ValueCalculator type.
TimeDurationValueCalculator is filled-in in a subsequent patch.
2014-09-25 14:25:49 +09:00
Brian Birtles
7a95a86f7b Bug 1039924 part 1 - Separate platform-dependent parts of TimeDuration into TimeDurationPlatformUtils; r=froydnj
In order to have different templated versions of TimeDuration we first split out
the platform-specific code so that this code doesn't need to concern itself with
templates (and because putting template code in .cpp files is messy).
2014-09-25 14:25:48 +09:00
Birunthan Mohanathas
a951c69754 Bug 1022456 - Convert xpcom/ds/ to Gecko style. r=froydnj 2014-07-09 08:15:21 -07:00
Shu-yu Guo
58c41cce91 Bug 989509 - Part 2: dom/, netwerk/, startupcache/, and xpcom/ (r=aklotz,bent,gvselto,mayhemer,Mossop) 2014-04-03 19:29:40 -07:00
Gabriele Svelto
fab6857afe Bug 906754 - Ensure that TimeStamp's static fields are initialized only once. r=froydnj 2013-10-28 20:50:09 +01:00
Birunthan Mohanathas
c09e07a17c Bug 784739 - Switch from NULL to nullptr in xpcom/ (1/3); r=ehsan 2013-10-10 16:41:00 -04:00
Ehsan Akhgari
9cafa40bbe Bug 918105 - Minimize the #includes in xpcom/ds; r=bsmedberg 2013-09-19 15:31:21 -04:00
Gabriele Svelto
42adf2eede Bug 852250 - When restarting recompute the process startup timestamp instead of using the timestamp stored it in MOZ_APP_RESTART during the shutdown procedure. r=nfroyd 2013-07-31 12:51:58 +02:00
Gabriele Svelto
983cbe97cd Bug 793735 - Add functionality to create TimeStamp instances representing the process creation time, r=nfroyd 2013-03-28 11:28:09 +01:00
Nathan Froyd
afb62e15ba Backout 61e1edc0b6bf (bug 793735), 77014412cd4a (bug 793735), and 8c5aa269c3cd (bug 793735) for botching FHR data 2013-04-09 16:25:42 -04:00
Gabriele Svelto
15f3ae0536 Bug 793735 - Add functionality to create TimeStamp instances representing the process creation time, r=froydnj 2013-03-28 11:28:09 +01:00
Honza Bambas
c4a63c79fa Bug 827287 - make it possible to use TimeStamp without performance concerns (TimeStamp::NowLoRes), r=ehsan, sr=roc 2013-02-11 22:56:59 +01:00
Justin Lebar
2b81da6989 No bug: Fix comment in TimeStamp_posix.cpp. DONTBUILD 2012-10-20 11:12:20 -04:00
Ehsan Akhgari
8c296bbcd4 Bug 579517 - Part 1: Automated conversion of NSPR numeric types to stdint types in Gecko; r=bsmedberg
This patch was generated by a script.  Here's the source of the script for
future reference:

function convert() {
echo "Converting $1 to $2..."
find . ! -wholename "*nsprpub*" \
       ! -wholename "*security/nss*" \
       ! -wholename "*/.hg*" \
       ! -wholename "obj-ff-dbg*" \
       ! -name nsXPCOMCID.h \
       ! -name prtypes.h \
         -type f \
      \( -iname "*.cpp" \
         -o -iname "*.h" \
         -o -iname "*.c" \
         -o -iname "*.cc" \
         -o -iname "*.idl" \
         -o -iname "*.ipdl" \
         -o -iname "*.ipdlh" \
         -o -iname "*.mm" \) | \
    xargs -n 1 sed -i -e "s/\b$1\b/$2/g"
}

convert PRInt8 int8_t
convert PRUint8 uint8_t
convert PRInt16 int16_t
convert PRUint16 uint16_t
convert PRInt32 int32_t
convert PRUint32 uint32_t
convert PRInt64 int64_t
convert PRUint64 uint64_t

convert PRIntn int
convert PRUintn unsigned

convert PRSize size_t

convert PROffset32 int32_t
convert PROffset64 int64_t

convert PRPtrdiff ptrdiff_t

convert PRFloat64 double
2012-08-22 11:56:38 -04:00
Gervase Markham
87620f5676 Bug 716478 - update licence to MPL 2. 2012-05-21 12:12:37 +01:00
Ehsan Akhgari
2a602a5685 Bug 690892 - Replace PR_TRUE/PR_FALSE with true/false on mozilla-central; rs=dbaron
Landing on a CLOSED TREE
2011-10-17 10:59:28 -04:00
Michael Wu
d8e503c38b Bug 675553 - Switch from PRBool to bool on a CLOSED TREE , r=bsmedberg,khuey,bz,cjones
--HG--
rename : tools/trace-malloc/bloatblame.c => tools/trace-malloc/bloatblame.cpp
2011-09-28 23:19:26 -07:00
Boris Zbarsky
8a5a8c7f9e Bug 558306 part 1.5. Make TimeDuration::FromMilliseconds take a double. r=cjones, sr=roc 2010-07-21 15:57:33 -04:00
Chris Jones
593697156c Bug 576467: Check the return value of clock_getres(). r=roc 2010-07-15 14:27:43 -05:00
Ginn Chen
3afa89d964 revert 43e12453336f, it was fixed by another changeset 2010-04-28 17:44:24 +08:00
Ginn Chen
314bd364fe Bug 560717 Linux FPE running make check r=bsmedberg 2010-04-28 17:40:03 +08:00
Vladimir Vukicevic
838f1fb2ff b=560717; fix TimeStamp initialization in TimeStamp_posix; r=bsmedberg 2010-04-26 14:26:40 -07:00
Chris Jones
5e03f750df Bug 541185: Fall back on clock_getres() when resolution detection fails, and remove bogus upper-bound sanity check. r=roc 2010-03-01 15:44:05 -06:00
Chris Jones
1399b2b545 Bug 522126, part 2: Add a POSIX clock (CLOCK_MONOTONIC) implementation of TimeStamp/TimeDuration. r=roc 2010-01-07 11:21:28 -06:00