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.
michael@0 | 1 | #include "precompiled.h" |
michael@0 | 2 | // |
michael@0 | 3 | // Copyright (c) 2013 The ANGLE Project Authors. All rights reserved. |
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 | // Fence9.cpp: Defines the rx::Fence9 class. |
michael@0 | 9 | |
michael@0 | 10 | #include "libGLESv2/renderer/Fence9.h" |
michael@0 | 11 | #include "libGLESv2/main.h" |
michael@0 | 12 | #include "libGLESv2/renderer/renderer9_utils.h" |
michael@0 | 13 | #include "libGLESv2/renderer/Renderer9.h" |
michael@0 | 14 | |
michael@0 | 15 | namespace rx |
michael@0 | 16 | { |
michael@0 | 17 | |
michael@0 | 18 | Fence9::Fence9(rx::Renderer9 *renderer) |
michael@0 | 19 | { |
michael@0 | 20 | mRenderer = renderer; |
michael@0 | 21 | mQuery = NULL; |
michael@0 | 22 | } |
michael@0 | 23 | |
michael@0 | 24 | Fence9::~Fence9() |
michael@0 | 25 | { |
michael@0 | 26 | if (mQuery) |
michael@0 | 27 | { |
michael@0 | 28 | mRenderer->freeEventQuery(mQuery); |
michael@0 | 29 | mQuery = NULL; |
michael@0 | 30 | } |
michael@0 | 31 | } |
michael@0 | 32 | |
michael@0 | 33 | GLboolean Fence9::isFence() |
michael@0 | 34 | { |
michael@0 | 35 | // GL_NV_fence spec: |
michael@0 | 36 | // A name returned by GenFencesNV, but not yet set via SetFenceNV, is not the name of an existing fence. |
michael@0 | 37 | return mQuery != NULL; |
michael@0 | 38 | } |
michael@0 | 39 | |
michael@0 | 40 | void Fence9::setFence(GLenum condition) |
michael@0 | 41 | { |
michael@0 | 42 | if (!mQuery) |
michael@0 | 43 | { |
michael@0 | 44 | mQuery = mRenderer->allocateEventQuery(); |
michael@0 | 45 | if (!mQuery) |
michael@0 | 46 | { |
michael@0 | 47 | return gl::error(GL_OUT_OF_MEMORY); |
michael@0 | 48 | } |
michael@0 | 49 | } |
michael@0 | 50 | |
michael@0 | 51 | HRESULT result = mQuery->Issue(D3DISSUE_END); |
michael@0 | 52 | ASSERT(SUCCEEDED(result)); |
michael@0 | 53 | |
michael@0 | 54 | setCondition(condition); |
michael@0 | 55 | setStatus(GL_FALSE); |
michael@0 | 56 | } |
michael@0 | 57 | |
michael@0 | 58 | GLboolean Fence9::testFence() |
michael@0 | 59 | { |
michael@0 | 60 | if (mQuery == NULL) |
michael@0 | 61 | { |
michael@0 | 62 | return gl::error(GL_INVALID_OPERATION, GL_TRUE); |
michael@0 | 63 | } |
michael@0 | 64 | |
michael@0 | 65 | HRESULT result = mQuery->GetData(NULL, 0, D3DGETDATA_FLUSH); |
michael@0 | 66 | |
michael@0 | 67 | if (d3d9::isDeviceLostError(result)) |
michael@0 | 68 | { |
michael@0 | 69 | mRenderer->notifyDeviceLost(); |
michael@0 | 70 | return gl::error(GL_OUT_OF_MEMORY, GL_TRUE); |
michael@0 | 71 | } |
michael@0 | 72 | |
michael@0 | 73 | ASSERT(result == S_OK || result == S_FALSE); |
michael@0 | 74 | setStatus(result == S_OK); |
michael@0 | 75 | return getStatus(); |
michael@0 | 76 | } |
michael@0 | 77 | |
michael@0 | 78 | void Fence9::finishFence() |
michael@0 | 79 | { |
michael@0 | 80 | if (mQuery == NULL) |
michael@0 | 81 | { |
michael@0 | 82 | return gl::error(GL_INVALID_OPERATION); |
michael@0 | 83 | } |
michael@0 | 84 | |
michael@0 | 85 | while (!testFence()) |
michael@0 | 86 | { |
michael@0 | 87 | Sleep(0); |
michael@0 | 88 | } |
michael@0 | 89 | } |
michael@0 | 90 | |
michael@0 | 91 | void Fence9::getFenceiv(GLenum pname, GLint *params) |
michael@0 | 92 | { |
michael@0 | 93 | if (mQuery == NULL) |
michael@0 | 94 | { |
michael@0 | 95 | return gl::error(GL_INVALID_OPERATION); |
michael@0 | 96 | } |
michael@0 | 97 | |
michael@0 | 98 | switch (pname) |
michael@0 | 99 | { |
michael@0 | 100 | case GL_FENCE_STATUS_NV: |
michael@0 | 101 | { |
michael@0 | 102 | // GL_NV_fence spec: |
michael@0 | 103 | // Once the status of a fence has been finished (via FinishFenceNV) or tested and the returned status is TRUE (via either TestFenceNV |
michael@0 | 104 | // or GetFenceivNV querying the FENCE_STATUS_NV), the status remains TRUE until the next SetFenceNV of the fence. |
michael@0 | 105 | if (getStatus()) |
michael@0 | 106 | { |
michael@0 | 107 | params[0] = GL_TRUE; |
michael@0 | 108 | return; |
michael@0 | 109 | } |
michael@0 | 110 | |
michael@0 | 111 | HRESULT result = mQuery->GetData(NULL, 0, 0); |
michael@0 | 112 | |
michael@0 | 113 | if (d3d9::isDeviceLostError(result)) |
michael@0 | 114 | { |
michael@0 | 115 | params[0] = GL_TRUE; |
michael@0 | 116 | mRenderer->notifyDeviceLost(); |
michael@0 | 117 | return gl::error(GL_OUT_OF_MEMORY); |
michael@0 | 118 | } |
michael@0 | 119 | |
michael@0 | 120 | ASSERT(result == S_OK || result == S_FALSE); |
michael@0 | 121 | setStatus(result == S_OK); |
michael@0 | 122 | params[0] = getStatus(); |
michael@0 | 123 | |
michael@0 | 124 | break; |
michael@0 | 125 | } |
michael@0 | 126 | case GL_FENCE_CONDITION_NV: |
michael@0 | 127 | params[0] = getCondition(); |
michael@0 | 128 | break; |
michael@0 | 129 | default: |
michael@0 | 130 | return gl::error(GL_INVALID_ENUM); |
michael@0 | 131 | break; |
michael@0 | 132 | } |
michael@0 | 133 | } |
michael@0 | 134 | |
michael@0 | 135 | } |