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