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 //
2 // Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
3 // Use of this source code is governed by a BSD-style license that can be
4 // found in the LICENSE file.
5 //
7 // ResourceManager.h : Defines the ResourceManager class, which tracks objects
8 // shared by multiple GL contexts.
10 #ifndef LIBGLESV2_RESOURCEMANAGER_H_
11 #define LIBGLESV2_RESOURCEMANAGER_H_
13 #define GL_APICALL
14 #include <GLES2/gl2.h>
16 #ifdef _MSC_VER
17 #include <hash_map>
18 #else
19 #include <unordered_map>
20 #endif
22 #include "common/angleutils.h"
23 #include "libGLESv2/angletypes.h"
24 #include "libGLESv2/HandleAllocator.h"
26 namespace rx
27 {
28 class Renderer;
29 }
31 namespace gl
32 {
33 class Buffer;
34 class Shader;
35 class Program;
36 class Texture;
37 class Renderbuffer;
39 class ResourceManager
40 {
41 public:
42 explicit ResourceManager(rx::Renderer *renderer);
43 ~ResourceManager();
45 void addRef();
46 void release();
48 GLuint createBuffer();
49 GLuint createShader(GLenum type);
50 GLuint createProgram();
51 GLuint createTexture();
52 GLuint createRenderbuffer();
54 void deleteBuffer(GLuint buffer);
55 void deleteShader(GLuint shader);
56 void deleteProgram(GLuint program);
57 void deleteTexture(GLuint texture);
58 void deleteRenderbuffer(GLuint renderbuffer);
60 Buffer *getBuffer(GLuint handle);
61 Shader *getShader(GLuint handle);
62 Program *getProgram(GLuint handle);
63 Texture *getTexture(GLuint handle);
64 Renderbuffer *getRenderbuffer(GLuint handle);
66 void setRenderbuffer(GLuint handle, Renderbuffer *renderbuffer);
68 void checkBufferAllocation(unsigned int buffer);
69 void checkTextureAllocation(GLuint texture, TextureType type);
70 void checkRenderbufferAllocation(GLuint renderbuffer);
72 private:
73 DISALLOW_COPY_AND_ASSIGN(ResourceManager);
75 std::size_t mRefCount;
76 rx::Renderer *mRenderer;
78 #ifndef HASH_MAP
79 # ifdef _MSC_VER
80 # define HASH_MAP stdext::hash_map
81 # else
82 # define HASH_MAP std::unordered_map
83 # endif
84 #endif
86 typedef HASH_MAP<GLuint, Buffer*> BufferMap;
87 BufferMap mBufferMap;
88 HandleAllocator mBufferHandleAllocator;
90 typedef HASH_MAP<GLuint, Shader*> ShaderMap;
91 ShaderMap mShaderMap;
93 typedef HASH_MAP<GLuint, Program*> ProgramMap;
94 ProgramMap mProgramMap;
95 HandleAllocator mProgramShaderHandleAllocator;
97 typedef HASH_MAP<GLuint, Texture*> TextureMap;
98 TextureMap mTextureMap;
99 HandleAllocator mTextureHandleAllocator;
101 typedef HASH_MAP<GLuint, Renderbuffer*> RenderbufferMap;
102 RenderbufferMap mRenderbufferMap;
103 HandleAllocator mRenderbufferHandleAllocator;
104 };
106 }
108 #endif // LIBGLESV2_RESOURCEMANAGER_H_