2015-01-27 00:32:18 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
|
|
|
* vim: set ts=8 sw=4 et tw=80:
|
|
|
|
*
|
|
|
|
* 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/. */
|
|
|
|
|
|
|
|
#ifndef mozilla_jsipc_CrossProcessObjectWrappers_h__
|
|
|
|
#define mozilla_jsipc_CrossProcessObjectWrappers_h__
|
|
|
|
|
|
|
|
#include "js/TypeDecls.h"
|
|
|
|
#include "mozilla/jsipc/CpowHolder.h"
|
|
|
|
#include "mozilla/jsipc/JavaScriptTypes.h"
|
|
|
|
#include "nsID.h"
|
|
|
|
#include "nsString.h"
|
|
|
|
#include "nsTArray.h"
|
|
|
|
|
|
|
|
#ifdef XP_WIN
|
|
|
|
#undef GetClassName
|
|
|
|
#undef GetClassInfo
|
|
|
|
#endif
|
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
|
|
|
|
namespace dom {
|
|
|
|
class CPOWManagerGetter;
|
2015-07-13 18:25:42 +03:00
|
|
|
} // namespace dom
|
2015-01-27 00:32:18 +03:00
|
|
|
|
|
|
|
namespace jsipc {
|
|
|
|
|
|
|
|
class PJavaScriptParent;
|
|
|
|
class PJavaScriptChild;
|
|
|
|
|
|
|
|
class CPOWManager
|
|
|
|
{
|
|
|
|
public:
|
2015-03-29 01:22:11 +03:00
|
|
|
virtual bool Unwrap(JSContext* cx,
|
|
|
|
const InfallibleTArray<CpowEntry>& aCpows,
|
2015-01-27 00:32:18 +03:00
|
|
|
JS::MutableHandleObject objp) = 0;
|
|
|
|
|
2015-03-29 01:22:11 +03:00
|
|
|
virtual bool Wrap(JSContext* cx,
|
2015-01-27 00:32:18 +03:00
|
|
|
JS::HandleObject aObj,
|
2015-03-29 01:22:11 +03:00
|
|
|
InfallibleTArray<CpowEntry>* outCpows) = 0;
|
2015-01-27 00:32:18 +03:00
|
|
|
};
|
|
|
|
|
2015-01-27 00:32:31 +03:00
|
|
|
class CrossProcessCpowHolder : public CpowHolder
|
2015-01-27 00:32:18 +03:00
|
|
|
{
|
|
|
|
public:
|
2015-03-29 01:22:11 +03:00
|
|
|
CrossProcessCpowHolder(dom::CPOWManagerGetter* managerGetter,
|
|
|
|
const InfallibleTArray<CpowEntry>& cpows);
|
2015-01-27 00:32:18 +03:00
|
|
|
|
2015-03-29 01:22:11 +03:00
|
|
|
bool ToObject(JSContext* cx, JS::MutableHandleObject objp);
|
2015-01-27 00:32:18 +03:00
|
|
|
|
|
|
|
private:
|
2015-03-29 01:22:11 +03:00
|
|
|
CPOWManager* js_;
|
|
|
|
const InfallibleTArray<CpowEntry>& cpows_;
|
2015-01-27 00:32:18 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
CPOWManager*
|
|
|
|
CPOWManagerFor(PJavaScriptParent* aParent);
|
|
|
|
|
|
|
|
CPOWManager*
|
|
|
|
CPOWManagerFor(PJavaScriptChild* aChild);
|
|
|
|
|
|
|
|
bool
|
2015-03-29 01:22:11 +03:00
|
|
|
IsCPOW(JSObject* obj);
|
2015-01-27 00:32:18 +03:00
|
|
|
|
|
|
|
bool
|
2015-03-29 01:22:11 +03:00
|
|
|
IsWrappedCPOW(JSObject* obj);
|
2015-01-27 00:32:18 +03:00
|
|
|
|
|
|
|
nsresult
|
2015-03-29 01:22:11 +03:00
|
|
|
InstanceOf(JSObject* obj, const nsID* id, bool* bp);
|
2015-01-27 00:32:18 +03:00
|
|
|
|
|
|
|
bool
|
2015-03-29 01:22:11 +03:00
|
|
|
DOMInstanceOf(JSContext* cx, JSObject* obj, int prototypeID, int depth, bool* bp);
|
2015-01-27 00:32:18 +03:00
|
|
|
|
|
|
|
void
|
2015-03-29 01:22:11 +03:00
|
|
|
GetWrappedCPOWTag(JSObject* obj, nsACString& out);
|
2015-01-27 00:32:18 +03:00
|
|
|
|
2015-03-29 01:22:11 +03:00
|
|
|
PJavaScriptParent*
|
2016-08-11 15:39:23 +03:00
|
|
|
NewJavaScriptParent();
|
2015-01-27 00:32:18 +03:00
|
|
|
|
|
|
|
void
|
2015-03-29 01:22:11 +03:00
|
|
|
ReleaseJavaScriptParent(PJavaScriptParent* parent);
|
2015-01-27 00:32:18 +03:00
|
|
|
|
2015-03-29 01:22:11 +03:00
|
|
|
PJavaScriptChild*
|
2016-08-11 15:39:23 +03:00
|
|
|
NewJavaScriptChild();
|
2015-01-27 00:32:18 +03:00
|
|
|
|
|
|
|
void
|
2015-03-29 01:22:11 +03:00
|
|
|
ReleaseJavaScriptChild(PJavaScriptChild* child);
|
2015-01-27 00:32:18 +03:00
|
|
|
|
2016-10-19 01:58:33 +03:00
|
|
|
void
|
|
|
|
AfterProcessTask();
|
|
|
|
|
2015-01-27 00:32:18 +03:00
|
|
|
} // namespace jsipc
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif // mozilla_jsipc_CrossProcessObjectWrappers_h__
|