intl/icu/source/common/uinit.cpp

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 (C) 2001-2013, International Business Machines
michael@0 4 * Corporation and others. All Rights Reserved.
michael@0 5 ******************************************************************************
michael@0 6 * file name: uinit.cpp
michael@0 7 * encoding: US-ASCII
michael@0 8 * tab size: 8 (not used)
michael@0 9 * indentation:4
michael@0 10 *
michael@0 11 * created on: 2001July05
michael@0 12 * created by: George Rhoten
michael@0 13 */
michael@0 14
michael@0 15 #include "unicode/utypes.h"
michael@0 16 #include "unicode/icuplug.h"
michael@0 17 #include "unicode/uclean.h"
michael@0 18 #include "cmemory.h"
michael@0 19 #include "icuplugimp.h"
michael@0 20 #include "ucln_cmn.h"
michael@0 21 #include "ucnv_io.h"
michael@0 22 #include "umutex.h"
michael@0 23 #include "utracimp.h"
michael@0 24
michael@0 25 U_NAMESPACE_BEGIN
michael@0 26
michael@0 27 static UInitOnce gICUInitOnce = U_INITONCE_INITIALIZER;
michael@0 28
michael@0 29 static UBool U_CALLCONV uinit_cleanup() {
michael@0 30 gICUInitOnce.reset();
michael@0 31 return TRUE;
michael@0 32 }
michael@0 33
michael@0 34 static void U_CALLCONV
michael@0 35 initData(UErrorCode &status)
michael@0 36 {
michael@0 37 /* initialize plugins */
michael@0 38 uplug_init(&status);
michael@0 39
michael@0 40 #if !UCONFIG_NO_CONVERSION
michael@0 41 /*
michael@0 42 * 2005-may-02
michael@0 43 *
michael@0 44 * ICU4C 3.4 (jitterbug 4497) hardcodes the data for Unicode character
michael@0 45 * properties for APIs that want to be fast.
michael@0 46 * Therefore, we need not load them here nor check for errors.
michael@0 47 * Instead, we load the converter alias table to see if any ICU data
michael@0 48 * is available.
michael@0 49 * Users should really open the service objects they need and check
michael@0 50 * for errors there, to make sure that the actual items they need are
michael@0 51 * available.
michael@0 52 */
michael@0 53 ucnv_io_countKnownConverters(&status);
michael@0 54 #endif
michael@0 55 ucln_common_registerCleanup(UCLN_COMMON_UINIT, uinit_cleanup);
michael@0 56 }
michael@0 57
michael@0 58 /*
michael@0 59 * ICU Initialization Function. Need not be called.
michael@0 60 */
michael@0 61 U_CAPI void U_EXPORT2
michael@0 62 u_init(UErrorCode *status) {
michael@0 63 UTRACE_ENTRY_OC(UTRACE_U_INIT);
michael@0 64 umtx_initOnce(gICUInitOnce, &initData, *status);
michael@0 65 UTRACE_EXIT_STATUS(*status);
michael@0 66 }
michael@0 67
michael@0 68 U_NAMESPACE_END

mercurial