summaryrefslogtreecommitdiff
path: root/runtime/mirror/string.cc
diff options
context:
space:
mode:
author Mathieu Chartier <mathieuc@google.com> 2014-05-07 15:43:14 -0700
committer Mathieu Chartier <mathieuc@google.com> 2014-05-13 14:45:54 -0700
commiteb8167a4f4d27fce0530f6724ab8032610cd146b (patch)
treebcfeaf13ad78f2dd68466bbd0e20c71944f7e854 /runtime/mirror/string.cc
parent6fb66a2bc4e1c0b7931101153e58714991237af7 (diff)
Add Handle/HandleScope and delete SirtRef.
Delete SirtRef and replaced it with Handle. Handles are value types which wrap around StackReference*. Renamed StackIndirectReferenceTable to HandleScope. Added a scoped handle wrapper which wraps around an Object** and restores it in its destructor. Renamed Handle::get -> Get. Bug: 8473721 Change-Id: Idbfebd4f35af629f0f43931b7c5184b334822c7a
Diffstat (limited to 'runtime/mirror/string.cc')
-rw-r--r--runtime/mirror/string.cc11
1 files changed, 6 insertions, 5 deletions
diff --git a/runtime/mirror/string.cc b/runtime/mirror/string.cc
index 6a0c225022..ee719b477b 100644
--- a/runtime/mirror/string.cc
+++ b/runtime/mirror/string.cc
@@ -22,7 +22,7 @@
#include "intern_table.h"
#include "object-inl.h"
#include "runtime.h"
-#include "sirt_ref.h"
+#include "handle_scope-inl.h"
#include "thread.h"
#include "utf-inl.h"
@@ -123,18 +123,19 @@ String* String::AllocFromModifiedUtf8(Thread* self, int32_t utf16_length,
}
String* String::Alloc(Thread* self, int32_t utf16_length) {
- SirtRef<CharArray> array(self, CharArray::Alloc(self, utf16_length));
- if (UNLIKELY(array.get() == nullptr)) {
+ StackHandleScope<1> hs(self);
+ Handle<CharArray> array(hs.NewHandle(CharArray::Alloc(self, utf16_length)));
+ if (UNLIKELY(array.Get() == nullptr)) {
return nullptr;
}
return Alloc(self, array);
}
-String* String::Alloc(Thread* self, const SirtRef<CharArray>& array) {
+String* String::Alloc(Thread* self, const Handle<CharArray>& array) {
// Hold reference in case AllocObject causes GC.
String* string = down_cast<String*>(GetJavaLangString()->AllocObject(self));
if (LIKELY(string != nullptr)) {
- string->SetArray(array.get());
+ string->SetArray(array.Get());
string->SetCount(array->GetLength());
}
return string;