xpcom/ds/TimeStamp_windows.h

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

     1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     2 /* vim:set ts=2 sw=2 sts=2 et cindent: */
     3 /* This Source Code Form is subject to the terms of the Mozilla Public
     4  * License, v. 2.0. If a copy of the MPL was not distributed with this
     5  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     7 #ifndef mozilla_TimeStamp_windows_h
     8 #define mozilla_TimeStamp_windows_h
    10 namespace mozilla {
    12 class TimeStamp;
    14 class TimeStampValue
    15 {
    16   friend struct IPC::ParamTraits<mozilla::TimeStampValue>;
    17   friend class TimeStamp;
    18   friend void StartupTimelineRecordExternal(int, uint64_t);
    20   // Both QPC and GTC are kept in [mt] units.
    21   uint64_t mGTC;
    22   uint64_t mQPC;
    23   bool mHasQPC;
    24   bool mIsNull;
    26   TimeStampValue(uint64_t GTC, uint64_t QPC, bool hasQPC);
    28   uint64_t CheckQPC(const TimeStampValue &aOther) const;
    30   struct _SomethingVeryRandomHere;
    31   MOZ_CONSTEXPR TimeStampValue(_SomethingVeryRandomHere* nullValue)
    32     : mGTC(0), mQPC(0), mHasQPC(false), mIsNull(true) {}
    35 public:
    36   uint64_t operator-(const TimeStampValue &aOther) const;
    38   TimeStampValue operator+(const int64_t aOther) const
    39     { return TimeStampValue(mGTC + aOther, mQPC + aOther, mHasQPC); }
    40   TimeStampValue operator-(const int64_t aOther) const
    41     { return TimeStampValue(mGTC - aOther, mQPC - aOther, mHasQPC); }
    42   TimeStampValue& operator+=(const int64_t aOther);
    43   TimeStampValue& operator-=(const int64_t aOther);
    45   bool operator<(const TimeStampValue &aOther) const
    46     { return int64_t(*this - aOther) < 0; }
    47   bool operator>(const TimeStampValue &aOther) const
    48     { return int64_t(*this - aOther) > 0; }
    49   bool operator<=(const TimeStampValue &aOther) const
    50     { return int64_t(*this - aOther) <= 0; }
    51   bool operator>=(const TimeStampValue &aOther) const
    52     { return int64_t(*this - aOther) >= 0; }
    53   bool operator==(const TimeStampValue &aOther) const
    54     { return int64_t(*this - aOther) == 0; }
    55   bool operator!=(const TimeStampValue &aOther) const
    56     { return int64_t(*this - aOther) != 0; }
    57 };
    59 }
    61 #endif /* mozilla_TimeStamp_h */

mercurial