gfx/skia/trunk/include/core/SkTime.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.

     2 /*
     3  * Copyright 2006 The Android Open Source Project
     4  *
     5  * Use of this source code is governed by a BSD-style license that can be
     6  * found in the LICENSE file.
     7  */
    10 #ifndef SkTime_DEFINED
    11 #define SkTime_DEFINED
    13 #include "SkTypes.h"
    15 /** \class SkTime
    16     Platform-implemented utilities to return time of day, and millisecond counter.
    17 */
    18 class SkTime {
    19 public:
    20     struct DateTime {
    21         uint16_t fYear;          //!< e.g. 2005
    22         uint8_t  fMonth;         //!< 1..12
    23         uint8_t  fDayOfWeek;     //!< 0..6, 0==Sunday
    24         uint8_t  fDay;           //!< 1..31
    25         uint8_t  fHour;          //!< 0..23
    26         uint8_t  fMinute;        //!< 0..59
    27         uint8_t  fSecond;        //!< 0..59
    28     };
    29     static void GetDateTime(DateTime*);
    31     static SkMSec GetMSecs();
    32 };
    34 #if defined(SK_DEBUG) && defined(SK_BUILD_FOR_WIN32)
    35     extern SkMSec gForceTickCount;
    36 #endif
    38 #define SK_TIME_FACTOR      1
    40 ///////////////////////////////////////////////////////////////////////////////
    42 class SkAutoTime {
    43 public:
    44     // The label is not deep-copied, so its address must remain valid for the
    45     // lifetime of this object
    46     SkAutoTime(const char* label = NULL, SkMSec minToDump = 0) : fLabel(label)
    47     {
    48         fNow = SkTime::GetMSecs();
    49         fMinToDump = minToDump;
    50     }
    51     ~SkAutoTime()
    52     {
    53         SkMSec dur = SkTime::GetMSecs() - fNow;
    54         if (dur >= fMinToDump) {
    55             SkDebugf("%s %d\n", fLabel ? fLabel : "", dur);
    56         }
    57     }
    58 private:
    59     const char* fLabel;
    60     SkMSec      fNow;
    61     SkMSec      fMinToDump;
    62 };
    63 #define SkAutoTime(...) SK_REQUIRE_LOCAL_VAR(SkAutoTime)
    65 #endif

mercurial