gfx/skia/trunk/include/utils/win/SkHRESULT.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 * Copyright 2011 Google Inc.
michael@0 3 *
michael@0 4 * Use of this source code is governed by a BSD-style license that can be
michael@0 5 * found in the LICENSE file.
michael@0 6 */
michael@0 7
michael@0 8 #ifndef SkHRESULT_DEFINED
michael@0 9 #define SkHRESULT_DEFINED
michael@0 10
michael@0 11 #include "SkTypes.h"
michael@0 12
michael@0 13 void SkTraceHR(const char* file, unsigned long line,
michael@0 14 HRESULT hr, const char* msg);
michael@0 15
michael@0 16 #ifdef SK_DEBUG
michael@0 17 #define SK_TRACEHR(_hr, _msg) SkTraceHR(__FILE__, __LINE__, _hr, _msg)
michael@0 18 #else
michael@0 19 #define SK_TRACEHR(_hr, _msg) _hr
michael@0 20 #endif
michael@0 21
michael@0 22 #define HR_GENERAL(_ex, _msg, _ret) {\
michael@0 23 HRESULT _hr = _ex;\
michael@0 24 if (FAILED(_hr)) {\
michael@0 25 SK_TRACEHR(_hr, _msg);\
michael@0 26 return _ret;\
michael@0 27 }\
michael@0 28 }
michael@0 29
michael@0 30 //@{
michael@0 31 /**
michael@0 32 These macros are for reporting HRESULT errors.
michael@0 33 The expression will be evaluated.
michael@0 34 If the resulting HRESULT SUCCEEDED then execution will continue normally.
michael@0 35 If the HRESULT FAILED then the macro will return from the current function.
michael@0 36 In variants ending with 'M' the given message will be traced when FAILED.
michael@0 37 The HR variants will return the HRESULT when FAILED.
michael@0 38 The HRB variants will return false when FAILED.
michael@0 39 The HRN variants will return NULL when FAILED.
michael@0 40 The HRV variants will simply return when FAILED.
michael@0 41 The HRZ variants will return 0 when FAILED.
michael@0 42 */
michael@0 43 #define HR(ex) HR_GENERAL(ex, NULL, _hr)
michael@0 44 #define HRM(ex, msg) HR_GENERAL(ex, msg, _hr)
michael@0 45
michael@0 46 #define HRB(ex) HR_GENERAL(ex, NULL, false)
michael@0 47 #define HRBM(ex, msg) HR_GENERAL(ex, msg, false)
michael@0 48
michael@0 49 #define HRN(ex) HR_GENERAL(ex, NULL, NULL)
michael@0 50 #define HRNM(ex, msg) HR_GENERAL(ex, msg, NULL)
michael@0 51
michael@0 52 #define HRV(ex) HR_GENERAL(ex, NULL, )
michael@0 53 #define HRVM(ex, msg) HR_GENERAL(ex, msg, )
michael@0 54
michael@0 55 #define HRZ(ex) HR_GENERAL(ex, NULL, 0)
michael@0 56 #define HRZM(ex, msg) HR_GENERAL(ex, msg, 0)
michael@0 57 //@}
michael@0 58 #endif

mercurial