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

Unified Diff: src/objects.cc

Issue 2173403002: Replace SmartArrayPointer<T> with unique_ptr<T[]> (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: even less redness Created 4 years, 5 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
Index: src/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index 503354cd373fcb69e04ee01637df8d374e241191..6f37fbc7f2d3c5ec571a2a245cdafbdff16aaf86 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -6,6 +6,7 @@
#include <cmath>
#include <iomanip>
+#include <memory>
#include <sstream>
#include "src/objects-inl.h"
@@ -2460,8 +2461,7 @@ void HeapObject::HeapObjectShortPrint(std::ostream& os) { // NOLINT
case SHARED_FUNCTION_INFO_TYPE: {
SharedFunctionInfo* shared = SharedFunctionInfo::cast(this);
- base::SmartArrayPointer<char> debug_name =
- shared->DebugName()->ToCString();
+ std::unique_ptr<char[]> debug_name = shared->DebugName()->ToCString();
if (debug_name[0] != 0) {
os << "<SharedFunctionInfo " << debug_name.get() << ">";
} else {
@@ -10412,13 +10412,12 @@ String::FlatContent String::GetFlatContent() {
}
}
-
-base::SmartArrayPointer<char> String::ToCString(AllowNullsFlag allow_nulls,
- RobustnessFlag robust_flag,
- int offset, int length,
- int* length_return) {
+std::unique_ptr<char[]> String::ToCString(AllowNullsFlag allow_nulls,
+ RobustnessFlag robust_flag,
+ int offset, int length,
+ int* length_return) {
if (robust_flag == ROBUST_STRING_TRAVERSAL && !LooksValid()) {
- return base::SmartArrayPointer<char>(NULL);
+ return std::unique_ptr<char[]>(nullptr);
Igor Sheludko 2016/07/25 08:56:44 return std::unique_ptr<char[]>() ?
jochen (gone - plz use gerrit) 2016/07/25 09:14:48 done
}
// Negative length means the to the end of the string.
if (length < 0) length = kMaxInt - offset;
@@ -10455,13 +10454,12 @@ base::SmartArrayPointer<char> String::ToCString(AllowNullsFlag allow_nulls,
last = character;
}
result[utf8_byte_position] = 0;
- return base::SmartArrayPointer<char>(result);
+ return std::unique_ptr<char[]>(result);
}
-
-base::SmartArrayPointer<char> String::ToCString(AllowNullsFlag allow_nulls,
- RobustnessFlag robust_flag,
- int* length_return) {
+std::unique_ptr<char[]> String::ToCString(AllowNullsFlag allow_nulls,
+ RobustnessFlag robust_flag,
+ int* length_return) {
return ToCString(allow_nulls, robust_flag, 0, -1, length_return);
}
@@ -12546,7 +12544,7 @@ MaybeHandle<Map> JSFunction::GetDerivedMap(Isolate* isolate,
void JSFunction::PrintName(FILE* out) {
- base::SmartArrayPointer<char> name = shared()->DebugName()->ToCString();
+ std::unique_ptr<char[]> name = shared()->DebugName()->ToCString();
PrintF(out, "%s", name.get());
}

Powered by Google App Engine
This is Rietveld 408576698