gecko/dom/bindings/stubgenerator/Skeleton.cpp
Ehsan Akhgari 697bec41a5 Bug 793294 - Implement AudioBuffer; r=bzbarsky,smaug
This is the full implementation of the AudioBuffer object.  There are
two ways to create these objects from an audio context and this patch
implements only one of them.

The construction of the AudioBuffer object is a two step process: the
object should be created with operator new first, and then
InitializeBuffers should be called on it.  InitializeBuffers is
fallible, because it uses the JS API to create the underlying typed
arrays, but that's fine, since the length of the buffers comes from web
content, and we don't want to use infallible allocations for those
anyways.

We hold on to the JS objects from the C++ implementation, and trace
through all of those objects, so that a GC does not kill those object
without us knowing.

The buffer should be possible to manipulate from both C++ and JS, and
the C++ object probably needs to support a set of methods for the C++
callers at some point.
2012-09-25 17:58:50 -04:00

41 lines
999 B
C++

/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:set ts=2 sw=2 sts=2 et cindent: */
/* 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/. */
#include "Skeleton.h"
#include "mozilla/dom/SkeletonBinding.h"
#include "nsContentUtils.h"
namespace mozilla {
namespace dom {
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_0(Skeleton)
NS_IMPL_CYCLE_COLLECTING_ADDREF(Skeleton)
NS_IMPL_CYCLE_COLLECTING_RELEASE(Skeleton)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(Skeleton)
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
NS_INTERFACE_MAP_ENTRY(nsISupports)
NS_INTERFACE_MAP_END
Skeleton::Skeleton()
{
SetIsDOMBinding();
}
Skeleton::~Skeleton()
{
}
JSObject*
Skeleton::WrapObject(JSContext* aCx, JSObject* aScope,
bool* aTriedToWrap)
{
return SkeletonBinding::Wrap(aCx, aScope, this, aTriedToWrap);
}
}
}