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

Unified Diff: src/uri.cc

Issue 2006673002: Reduce boilerplace for common pattern to return MaybeHandle. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: rebase and fix Created 4 years, 7 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/uri.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/uri.cc
diff --git a/src/uri.cc b/src/uri.cc
index c459be5e53f4ad915d669a0122cec77b1d1889e2..13360fa0a1b56811301ccb873f8f28517c03be3b 100644
--- a/src/uri.cc
+++ b/src/uri.cc
@@ -89,7 +89,8 @@ void EncodePair(uc16 cc1, uc16 cc2, List<uint8_t>* buffer) {
} // anonymous namespace
-Object* Uri::Encode(Isolate* isolate, Handle<String> uri, bool is_uri) {
+MaybeHandle<String> Uri::Encode(Isolate* isolate, Handle<String> uri,
+ bool is_uri) {
uri = String::Flatten(uri);
int uri_length = uri->length();
List<uint8_t> buffer(uri_length);
@@ -120,15 +121,11 @@ Object* Uri::Encode(Isolate* isolate, Handle<String> uri, bool is_uri) {
}
AllowHeapAllocation allocate_error_and_return;
- THROW_NEW_ERROR_RETURN_FAILURE(isolate, NewURIError());
+ THROW_NEW_ERROR(isolate, NewURIError(), String);
}
}
- Handle<String> result;
- ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
- isolate, result,
- isolate->factory()->NewStringFromOneByte(buffer.ToConstVector()));
- return *result;
+ return isolate->factory()->NewStringFromOneByte(buffer.ToConstVector());
}
} // namespace internal
« no previous file with comments | « src/uri.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698