Make all references use smart pointers.

BUG=5972398

Change-Id: I7b8c2930ccf7d64623270cd3d0550aa6a852f2e5
diff --git a/cpp/Script.cpp b/cpp/Script.cpp
index c87d460..63d5fab 100644
--- a/cpp/Script.cpp
+++ b/cpp/Script.cpp
@@ -25,11 +25,14 @@
 #include "Allocation.h"
 #include "Script.h"
 
+using namespace android;
+using namespace renderscriptCpp;
+
 void Script::invoke(uint32_t slot, const void *v, size_t len) const {
     rsScriptInvokeV(mRS->mContext, getID(), slot, v, len);
 }
 
-void Script::forEach(uint32_t slot, const Allocation *ain, const Allocation *aout,
+void Script::forEach(uint32_t slot, sp<const Allocation> ain, sp<const Allocation> aout,
                        const void *usr, size_t usrLen) const {
     if ((ain == NULL) && (aout == NULL)) {
         mRS->throwError("At least one of ain or aout is required to be non-null.");
@@ -44,12 +47,12 @@
 }
 
 
-void Script::bindAllocation(const Allocation *va, uint32_t slot) const {
+void Script::bindAllocation(sp<Allocation> va, uint32_t slot) const {
     rsScriptBindAllocation(mRS->mContext, getID(), BaseObj::getObjID(va), slot);
 }
 
 
-void Script::setVar(uint32_t index, const BaseObj *o) const {
+void Script::setVar(uint32_t index, sp<const BaseObj> o) const {
     rsScriptSetVarObj(mRS->mContext, getID(), index, (o == NULL) ? 0 : o->getID());
 }