2012-12-09 03:02:29 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
2014-11-14 07:03:50 +03:00
|
|
|
#ifndef WEBGL_UNIFORM_LOCATION_H_
|
|
|
|
#define WEBGL_UNIFORM_LOCATION_H_
|
2012-12-09 03:02:29 +04:00
|
|
|
|
2015-01-16 02:40:39 +03:00
|
|
|
#include "GLDefs.h"
|
|
|
|
#include "mozilla/WeakPtr.h"
|
|
|
|
#include "nsCycleCollectionParticipant.h" // NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS
|
|
|
|
#include "nsISupportsImpl.h" // NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING
|
|
|
|
#include "nsWrapperCache.h"
|
2012-12-09 03:02:29 +04:00
|
|
|
#include "WebGLObjectModel.h"
|
2013-06-11 00:00:35 +04:00
|
|
|
|
2015-01-16 02:40:39 +03:00
|
|
|
struct JSContext;
|
2015-01-10 05:40:56 +03:00
|
|
|
|
2015-01-16 02:40:39 +03:00
|
|
|
namespace mozilla {
|
|
|
|
class WebGLActiveInfo;
|
|
|
|
class WebGLContext;
|
2015-01-13 11:07:26 +03:00
|
|
|
class WebGLProgram;
|
2015-01-13 06:51:20 +03:00
|
|
|
|
2015-01-16 02:40:39 +03:00
|
|
|
namespace webgl {
|
|
|
|
struct LinkedProgramInfo;
|
|
|
|
}
|
|
|
|
|
2012-12-09 03:02:29 +04:00
|
|
|
class WebGLUniformLocation MOZ_FINAL
|
2015-01-16 02:40:39 +03:00
|
|
|
: public nsWrapperCache
|
|
|
|
, public WebGLContextBoundObject
|
2012-12-09 03:02:29 +04:00
|
|
|
{
|
|
|
|
public:
|
2015-01-16 02:40:39 +03:00
|
|
|
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(WebGLUniformLocation)
|
|
|
|
NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(WebGLUniformLocation)
|
2012-12-09 03:02:29 +04:00
|
|
|
|
Bug 1117172 part 3. Change the wrappercached WrapObject methods to allow passing in aGivenProto. r=peterv
The only manual changes here are to BindingUtils.h, BindingUtils.cpp,
Codegen.py, Element.cpp, IDBFileRequest.cpp, IDBObjectStore.cpp,
dom/workers/Navigator.cpp, WorkerPrivate.cpp, DeviceStorageRequestChild.cpp,
Notification.cpp, nsGlobalWindow.cpp, MessagePort.cpp, nsJSEnvironment.cpp,
Sandbox.cpp, XPCConvert.cpp, ExportHelpers.cpp, and DataStoreService.cpp. The
rest of this diff was generated by running the following commands:
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObjectInternal\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObjectInternal\((?:aCx|cx|aContext|aCtx|js))\)/\1, aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapNode\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapNode\((?:aCx|cx|aContext|aCtx|js))\)/\1, aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObject\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(Binding(?:_workers)?::Wrap\((?:aCx|cx|aContext|aCtx|js), [^,)]+)\)/\1, aGivenProto)/g'
2015-03-19 17:13:33 +03:00
|
|
|
virtual JSObject* WrapObject(JSContext* js, JS::Handle<JSObject*> aGivenProto) MOZ_OVERRIDE;
|
2012-12-09 03:02:29 +04:00
|
|
|
|
2015-01-16 02:40:39 +03:00
|
|
|
WebGLContext* GetParentObject() const {
|
|
|
|
return mContext;
|
|
|
|
}
|
2014-06-26 17:30:49 +04:00
|
|
|
|
2012-12-09 03:02:29 +04:00
|
|
|
|
2015-01-16 02:40:39 +03:00
|
|
|
const WeakPtr<const webgl::LinkedProgramInfo> mLinkInfo;
|
|
|
|
const GLuint mLoc;
|
|
|
|
const WebGLActiveInfo* const mActiveInfo;
|
2015-01-10 08:03:54 +03:00
|
|
|
|
2015-01-16 02:40:39 +03:00
|
|
|
WebGLUniformLocation(WebGLContext* webgl, const webgl::LinkedProgramInfo* linkInfo,
|
|
|
|
GLuint loc, const WebGLActiveInfo* activeInfo);
|
2015-01-10 08:03:54 +03:00
|
|
|
|
2015-01-16 02:40:39 +03:00
|
|
|
bool ValidateForProgram(WebGLProgram* prog, WebGLContext* webgl,
|
|
|
|
const char* funcName) const;
|
|
|
|
bool ValidateSamplerSetter(GLint value, WebGLContext* webgl,
|
|
|
|
const char* funcName) const;
|
|
|
|
bool ValidateSizeAndType(uint8_t setterElemSize, GLenum setterType,
|
|
|
|
WebGLContext* webgl, const char* funcName) const;
|
|
|
|
bool ValidateArrayLength(uint8_t setterElemSize, size_t setterArraySize,
|
|
|
|
WebGLContext* webgl, const char* funcName) const;
|
2015-01-13 11:07:26 +03:00
|
|
|
|
2015-01-16 02:40:39 +03:00
|
|
|
JS::Value GetUniform(JSContext* js, WebGLContext* webgl) const;
|
2015-01-13 11:07:26 +03:00
|
|
|
|
2015-01-16 02:40:39 +03:00
|
|
|
// Needed for certain helper functions like ValidateObject.
|
|
|
|
// `WebGLUniformLocation`s can't be 'Deleted' in the WebGL sense.
|
|
|
|
bool IsDeleted() const { return false; }
|
|
|
|
|
|
|
|
protected:
|
|
|
|
~WebGLUniformLocation();
|
2012-12-09 03:02:29 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace mozilla
|
|
|
|
|
2014-11-14 07:03:50 +03:00
|
|
|
#endif // WEBGL_UNIFORM_LOCATION_H_
|