Bug 667652: Add a JS_FRIEND_API to get at the current offset in a structured clone buffer. r=jorendorff.

This commit is contained in:
Kyle Huey 2011-06-29 12:09:15 -07:00
parent 9a5c874715
commit 99aa56bee4
2 changed files with 12 additions and 0 deletions

View File

@ -46,6 +46,13 @@
using namespace js;
JS_FRIEND_API(uint64_t)
js_GetSCOffset(JSStructuredCloneWriter* writer)
{
JS_ASSERT(writer);
return writer->output().count() * sizeof(uint64_t);
}
namespace js
{

View File

@ -46,6 +46,9 @@
#include "jsvector.h"
#include "jsvalue.h"
JS_FRIEND_API(uint64_t)
js_GetSCOffset(JSStructuredCloneWriter* writer);
namespace js {
bool
@ -73,6 +76,8 @@ struct SCOutput {
bool extractBuffer(uint64_t **datap, size_t *sizep);
uint64_t count() { return buf.length(); }
private:
JSContext *cx;
js::Vector<uint64_t> buf;