Bug 731898: Remove typedef jsrefcount, r=luke

This commit is contained in:
David Mandelin 2012-03-01 11:43:17 -08:00
parent 74ecbd9572
commit 5c3e02ec67
7 changed files with 21 additions and 22 deletions

View File

@ -1073,14 +1073,14 @@ JS_YieldRequest(JSContext *cx)
#endif #endif
} }
JS_PUBLIC_API(jsrefcount) JS_PUBLIC_API(unsigned)
JS_SuspendRequest(JSContext *cx) JS_SuspendRequest(JSContext *cx)
{ {
#ifdef JS_THREADSAFE #ifdef JS_THREADSAFE
JSRuntime *rt = cx->runtime; JSRuntime *rt = cx->runtime;
JS_ASSERT(rt->onOwnerThread()); JS_ASSERT(rt->onOwnerThread());
jsrefcount saveDepth = rt->requestDepth; unsigned saveDepth = rt->requestDepth;
if (!saveDepth) if (!saveDepth)
return 0; return 0;
@ -1094,7 +1094,7 @@ JS_SuspendRequest(JSContext *cx)
} }
JS_PUBLIC_API(void) JS_PUBLIC_API(void)
JS_ResumeRequest(JSContext *cx, jsrefcount saveDepth) JS_ResumeRequest(JSContext *cx, unsigned saveDepth)
{ {
#ifdef JS_THREADSAFE #ifdef JS_THREADSAFE
JSRuntime *rt = cx->runtime; JSRuntime *rt = cx->runtime;
@ -4447,16 +4447,16 @@ JS_CheckAccess(JSContext *cx, JSObject *obj, jsid id, JSAccessMode mode,
} }
#ifdef JS_THREADSAFE #ifdef JS_THREADSAFE
JS_PUBLIC_API(jsrefcount) JS_PUBLIC_API(unsigned)
JS_HoldPrincipals(JSContext *cx, JSPrincipals *principals) JS_HoldPrincipals(JSContext *cx, JSPrincipals *principals)
{ {
return JS_ATOMIC_INCREMENT(&principals->refcount); return JS_ATOMIC_INCREMENT(&principals->refcount);
} }
JS_PUBLIC_API(jsrefcount) JS_PUBLIC_API(unsigned)
JS_DropPrincipals(JSContext *cx, JSPrincipals *principals) JS_DropPrincipals(JSContext *cx, JSPrincipals *principals)
{ {
jsrefcount rc = JS_ATOMIC_DECREMENT(&principals->refcount); unsigned rc = JS_ATOMIC_DECREMENT(&principals->refcount);
if (rc == 0) if (rc == 0)
principals->destroy(cx, principals); principals->destroy(cx, principals);
return rc; return rc;

View File

@ -2351,11 +2351,11 @@ JS_EndRequest(JSContext *cx);
extern JS_PUBLIC_API(void) extern JS_PUBLIC_API(void)
JS_YieldRequest(JSContext *cx); JS_YieldRequest(JSContext *cx);
extern JS_PUBLIC_API(jsrefcount) extern JS_PUBLIC_API(unsigned)
JS_SuspendRequest(JSContext *cx); JS_SuspendRequest(JSContext *cx);
extern JS_PUBLIC_API(void) extern JS_PUBLIC_API(void)
JS_ResumeRequest(JSContext *cx, jsrefcount saveDepth); JS_ResumeRequest(JSContext *cx, unsigned saveDepth);
extern JS_PUBLIC_API(JSBool) extern JS_PUBLIC_API(JSBool)
JS_IsInRequest(JSRuntime *rt); JS_IsInRequest(JSRuntime *rt);
@ -2396,7 +2396,7 @@ class JSAutoRequest {
protected: protected:
JSContext *mContext; JSContext *mContext;
jsrefcount mSaveDepth; unsigned mSaveDepth;
JS_DECL_USE_GUARD_OBJECT_NOTIFIER JS_DECL_USE_GUARD_OBJECT_NOTIFIER
#if 0 #if 0
@ -2428,7 +2428,7 @@ class JSAutoSuspendRequest {
protected: protected:
JSContext *mContext; JSContext *mContext;
jsrefcount mSaveDepth; unsigned mSaveDepth;
JS_DECL_USE_GUARD_OBJECT_NOTIFIER JS_DECL_USE_GUARD_OBJECT_NOTIFIER
#if 0 #if 0
@ -4085,7 +4085,7 @@ struct JSPrincipals {
char *codebase; char *codebase;
/* Don't call "destroy"; use reference counting macros below. */ /* Don't call "destroy"; use reference counting macros below. */
jsrefcount refcount; unsigned refcount;
void (* destroy)(JSContext *cx, JSPrincipals *); void (* destroy)(JSContext *cx, JSPrincipals *);
JSBool (* subsume)(JSPrincipals *, JSPrincipals *); JSBool (* subsume)(JSPrincipals *, JSPrincipals *);
@ -4095,10 +4095,10 @@ struct JSPrincipals {
#define JSPRINCIPALS_HOLD(cx, principals) JS_HoldPrincipals(cx,principals) #define JSPRINCIPALS_HOLD(cx, principals) JS_HoldPrincipals(cx,principals)
#define JSPRINCIPALS_DROP(cx, principals) JS_DropPrincipals(cx,principals) #define JSPRINCIPALS_DROP(cx, principals) JS_DropPrincipals(cx,principals)
extern JS_PUBLIC_API(jsrefcount) extern JS_PUBLIC_API(unsigned)
JS_HoldPrincipals(JSContext *cx, JSPrincipals *principals); JS_HoldPrincipals(JSContext *cx, JSPrincipals *principals);
extern JS_PUBLIC_API(jsrefcount) extern JS_PUBLIC_API(unsigned)
JS_DropPrincipals(JSContext *cx, JSPrincipals *principals); JS_DropPrincipals(JSContext *cx, JSPrincipals *principals);
#else #else

View File

@ -86,7 +86,7 @@ struct JSSharpInfo {
typedef js::HashMap<JSObject *, JSSharpInfo> JSSharpTable; typedef js::HashMap<JSObject *, JSSharpInfo> JSSharpTable;
struct JSSharpObjectMap { struct JSSharpObjectMap {
jsrefcount depth; unsigned depth;
uint32_t sharpgen; uint32_t sharpgen;
JSSharpTable table; JSSharpTable table;
@ -293,7 +293,7 @@ struct JSRuntime : js::RuntimeFriendFields
js::RootedValueMap gcRootsHash; js::RootedValueMap gcRootsHash;
js::GCLocks gcLocksHash; js::GCLocks gcLocksHash;
jsrefcount gcKeepAtoms; unsigned gcKeepAtoms;
size_t gcBytes; size_t gcBytes;
size_t gcMaxBytes; size_t gcMaxBytes;
size_t gcMaxMallocBytes; size_t gcMaxMallocBytes;

View File

@ -270,10 +270,10 @@ struct JSCompartment
#ifdef DEBUG #ifdef DEBUG
/* Property metering. */ /* Property metering. */
jsrefcount livePropTreeNodes; unsigned livePropTreeNodes;
jsrefcount totalPropTreeNodes; unsigned totalPropTreeNodes;
jsrefcount propTreeKidsChunks; unsigned propTreeKidsChunks;
jsrefcount liveDictModeNodes; unsigned liveDictModeNodes;
#endif #endif
/* Set of all unowned base shapes in the compartment. */ /* Set of all unowned base shapes in the compartment. */

View File

@ -96,7 +96,6 @@ JS_BEGIN_EXTERN_C
/* Scalar typedefs. */ /* Scalar typedefs. */
typedef int32_t jsint; typedef int32_t jsint;
typedef uint32_t jsuint; typedef uint32_t jsuint;
typedef int32_t jsrefcount; /* PRInt32 if JS_THREADSAFE, see jslock.h */
#ifdef WIN32 #ifdef WIN32
typedef wchar_t jschar; typedef wchar_t jschar;

View File

@ -1619,7 +1619,7 @@ CountHeap(JSContext *cx, unsigned argc, jsval *vp)
return JS_NewNumberValue(cx, (double) counter, vp); return JS_NewNumberValue(cx, (double) counter, vp);
} }
static jsrefcount finalizeCount = 0; static unsigned finalizeCount = 0;
static void static void
finalize_counter_finalize(JSContext *cx, JSObject *obj) finalize_counter_finalize(JSContext *cx, JSObject *obj)

View File

@ -3586,7 +3586,7 @@ struct XPCJSContextInfo {
bool savedFrameChain; bool savedFrameChain;
// Greater than 0 if a request was suspended. // Greater than 0 if a request was suspended.
jsrefcount suspendDepth; unsigned suspendDepth;
}; };
class XPCJSContextStack class XPCJSContextStack