Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(805)

Unified Diff: src/objects.cc

Issue 1737023: Turn some usages of NewArray with DeleteArray in the same scope into ScopedVector or SmartPointer. (Closed)
Patch Set: Disabling implicit constructors Created 10 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/log.cc ('k') | src/platform-freebsd.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index 459c8aacabab8ecdc7063d26a419a39c420663a3..f4b4367d1c7d2715b2a7268804f9972beaec4776 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -682,11 +682,11 @@ bool String::MakeExternal(v8::String::ExternalStringResource* resource) {
if (FLAG_enable_slow_asserts) {
// Assert that the resource and the string are equivalent.
ASSERT(static_cast<size_t>(this->length()) == resource->length());
- SmartPointer<uc16> smart_chars(NewArray<uc16>(this->length()));
- String::WriteToFlat(this, *smart_chars, 0, this->length());
- ASSERT(memcmp(*smart_chars,
+ ScopedVector<uc16> smart_chars(this->length());
+ String::WriteToFlat(this, smart_chars.start(), 0, this->length());
+ ASSERT(memcmp(smart_chars.start(),
resource->data(),
- resource->length() * sizeof(**smart_chars)) == 0);
+ resource->length() * sizeof(smart_chars[0])) == 0);
}
#endif // DEBUG
@@ -728,11 +728,11 @@ bool String::MakeExternal(v8::String::ExternalAsciiStringResource* resource) {
if (FLAG_enable_slow_asserts) {
// Assert that the resource and the string are equivalent.
ASSERT(static_cast<size_t>(this->length()) == resource->length());
- SmartPointer<char> smart_chars(NewArray<char>(this->length()));
- String::WriteToFlat(this, *smart_chars, 0, this->length());
- ASSERT(memcmp(*smart_chars,
+ ScopedVector<char> smart_chars(this->length());
+ String::WriteToFlat(this, smart_chars.start(), 0, this->length());
+ ASSERT(memcmp(smart_chars.start(),
resource->data(),
- resource->length()*sizeof(**smart_chars)) == 0);
+ resource->length() * sizeof(smart_chars[0])) == 0);
}
#endif // DEBUG
« no previous file with comments | « src/log.cc ('k') | src/platform-freebsd.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698