gfx/angle/angle-long-ident-hash.patch

Tue, 06 Jan 2015 21:39:09 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 06 Jan 2015 21:39:09 +0100
branch
TOR_BUG_9701
changeset 8
97036ab72558
permissions
-rw-r--r--

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 From: Jeff Gilbert <jgilbert@mozilla.com>
michael@0 2
michael@0 3 diff --git a/gfx/angle/Makefile.in b/gfx/angle/Makefile.in
michael@0 4 --- a/gfx/angle/Makefile.in
michael@0 5 +++ b/gfx/angle/Makefile.in
michael@0 6 @@ -32,16 +32,17 @@ LOCAL_INCLUDES += \
michael@0 7 -I$(srcdir)/src
michael@0 8
michael@0 9 DEFINES += -DCOMPILER_IMPLEMENTATION
michael@0 10
michael@0 11 VPATH += $(srcdir)/src/compiler
michael@0 12 VPATH += $(srcdir)/src/compiler/depgraph
michael@0 13 VPATH += $(srcdir)/src/compiler/timing
michael@0 14 VPATH += $(srcdir)/src/third_party/compiler
michael@0 15 +VPATH += $(srcdir)/src/third_party/murmurhash
michael@0 16
michael@0 17 # Target: 'translator_glsl'
michael@0 18 # Requires: 'translator_common'
michael@0 19 # src/compiler:
michael@0 20 ifdef MOZ_ANGLE_RENDERER
michael@0 21
michael@0 22 libs::
michael@0 23 ifdef MOZ_D3DCOMPILER_CAB
michael@0 24 diff --git a/gfx/angle/moz.build b/gfx/angle/moz.build
michael@0 25 --- a/gfx/angle/moz.build
michael@0 26 +++ b/gfx/angle/moz.build
michael@0 27 @@ -83,16 +83,21 @@ CPP_SOURCES += [
michael@0 28 'RestrictVertexShaderTiming.cpp',
michael@0 29 ]
michael@0 30
michael@0 31 # src/third_party/compiler:
michael@0 32 CPP_SOURCES += [
michael@0 33 'ArrayBoundsClamper.cpp',
michael@0 34 ]
michael@0 35
michael@0 36 +# src/third_party/murmurhash:
michael@0 37 +CPP_SOURCES += [
michael@0 38 + 'MurmurHash3.cpp',
michael@0 39 +]
michael@0 40 +
michael@0 41 if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':
michael@0 42 CPP_SOURCES += [
michael@0 43 'ossource_win.cpp',
michael@0 44 ]
michael@0 45 else:
michael@0 46 CPP_SOURCES += [
michael@0 47 'ossource_posix.cpp',
michael@0 48 ]
michael@0 49 diff --git a/gfx/angle/src/compiler/MapLongVariableNames.cpp b/gfx/angle/src/compiler/MapLongVariableNames.cpp
michael@0 50 --- a/gfx/angle/src/compiler/MapLongVariableNames.cpp
michael@0 51 +++ b/gfx/angle/src/compiler/MapLongVariableNames.cpp
michael@0 52 @@ -1,29 +1,39 @@
michael@0 53 //
michael@0 54 // Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved.
michael@0 55 // Use of this source code is governed by a BSD-style license that can be
michael@0 56 // found in the LICENSE file.
michael@0 57 //
michael@0 58
michael@0 59 #include "compiler/MapLongVariableNames.h"
michael@0 60
michael@0 61 +#include "third_party/murmurhash/MurmurHash3.h"
michael@0 62 +
michael@0 63 namespace {
michael@0 64
michael@0 65 TString mapLongName(size_t id, const TString& name, bool isGlobal)
michael@0 66 {
michael@0 67 ASSERT(name.size() > MAX_SHORTENED_IDENTIFIER_SIZE);
michael@0 68 TStringStream stream;
michael@0 69 - stream << "webgl_";
michael@0 70 - if (isGlobal)
michael@0 71 - stream << "g";
michael@0 72 - stream << id;
michael@0 73 - if (name[0] != '_')
michael@0 74 - stream << "_";
michael@0 75 - stream << name.substr(0, MAX_SHORTENED_IDENTIFIER_SIZE - stream.str().size());
michael@0 76 +
michael@0 77 + uint64_t hash[2] = {0, 0};
michael@0 78 + MurmurHash3_x64_128(name.data(), name.length(), 0, hash);
michael@0 79 +
michael@0 80 + // We want to avoid producing a string with a double underscore,
michael@0 81 + // which would be an illegal GLSL identifier. We can assume that the
michael@0 82 + // original identifier doesn't have a double underscore, otherwise
michael@0 83 + // it's illegal anyway.
michael@0 84 + stream << (name[0] == '_' ? "webgl" : "webgl_")
michael@0 85 + << name.substr(0, 9)
michael@0 86 + << (name[8] == '_' ? "" : "_")
michael@0 87 + << std::hex
michael@0 88 + << hash[0];
michael@0 89 + ASSERT(stream.str().length() <= MAX_SHORTENED_IDENTIFIER_SIZE);
michael@0 90 + ASSERT(stream.str().length() >= MAX_SHORTENED_IDENTIFIER_SIZE - 2);
michael@0 91 return stream.str();
michael@0 92 }
michael@0 93
michael@0 94 LongNameMap* gLongNameMapInstance = NULL;
michael@0 95
michael@0 96 } // anonymous namespace
michael@0 97
michael@0 98 LongNameMap::LongNameMap()
michael@0 99 diff --git a/gfx/angle/src/libGLESv2/moz.build b/gfx/angle/src/libGLESv2/moz.build
michael@0 100 --- a/gfx/angle/src/libGLESv2/moz.build
michael@0 101 +++ b/gfx/angle/src/libGLESv2/moz.build
michael@0 102 @@ -71,16 +71,21 @@ CPP_SOURCES += [
michael@0 103 'RestrictVertexShaderTiming.cpp',
michael@0 104 ]
michael@0 105
michael@0 106 # src/third_party/compiler:
michael@0 107 CPP_SOURCES += [
michael@0 108 'ArrayBoundsClamper.cpp',
michael@0 109 ]
michael@0 110
michael@0 111 +# src/third_party/murmurhash:
michael@0 112 +CPP_SOURCES += [
michael@0 113 + 'MurmurHash3.cpp',
michael@0 114 +]
michael@0 115 +
michael@0 116 if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':
michael@0 117 CPP_SOURCES += [
michael@0 118 'ossource_win.cpp',
michael@0 119 ]
michael@0 120 else:
michael@0 121 CPP_SOURCES += [
michael@0 122 'ossource_posix.cpp',
michael@0 123 ]
michael@0 124 @@ -165,13 +170,8 @@ CPP_SOURCES += [
michael@0 125 'TextureStorage11.cpp',
michael@0 126 'TextureStorage9.cpp',
michael@0 127 'VertexBuffer.cpp',
michael@0 128 'VertexBuffer9.cpp',
michael@0 129 'VertexBuffer11.cpp',
michael@0 130 'VertexDataManager.cpp',
michael@0 131 'VertexDeclarationCache.cpp',
michael@0 132 ]
michael@0 133 -
michael@0 134 -# src/third_party/murmurhash:
michael@0 135 -CPP_SOURCES += [
michael@0 136 - 'MurmurHash3.cpp',
michael@0 137 -]

mercurial