2009-11-06 12:43:39 -08:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
|
|
|
* vim: set ts=8 sw=4 et tw=80:
|
|
|
|
*
|
|
|
|
* ***** BEGIN LICENSE BLOCK *****
|
|
|
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
|
|
|
*
|
|
|
|
* The contents of this file are subject to the Mozilla Public License Version
|
|
|
|
* 1.1 (the "License"); you may not use this file except in compliance with
|
|
|
|
* the License. You may obtain a copy of the License at
|
|
|
|
* http://www.mozilla.org/MPL/
|
|
|
|
*
|
|
|
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
|
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
|
|
* for the specific language governing rights and limitations under the
|
|
|
|
* License.
|
|
|
|
*
|
|
|
|
* The Original Code is mozilla.org code.
|
|
|
|
*
|
|
|
|
* The Initial Developer of the Original Code is
|
|
|
|
* The Mozilla Foundation.
|
|
|
|
* Portions created by the Initial Developer are Copyright (C) 2010
|
|
|
|
* the Initial Developer. All Rights Reserved.
|
|
|
|
*
|
|
|
|
* Contributor(s):
|
|
|
|
* Ben Newman <b{enjam,newma}n@mozilla.com> (original author)
|
|
|
|
*
|
|
|
|
* Alternatively, the contents of this file may be used under the terms of
|
|
|
|
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
|
|
|
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
|
|
|
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
|
|
* of those above. If you wish to allow use of your version of this file only
|
|
|
|
* under the terms of either the GPL or the LGPL, and not to allow others to
|
|
|
|
* use your version of this file under the terms of the MPL, indicate your
|
|
|
|
* decision by deleting the provisions above and replace them with the notice
|
|
|
|
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
|
|
* the provisions above, a recipient may use your version of this file under
|
|
|
|
* the terms of any one of the MPL, the GPL or the LGPL.
|
|
|
|
*
|
|
|
|
* ***** END LICENSE BLOCK ***** */
|
|
|
|
|
|
|
|
#ifndef mozilla_jsipc_ObjectWrapperChild_h__
|
|
|
|
#define mozilla_jsipc_ObjectWrapperChild_h__
|
|
|
|
|
|
|
|
#include "mozilla/jsipc/PObjectWrapperChild.h"
|
|
|
|
|
2010-01-22 12:52:57 -08:00
|
|
|
// For OperationChecker and AutoCheckOperationBase.
|
|
|
|
#include "mozilla/jsipc/ObjectWrapperParent.h"
|
|
|
|
|
2009-11-06 12:43:39 -08:00
|
|
|
using mozilla::jsipc::JSVariant;
|
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace jsipc {
|
|
|
|
|
|
|
|
class ContextWrapperChild;
|
2010-01-22 12:52:57 -08:00
|
|
|
|
2009-11-06 12:43:39 -08:00
|
|
|
class ObjectWrapperChild
|
|
|
|
: public PObjectWrapperChild
|
2010-01-22 12:52:57 -08:00
|
|
|
, public OperationChecker
|
2009-11-06 12:43:39 -08:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
ObjectWrapperChild(JSContext* cx, JSObject* obj);
|
|
|
|
|
|
|
|
JSObject* GetJSObject() const { return mObj; }
|
2010-01-22 12:52:57 -08:00
|
|
|
|
|
|
|
void CheckOperation(JSContext* cx, OperationStatus* status);
|
2009-11-06 12:43:39 -08:00
|
|
|
|
|
|
|
private:
|
|
|
|
|
2010-07-02 18:17:06 -07:00
|
|
|
JSObject* mObj;
|
2009-11-06 12:43:39 -08:00
|
|
|
|
|
|
|
bool JSObject_to_JSVariant(JSContext* cx, JSObject* from, JSVariant* to);
|
|
|
|
bool jsval_to_JSVariant(JSContext* cx, jsval from, JSVariant* to);
|
|
|
|
|
|
|
|
static bool JSObject_from_PObjectWrapperChild(JSContext* cx,
|
|
|
|
const PObjectWrapperChild* from,
|
|
|
|
JSObject** to);
|
|
|
|
static bool JSObject_from_JSVariant(JSContext* cx, const JSVariant& from,
|
|
|
|
JSObject** to);
|
|
|
|
static bool jsval_from_JSVariant(JSContext* cx, const JSVariant& from,
|
|
|
|
jsval* to);
|
|
|
|
|
|
|
|
ContextWrapperChild* Manager();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
void ActorDestroy(ActorDestroyReason why);
|
|
|
|
|
|
|
|
bool AnswerAddProperty(const nsString& id,
|
2010-01-22 12:52:57 -08:00
|
|
|
OperationStatus* status);
|
2009-11-06 12:43:39 -08:00
|
|
|
|
|
|
|
bool AnswerGetProperty(const nsString& id,
|
2010-01-22 12:52:57 -08:00
|
|
|
OperationStatus* status, JSVariant* vp);
|
2009-11-06 12:43:39 -08:00
|
|
|
|
|
|
|
bool AnswerSetProperty(const nsString& id, const JSVariant& v,
|
2010-01-22 12:52:57 -08:00
|
|
|
OperationStatus* status, JSVariant* vp);
|
2009-11-06 12:43:39 -08:00
|
|
|
|
|
|
|
bool AnswerDelProperty(const nsString& id,
|
2010-01-22 12:52:57 -08:00
|
|
|
OperationStatus* status, JSVariant* vp);
|
2009-11-06 12:43:39 -08:00
|
|
|
|
|
|
|
bool AnswerNewEnumerateInit(/* no in-parameters */
|
2010-01-22 12:52:57 -08:00
|
|
|
OperationStatus* status, JSVariant* statep, int* idp);
|
2009-11-06 12:43:39 -08:00
|
|
|
|
|
|
|
bool AnswerNewEnumerateNext(const JSVariant& in_state,
|
2010-01-22 12:52:57 -08:00
|
|
|
OperationStatus* status, JSVariant* statep, nsString* idp);
|
2009-11-06 12:43:39 -08:00
|
|
|
|
|
|
|
bool RecvNewEnumerateDestroy(const JSVariant& in_state);
|
|
|
|
|
|
|
|
bool AnswerNewResolve(const nsString& id, const int& flags,
|
2010-01-22 12:52:57 -08:00
|
|
|
OperationStatus* status, PObjectWrapperChild** obj2);
|
2009-11-06 12:43:39 -08:00
|
|
|
|
|
|
|
bool AnswerConvert(const JSType& type,
|
2010-01-22 12:52:57 -08:00
|
|
|
OperationStatus* status, JSVariant* vp);
|
2009-11-06 12:43:39 -08:00
|
|
|
|
2010-11-08 18:49:00 -08:00
|
|
|
bool AnswerCall(PObjectWrapperChild* receiver, const InfallibleTArray<JSVariant>& argv,
|
2010-01-22 12:52:57 -08:00
|
|
|
OperationStatus* status, JSVariant* rval);
|
2009-11-06 12:43:39 -08:00
|
|
|
|
2010-11-08 18:49:00 -08:00
|
|
|
bool AnswerConstruct(const InfallibleTArray<JSVariant>& argv,
|
2010-01-22 12:52:57 -08:00
|
|
|
OperationStatus* status, PObjectWrapperChild** rval);
|
2009-11-06 12:43:39 -08:00
|
|
|
|
|
|
|
bool AnswerHasInstance(const JSVariant& v,
|
2010-01-22 12:52:57 -08:00
|
|
|
OperationStatus* status, JSBool* bp);
|
2009-11-06 12:43:39 -08:00
|
|
|
};
|
|
|
|
|
|
|
|
}}
|
|
|
|
|
|
|
|
#endif
|