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.

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

mercurial