Implement CPOW support in MessageManager (bug 870180, r=smaug,billm).

This commit is contained in:
David Anderson
2013-07-10 15:05:39 -07:00
parent 0b9b6e1a09
commit c4c18e062d
29 changed files with 649 additions and 146 deletions

View File

@@ -21,6 +21,24 @@ namespace jsipc {
typedef uint64_t ObjectId;
class JavaScriptShared;
class CpowIdHolder : public CpowHolder
{
public:
CpowIdHolder(JavaScriptShared *js, const InfallibleTArray<CpowEntry> &cpows)
: js_(js),
cpows_(cpows)
{
}
bool ToObject(JSContext *cx, JSObject **objp);
private:
JavaScriptShared *js_;
const InfallibleTArray<CpowEntry> &cpows_;
};
// Map ids -> JSObjects
class ObjectStore
{
@@ -70,6 +88,9 @@ class JavaScriptShared
static const uint32_t OBJECT_EXTRA_BITS = 1;
static const uint32_t OBJECT_IS_CALLABLE = (1 << 0);
bool Unwrap(JSContext *cx, const InfallibleTArray<CpowEntry> &aCpows, JSObject **objp);
bool Wrap(JSContext *cx, JS::HandleObject aObj, InfallibleTArray<CpowEntry> *outCpows);
protected:
bool toVariant(JSContext *cx, jsval from, JSVariant *to);
bool toValue(JSContext *cx, const JSVariant &from, JS::MutableHandleValue to);