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-2012 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 // IndexBuffer.h: Defines the abstract IndexBuffer class and IndexBufferInterface
8 // class with derivations, classes that perform graphics API agnostic index buffer operations.
10 #ifndef LIBGLESV2_RENDERER_INDEXBUFFER_H_
11 #define LIBGLESV2_RENDERER_INDEXBUFFER_H_
13 #include "common/angleutils.h"
14 #include "libGLESv2/renderer/IndexRangeCache.h"
16 namespace rx
17 {
18 class Renderer;
20 class IndexBuffer
21 {
22 public:
23 IndexBuffer();
24 virtual ~IndexBuffer();
26 virtual bool initialize(unsigned int bufferSize, GLenum indexType, bool dynamic) = 0;
28 virtual bool mapBuffer(unsigned int offset, unsigned int size, void** outMappedMemory) = 0;
29 virtual bool unmapBuffer() = 0;
31 virtual bool discard() = 0;
33 virtual GLenum getIndexType() const = 0;
34 virtual unsigned int getBufferSize() const = 0;
35 virtual bool setSize(unsigned int bufferSize, GLenum indexType) = 0;
37 unsigned int getSerial() const;
39 protected:
40 void updateSerial();
42 private:
43 DISALLOW_COPY_AND_ASSIGN(IndexBuffer);
45 unsigned int mSerial;
46 static unsigned int mNextSerial;
47 };
49 class IndexBufferInterface
50 {
51 public:
52 IndexBufferInterface(Renderer *renderer, bool dynamic);
53 virtual ~IndexBufferInterface();
55 virtual bool reserveBufferSpace(unsigned int size, GLenum indexType) = 0;
57 GLenum getIndexType() const;
58 unsigned int getBufferSize() const;
60 unsigned int getSerial() const;
62 bool mapBuffer(unsigned int size, void** outMappedMemory, unsigned int *streamOffset);
63 bool unmapBuffer();
65 IndexBuffer *getIndexBuffer() const;
67 protected:
68 unsigned int getWritePosition() const;
69 void setWritePosition(unsigned int writePosition);
71 bool discard();
73 bool setBufferSize(unsigned int bufferSize, GLenum indexType);
75 private:
76 DISALLOW_COPY_AND_ASSIGN(IndexBufferInterface);
78 rx::Renderer *const mRenderer;
80 IndexBuffer* mIndexBuffer;
82 unsigned int mWritePosition;
83 bool mDynamic;
84 };
86 class StreamingIndexBufferInterface : public IndexBufferInterface
87 {
88 public:
89 StreamingIndexBufferInterface(Renderer *renderer);
90 ~StreamingIndexBufferInterface();
92 virtual bool reserveBufferSpace(unsigned int size, GLenum indexType);
93 };
95 class StaticIndexBufferInterface : public IndexBufferInterface
96 {
97 public:
98 explicit StaticIndexBufferInterface(Renderer *renderer);
99 ~StaticIndexBufferInterface();
101 virtual bool reserveBufferSpace(unsigned int size, GLenum indexType);
103 IndexRangeCache *getIndexRangeCache();
105 private:
106 IndexRangeCache mIndexRangeCache;
107 };
109 }
111 #endif // LIBGLESV2_RENDERER_INDEXBUFFER_H_