Sat, 03 Jan 2015 20:18:00 +0100
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.
1 #include "precompiled.h"
2 //
3 // Copyright (c) 2013 The ANGLE Project Authors. All rights reserved.
4 // Use of this source code is governed by a BSD-style license that can be
5 // found in the LICENSE file.
6 //
8 // Query11.cpp: Defines the rx::Query11 class which implements rx::QueryImpl.
10 #include "libGLESv2/renderer/Query11.h"
11 #include "libGLESv2/renderer/Renderer11.h"
12 #include "libGLESv2/main.h"
14 namespace rx
15 {
17 Query11::Query11(rx::Renderer11 *renderer, GLenum type) : QueryImpl(type)
18 {
19 mRenderer = renderer;
20 mQuery = NULL;
21 }
23 Query11::~Query11()
24 {
25 if (mQuery)
26 {
27 mQuery->Release();
28 mQuery = NULL;
29 }
30 }
32 void Query11::begin()
33 {
34 if (mQuery == NULL)
35 {
36 D3D11_QUERY_DESC queryDesc;
37 queryDesc.Query = D3D11_QUERY_OCCLUSION;
38 queryDesc.MiscFlags = 0;
40 if (FAILED(mRenderer->getDevice()->CreateQuery(&queryDesc, &mQuery)))
41 {
42 return gl::error(GL_OUT_OF_MEMORY);
43 }
44 }
46 mRenderer->getDeviceContext()->Begin(mQuery);
47 }
49 void Query11::end()
50 {
51 if (mQuery == NULL)
52 {
53 return gl::error(GL_INVALID_OPERATION);
54 }
56 mRenderer->getDeviceContext()->End(mQuery);
58 mStatus = GL_FALSE;
59 mResult = GL_FALSE;
60 }
62 GLuint Query11::getResult()
63 {
64 if (mQuery != NULL)
65 {
66 while (!testQuery())
67 {
68 Sleep(0);
69 // explicitly check for device loss, some drivers seem to return S_FALSE
70 // if the device is lost
71 if (mRenderer->testDeviceLost(true))
72 {
73 return gl::error(GL_OUT_OF_MEMORY, 0);
74 }
75 }
76 }
78 return mResult;
79 }
81 GLboolean Query11::isResultAvailable()
82 {
83 if (mQuery != NULL)
84 {
85 testQuery();
86 }
88 return mStatus;
89 }
91 GLboolean Query11::testQuery()
92 {
93 if (mQuery != NULL && mStatus != GL_TRUE)
94 {
95 UINT64 numPixels = 0;
96 HRESULT result = mRenderer->getDeviceContext()->GetData(mQuery, &numPixels, sizeof(UINT64), 0);
97 if (result == S_OK)
98 {
99 mStatus = GL_TRUE;
101 switch (getType())
102 {
103 case GL_ANY_SAMPLES_PASSED_EXT:
104 case GL_ANY_SAMPLES_PASSED_CONSERVATIVE_EXT:
105 mResult = (numPixels > 0) ? GL_TRUE : GL_FALSE;
106 break;
107 default:
108 UNREACHABLE();
109 }
110 }
111 else if (mRenderer->testDeviceLost(true))
112 {
113 return gl::error(GL_OUT_OF_MEMORY, GL_TRUE);
114 }
116 return mStatus;
117 }
119 return GL_TRUE; // prevent blocking when query is null
120 }
122 }