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 | /* |
michael@0 | 2 | * Copyright 2012 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 | #include "GrSimpleTextureEffect.h" |
michael@0 | 9 | #include "gl/GrGLEffect.h" |
michael@0 | 10 | #include "gl/GrGLSL.h" |
michael@0 | 11 | #include "gl/GrGLTexture.h" |
michael@0 | 12 | #include "GrTBackendEffectFactory.h" |
michael@0 | 13 | #include "GrTexture.h" |
michael@0 | 14 | |
michael@0 | 15 | class GrGLSimpleTextureEffect : public GrGLEffect { |
michael@0 | 16 | public: |
michael@0 | 17 | GrGLSimpleTextureEffect(const GrBackendEffectFactory& factory, const GrDrawEffect&) |
michael@0 | 18 | : INHERITED (factory) { |
michael@0 | 19 | } |
michael@0 | 20 | |
michael@0 | 21 | virtual void emitCode(GrGLShaderBuilder* builder, |
michael@0 | 22 | const GrDrawEffect& drawEffect, |
michael@0 | 23 | EffectKey key, |
michael@0 | 24 | const char* outputColor, |
michael@0 | 25 | const char* inputColor, |
michael@0 | 26 | const TransformedCoordsArray& coords, |
michael@0 | 27 | const TextureSamplerArray& samplers) SK_OVERRIDE { |
michael@0 | 28 | builder->fsCodeAppendf("\t%s = ", outputColor); |
michael@0 | 29 | builder->fsAppendTextureLookupAndModulate(inputColor, |
michael@0 | 30 | samplers[0], |
michael@0 | 31 | coords[0].c_str(), |
michael@0 | 32 | coords[0].type()); |
michael@0 | 33 | builder->fsCodeAppend(";\n"); |
michael@0 | 34 | } |
michael@0 | 35 | |
michael@0 | 36 | private: |
michael@0 | 37 | typedef GrGLEffect INHERITED; |
michael@0 | 38 | }; |
michael@0 | 39 | |
michael@0 | 40 | /////////////////////////////////////////////////////////////////////////////// |
michael@0 | 41 | |
michael@0 | 42 | void GrSimpleTextureEffect::getConstantColorComponents(GrColor* color, uint32_t* validFlags) const { |
michael@0 | 43 | this->updateConstantColorComponentsForModulation(color, validFlags); |
michael@0 | 44 | } |
michael@0 | 45 | |
michael@0 | 46 | const GrBackendEffectFactory& GrSimpleTextureEffect::getFactory() const { |
michael@0 | 47 | return GrTBackendEffectFactory<GrSimpleTextureEffect>::getInstance(); |
michael@0 | 48 | } |
michael@0 | 49 | |
michael@0 | 50 | /////////////////////////////////////////////////////////////////////////////// |
michael@0 | 51 | |
michael@0 | 52 | GR_DEFINE_EFFECT_TEST(GrSimpleTextureEffect); |
michael@0 | 53 | |
michael@0 | 54 | GrEffectRef* GrSimpleTextureEffect::TestCreate(SkRandom* random, |
michael@0 | 55 | GrContext*, |
michael@0 | 56 | const GrDrawTargetCaps&, |
michael@0 | 57 | GrTexture* textures[]) { |
michael@0 | 58 | int texIdx = random->nextBool() ? GrEffectUnitTest::kSkiaPMTextureIdx : |
michael@0 | 59 | GrEffectUnitTest::kAlphaTextureIdx; |
michael@0 | 60 | static const SkShader::TileMode kTileModes[] = { |
michael@0 | 61 | SkShader::kClamp_TileMode, |
michael@0 | 62 | SkShader::kRepeat_TileMode, |
michael@0 | 63 | SkShader::kMirror_TileMode, |
michael@0 | 64 | }; |
michael@0 | 65 | SkShader::TileMode tileModes[] = { |
michael@0 | 66 | kTileModes[random->nextULessThan(SK_ARRAY_COUNT(kTileModes))], |
michael@0 | 67 | kTileModes[random->nextULessThan(SK_ARRAY_COUNT(kTileModes))], |
michael@0 | 68 | }; |
michael@0 | 69 | GrTextureParams params(tileModes, random->nextBool() ? GrTextureParams::kBilerp_FilterMode : |
michael@0 | 70 | GrTextureParams::kNone_FilterMode); |
michael@0 | 71 | |
michael@0 | 72 | static const GrCoordSet kCoordSets[] = { |
michael@0 | 73 | kLocal_GrCoordSet, |
michael@0 | 74 | kPosition_GrCoordSet |
michael@0 | 75 | }; |
michael@0 | 76 | GrCoordSet coordSet = kCoordSets[random->nextULessThan(GR_ARRAY_COUNT(kCoordSets))]; |
michael@0 | 77 | |
michael@0 | 78 | const SkMatrix& matrix = GrEffectUnitTest::TestMatrix(random); |
michael@0 | 79 | return GrSimpleTextureEffect::Create(textures[texIdx], matrix, coordSet); |
michael@0 | 80 | } |