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 // Query9.cpp: Defines the rx::Query9 class which implements rx::QueryImpl.
11 #include "libGLESv2/renderer/Query9.h"
12 #include "libGLESv2/main.h"
13 #include "libGLESv2/renderer/renderer9_utils.h"
14 #include "libGLESv2/renderer/Renderer9.h"
16 namespace rx
17 {
19 Query9::Query9(rx::Renderer9 *renderer, GLenum type) : QueryImpl(type)
20 {
21 mRenderer = renderer;
22 mQuery = NULL;
23 }
25 Query9::~Query9()
26 {
27 if (mQuery)
28 {
29 mQuery->Release();
30 mQuery = NULL;
31 }
32 }
34 void Query9::begin()
35 {
36 if (mQuery == NULL)
37 {
38 if (FAILED(mRenderer->getDevice()->CreateQuery(D3DQUERYTYPE_OCCLUSION, &mQuery)))
39 {
40 return gl::error(GL_OUT_OF_MEMORY);
41 }
42 }
44 HRESULT result = mQuery->Issue(D3DISSUE_BEGIN);
45 ASSERT(SUCCEEDED(result));
46 }
48 void Query9::end()
49 {
50 if (mQuery == NULL)
51 {
52 return gl::error(GL_INVALID_OPERATION);
53 }
55 HRESULT result = mQuery->Issue(D3DISSUE_END);
56 ASSERT(SUCCEEDED(result));
58 mStatus = GL_FALSE;
59 mResult = GL_FALSE;
60 }
62 GLuint Query9::getResult()
63 {
64 if (mQuery != NULL)
65 {
66 while (!testQuery())
67 {
68 Sleep(0);
69 // explicitly check for device loss
70 // some drivers seem to return S_FALSE even if the device is lost
71 // instead of D3DERR_DEVICELOST like they should
72 if (mRenderer->testDeviceLost(true))
73 {
74 return gl::error(GL_OUT_OF_MEMORY, 0);
75 }
76 }
77 }
79 return mResult;
80 }
82 GLboolean Query9::isResultAvailable()
83 {
84 if (mQuery != NULL)
85 {
86 testQuery();
87 }
89 return mStatus;
90 }
92 GLboolean Query9::testQuery()
93 {
94 if (mQuery != NULL && mStatus != GL_TRUE)
95 {
96 DWORD numPixels = 0;
98 HRESULT hres = mQuery->GetData(&numPixels, sizeof(DWORD), D3DGETDATA_FLUSH);
99 if (hres == S_OK)
100 {
101 mStatus = GL_TRUE;
103 switch (getType())
104 {
105 case GL_ANY_SAMPLES_PASSED_EXT:
106 case GL_ANY_SAMPLES_PASSED_CONSERVATIVE_EXT:
107 mResult = (numPixels > 0) ? GL_TRUE : GL_FALSE;
108 break;
109 default:
110 ASSERT(false);
111 }
112 }
113 else if (d3d9::isDeviceLostError(hres))
114 {
115 mRenderer->notifyDeviceLost();
116 return gl::error(GL_OUT_OF_MEMORY, GL_TRUE);
117 }
119 return mStatus;
120 }
122 return GL_TRUE; // prevent blocking when query is null
123 }
125 }