Bumping manifests a=b2g-bump
[gecko.git] / dom / canvas / WebGLBuffer.h
blobbc8d4d33e20922f39e0a8c5c16eae4f2877064e5
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef WEBGL_BUFFER_H_
7 #define WEBGL_BUFFER_H_
9 #include "GLDefs.h"
10 #include "mozilla/LinkedList.h"
11 #include "mozilla/MemoryReporting.h"
12 #include "nsWrapperCache.h"
13 #include "WebGLBindableName.h"
14 #include "WebGLObjectModel.h"
15 #include "WebGLStrongTypes.h"
16 #include "WebGLTypes.h"
18 namespace mozilla {
20 class WebGLElementArrayCache;
22 class WebGLBuffer MOZ_FINAL
23 : public nsWrapperCache
24 , public WebGLBindableName<BufferBinding>
25 , public WebGLRefCountedObject<WebGLBuffer>
26 , public LinkedListElement<WebGLBuffer>
27 , public WebGLContextBoundObject
29 public:
30 explicit WebGLBuffer(WebGLContext* webgl, GLuint buf);
32 void Delete();
34 size_t SizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf) const;
36 WebGLsizeiptr ByteLength() const { return mByteLength; }
37 void SetByteLength(WebGLsizeiptr byteLength) { mByteLength = byteLength; }
39 bool ElementArrayCacheBufferData(const void* ptr, size_t bufferSizeInBytes);
41 void ElementArrayCacheBufferSubData(size_t pos, const void* ptr,
42 size_t updateSizeInBytes);
44 bool Validate(GLenum type, uint32_t max_allowed, size_t first, size_t count,
45 uint32_t* const out_upperBound);
47 bool IsElementArrayUsedWithMultipleTypes() const;
49 WebGLContext* GetParentObject() const {
50 return Context();
53 virtual JSObject* WrapObject(JSContext* cx) MOZ_OVERRIDE;
55 NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(WebGLBuffer)
56 NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(WebGLBuffer)
58 protected:
59 ~WebGLBuffer();
61 virtual void OnTargetChanged() MOZ_OVERRIDE;
63 WebGLsizeiptr mByteLength;
64 nsAutoPtr<WebGLElementArrayCache> mCache;
67 } // namespace mozilla
69 #endif // WEBGL_BUFFER_H_