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

Unified Diff: src/vector.h

Issue 1911313002: Pass debug name as Vector instead of const char* (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@wasm-offset-table-1
Patch Set: Created 4 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
Index: src/vector.h
diff --git a/src/vector.h b/src/vector.h
index e4637c91c9804fe5f191976e0ed1a0f9e7a4979c..d120dfc4ac70c36ff9cbc7340546b356f529babd 100644
--- a/src/vector.h
+++ b/src/vector.h
@@ -24,6 +24,9 @@ class Vector {
DCHECK(length == 0 || (length > 0 && data != NULL));
}
+ template <int N>
+ explicit Vector(T (&arr)[N]) : start_(arr), length_(N) {}
+
static Vector<T> New(int length) {
return Vector<T>(NewArray<T>(length), length);
}
@@ -201,6 +204,10 @@ inline Vector<char> MutableCStrVector(char* data, int max) {
return Vector<char>(data, (length < max) ? length : max);
}
+template <typename T, int N>
titzer 2016/04/22 11:46:30 Since this is only ever used for C strings (now),
Clemens Hammacher 2016/04/22 13:47:54 CStrVector is already there, but it takes a const
titzer 2016/04/22 13:51:45 Yeah, I'd rather just make a small addition now an
+inline Vector<T> ArrayVector(T (&arr)[N]) {
+ return Vector<T>(arr);
+}
} // namespace internal
} // namespace v8

Powered by Google App Engine
This is Rietveld 408576698