Tue, 06 Jan 2015 21:39:09 +0100
Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.
michael@0 | 1 | /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*- |
michael@0 | 2 | * This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 5 | /* This file is based on a header file that was briefly seen in the |
michael@0 | 6 | * Windows 8 RC SDK. The work for this file itself was based on the one in ProcessHacker at |
michael@0 | 7 | * http://processhacker.svn.sourceforge.net/viewvc/processhacker/2.x/trunk/plugins/ExtendedTools/d3dkmt.h?revision=4758&view=markup |
michael@0 | 8 | * For more details see Mozilla Bug 689870. |
michael@0 | 9 | * [Bug 917496 indicates that some of these structs may not match reality, and |
michael@0 | 10 | * therefore should not be trusted. See the reference to bug 917496 in |
michael@0 | 11 | * gfxWindowsPlatform.cpp.] |
michael@0 | 12 | */ |
michael@0 | 13 | |
michael@0 | 14 | typedef struct _D3DKMTQS_COUNTER |
michael@0 | 15 | { |
michael@0 | 16 | ULONG Count; |
michael@0 | 17 | ULONGLONG Bytes; |
michael@0 | 18 | } D3DKMTQS_COUNTER; |
michael@0 | 19 | |
michael@0 | 20 | typedef struct _D3DKMTQS_ADAPTER_INFO |
michael@0 | 21 | { |
michael@0 | 22 | ULONG NbSegments; |
michael@0 | 23 | |
michael@0 | 24 | ULONG Filler[4]; |
michael@0 | 25 | ULONGLONG Filler2[2]; // Assumed sizeof(LONGLONG) = sizeof(ULONGLONG) |
michael@0 | 26 | struct { |
michael@0 | 27 | ULONG Filler[14]; |
michael@0 | 28 | } Filler_RDMAB; |
michael@0 | 29 | struct { |
michael@0 | 30 | ULONG Filler[9]; |
michael@0 | 31 | } Filler_R; |
michael@0 | 32 | struct { |
michael@0 | 33 | ULONG Filler[4]; |
michael@0 | 34 | D3DKMTQS_COUNTER Filler2; |
michael@0 | 35 | } Filler_P; |
michael@0 | 36 | struct { |
michael@0 | 37 | D3DKMTQS_COUNTER Filler[16]; |
michael@0 | 38 | ULONG Filler2[2]; |
michael@0 | 39 | } Filler_PF; |
michael@0 | 40 | struct { |
michael@0 | 41 | ULONGLONG Filler[8]; |
michael@0 | 42 | } Filler_PT; |
michael@0 | 43 | struct { |
michael@0 | 44 | ULONG Filler[2]; |
michael@0 | 45 | } Filler_SR; |
michael@0 | 46 | struct { |
michael@0 | 47 | ULONG Filler[7]; |
michael@0 | 48 | } Filler_L; |
michael@0 | 49 | struct { |
michael@0 | 50 | D3DKMTQS_COUNTER Filler[7]; |
michael@0 | 51 | } Filler_A; |
michael@0 | 52 | struct { |
michael@0 | 53 | D3DKMTQS_COUNTER Filler[4]; |
michael@0 | 54 | } Filler_T; |
michael@0 | 55 | ULONG64 Reserved[8]; |
michael@0 | 56 | } D3DKMTQS_ADAPTER_INFO; |
michael@0 | 57 | |
michael@0 | 58 | typedef struct _D3DKMTQS_SEGMENT_INFO_WIN7 |
michael@0 | 59 | { |
michael@0 | 60 | ULONG Filler[3]; |
michael@0 | 61 | struct { |
michael@0 | 62 | ULONGLONG Filler; |
michael@0 | 63 | ULONG Filler2[2]; |
michael@0 | 64 | } Filler_M; |
michael@0 | 65 | |
michael@0 | 66 | ULONG Aperture; |
michael@0 | 67 | |
michael@0 | 68 | ULONGLONG Filler3[5]; |
michael@0 | 69 | ULONG64 Filler4[8]; |
michael@0 | 70 | } D3DKMTQS_SEGMENT_INFO_WIN7; |
michael@0 | 71 | |
michael@0 | 72 | typedef struct _D3DKMTQS_SEGMENT_INFO_WIN8 |
michael@0 | 73 | { |
michael@0 | 74 | ULONGLONG Filler[3]; |
michael@0 | 75 | struct { |
michael@0 | 76 | ULONGLONG Filler; |
michael@0 | 77 | ULONG Filler2[2]; |
michael@0 | 78 | } Filler_M; |
michael@0 | 79 | |
michael@0 | 80 | ULONG Aperture; |
michael@0 | 81 | |
michael@0 | 82 | ULONGLONG Filler3[5]; |
michael@0 | 83 | ULONG64 Filler4[8]; |
michael@0 | 84 | } D3DKMTQS_SEGMENT_INFO_WIN8; |
michael@0 | 85 | |
michael@0 | 86 | typedef struct _D3DKMTQS_SYSTEM_MEMORY |
michael@0 | 87 | { |
michael@0 | 88 | ULONGLONG BytesAllocated; |
michael@0 | 89 | ULONG Filler[2]; |
michael@0 | 90 | ULONGLONG Filler2[7]; |
michael@0 | 91 | } D3DKMTQS_SYSTEM_MEMORY; |
michael@0 | 92 | |
michael@0 | 93 | typedef struct _D3DKMTQS_PROCESS_INFO |
michael@0 | 94 | { |
michael@0 | 95 | ULONG Filler[2]; |
michael@0 | 96 | struct { |
michael@0 | 97 | ULONGLONG BytesAllocated; |
michael@0 | 98 | |
michael@0 | 99 | ULONG Filler[2]; |
michael@0 | 100 | ULONGLONG Filler2[7]; |
michael@0 | 101 | } SystemMemory; |
michael@0 | 102 | ULONG64 Reserved[8]; |
michael@0 | 103 | } D3DKMTQS_PROCESS_INFO; |
michael@0 | 104 | |
michael@0 | 105 | typedef struct _D3DKMTQS_PROCESS_SEGMENT_INFO |
michael@0 | 106 | { |
michael@0 | 107 | union { |
michael@0 | 108 | struct { |
michael@0 | 109 | ULONGLONG BytesCommitted; |
michael@0 | 110 | } Win8; |
michael@0 | 111 | struct { |
michael@0 | 112 | ULONG BytesCommitted; |
michael@0 | 113 | ULONG UnknownRandomness; |
michael@0 | 114 | } Win7; |
michael@0 | 115 | }; |
michael@0 | 116 | |
michael@0 | 117 | ULONGLONG Filler[2]; |
michael@0 | 118 | ULONG Filler2; |
michael@0 | 119 | struct { |
michael@0 | 120 | ULONG Filler; |
michael@0 | 121 | D3DKMTQS_COUNTER Filler2[6]; |
michael@0 | 122 | ULONGLONG Filler3; |
michael@0 | 123 | } Filler3; |
michael@0 | 124 | struct { |
michael@0 | 125 | ULONGLONG Filler; |
michael@0 | 126 | } Filler4; |
michael@0 | 127 | ULONG64 Reserved[8]; |
michael@0 | 128 | } D3DKMTQS_PROCESS_SEGMENT_INFO; |
michael@0 | 129 | |
michael@0 | 130 | typedef enum _D3DKMTQS_TYPE |
michael@0 | 131 | { |
michael@0 | 132 | D3DKMTQS_ADAPTER = 0, |
michael@0 | 133 | D3DKMTQS_PROCESS = 1, |
michael@0 | 134 | D3DKMTQS_SEGMENT = 3, |
michael@0 | 135 | D3DKMTQS_PROCESS_SEGMENT = 4, |
michael@0 | 136 | } D3DKMTQS_TYPE; |
michael@0 | 137 | |
michael@0 | 138 | typedef union _D3DKMTQS_RESULT |
michael@0 | 139 | { |
michael@0 | 140 | D3DKMTQS_ADAPTER_INFO AdapterInfo; |
michael@0 | 141 | D3DKMTQS_SEGMENT_INFO_WIN7 SegmentInfoWin7; |
michael@0 | 142 | D3DKMTQS_SEGMENT_INFO_WIN8 SegmentInfoWin8; |
michael@0 | 143 | D3DKMTQS_PROCESS_INFO ProcessInfo; |
michael@0 | 144 | D3DKMTQS_PROCESS_SEGMENT_INFO ProcessSegmentInfo; |
michael@0 | 145 | } D3DKMTQS_RESULT; |
michael@0 | 146 | |
michael@0 | 147 | typedef struct _D3DKMTQS_QUERY_SEGMENT |
michael@0 | 148 | { |
michael@0 | 149 | ULONG SegmentId; |
michael@0 | 150 | } D3DKMTQS_QUERY_SEGMENT; |
michael@0 | 151 | |
michael@0 | 152 | typedef struct _D3DKMTQS |
michael@0 | 153 | { |
michael@0 | 154 | D3DKMTQS_TYPE Type; |
michael@0 | 155 | LUID AdapterLuid; |
michael@0 | 156 | HANDLE hProcess; |
michael@0 | 157 | D3DKMTQS_RESULT QueryResult; |
michael@0 | 158 | |
michael@0 | 159 | union |
michael@0 | 160 | { |
michael@0 | 161 | D3DKMTQS_QUERY_SEGMENT QuerySegment; |
michael@0 | 162 | D3DKMTQS_QUERY_SEGMENT QueryProcessSegment; |
michael@0 | 163 | }; |
michael@0 | 164 | } D3DKMTQS; |
michael@0 | 165 | |
michael@0 | 166 | extern "C" { |
michael@0 | 167 | typedef __checkReturn NTSTATUS (APIENTRY *PFND3DKMTQS)(const D3DKMTQS *); |
michael@0 | 168 | } |