Clean up ScriptGroup2 implementation

b/19944127

- Adjust ref counting
- Fix value size type in closure creation

Change-Id: I1179d34aa67f845578740e71cc2da4f82419f251
diff --git a/rsClosure.h b/rsClosure.h
index d9e41a5..ad44821 100644
--- a/rsClosure.h
+++ b/rsClosure.h
@@ -25,7 +25,7 @@
             const int numValues,
             const ScriptFieldID** fieldIDs,
             const void** values,  // Allocations or primitive (numeric) types
-            const size_t* sizes,  // size for data type. -1 indicates an allocation.
+            const int* sizes,  // size for data type. -1 indicates an allocation.
             const Closure** depClosures,
             const ScriptFieldID** depFieldIDs);
     Closure(Context* context,
@@ -35,7 +35,7 @@
             const size_t numValues,
             const ScriptFieldID** fieldIDs,
             const void** values,  // Allocations or primitive (numeric) types
-            const size_t* sizes);  // size for data type. -1 indicates an allocation.
+            const int* sizes);  // size for data type. -1 indicates an allocation.
 
     virtual ~Closure();
 
@@ -45,7 +45,7 @@
 
     void setArg(const uint32_t index, const void* value, const size_t size);
     void setGlobal(const ScriptFieldID* fieldID, const void* value,
-                   const size_t size);
+                   const int size);
 
     Context* mContext;
 
@@ -62,18 +62,18 @@
     size_t mNumArg;
 
     // A global could be allocation or any primitive data type.
-    Map<const ScriptFieldID*, Pair<const void*, size_t>> mGlobals;
+    Map<const ScriptFieldID*, Pair<const void*, int>> mGlobals;
 
     Allocation* mReturnValue;
 
     // All the other closures which this closure depends on for one of its
     // arguments, and the fields which it depends on.
-    Map<const Closure*, Map<int, const ObjectBaseRef<ScriptFieldID>*>*> mArgDeps;
+    Map<const Closure*, Map<int, ObjectBaseRef<ScriptFieldID>>*> mArgDeps;
 
     // All the other closures that this closure depends on for one of its fields,
     // and the fields that it depends on.
-    Map<const Closure*, Map<const ObjectBaseRef<ScriptFieldID>*,
-            const ObjectBaseRef<ScriptFieldID>*>*> mGlobalDeps;
+    Map<const Closure*, Map<const ScriptFieldID*,
+            ObjectBaseRef<ScriptFieldID>>*> mGlobalDeps;
 
     const void* mParams;
     const size_t mParamLength;