author Ben Turner <>
Sat, 09 Feb 2013 17:59:47 +0000
changeset 121507 ad49bd35d558686f74d72f86717878117636da59
parent 114925 89ae1345e585eeaab70c1997bc28a01829ecfe83
child 146952 4bdb0462804b384e4a016b99c858e7765c7800dd
permissions -rw-r--r--
Bug 835698 - 'Pre-open() and send the fd for app process's'. r=jduell.

/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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 */


#include <ostream>
#include <stdlib.h>
#include "JSAObjectBuilder.h"

class JSCustomObject;
class JSCustomArray;
class JSCustomObjectBuilder;

class JSCustomObjectBuilder : public JSAObjectBuilder

  // We need to ensure that this object lives on the stack so that GC sees it properly

  void Serialize(JSCustomObject* aObject, std::ostream& stream);

  void DefineProperty(JSCustomObject *aObject, const char *name, JSCustomObject *aValue);
  void DefineProperty(JSCustomObject *aObject, const char *name, JSCustomArray *aValue);
  void DefineProperty(JSCustomObject *aObject, const char *name, int value);
  void DefineProperty(JSCustomObject *aObject, const char *name, double value);
  void DefineProperty(JSCustomObject *aObject, const char *name, const char *value, size_t valueLength);
  void DefineProperty(JSCustomObject *aObject, const char *name, const char *value);
  void ArrayPush(JSCustomArray *aArray, int value);
  void ArrayPush(JSCustomArray *aArray, const char *value);
  void ArrayPush(JSCustomArray *aArray, JSCustomObject *aObject);
  JSCustomArray  *CreateArray();
  JSCustomObject *CreateObject();

  // Delete this object and all of its descendant
  void DeleteObject(JSCustomObject* aObject);

  // This class can't be copied
  JSCustomObjectBuilder(const JSCustomObjectBuilder&);
  JSCustomObjectBuilder& operator=(const JSCustomObjectBuilder&);

  void* operator new(size_t);
  void* operator new[](size_t);
  void operator delete(void*) {
    // Since JSCustomObjectBuilder has a virtual destructor the compiler
    // has to provide a destructor in the object file that will call
    // operate delete in case there is a derived class since its
    // destructor wont know how to free this instance.
  void operator delete[](void*);