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

Unified Diff: src/api.cc

Issue 1922603006: [JSON] implement indentation in the BasicJsonStringifier and expose via API. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: rebase 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 | « include/v8.h ('k') | src/js/json.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/api.cc
diff --git a/src/api.cc b/src/api.cc
index a4e047c9b64a6b9c66c8618a3376f9a5ba12e540..a2615fd90a9f3bc5289a769f474b4da3513d5058 100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -2769,12 +2769,17 @@ Local<Value> JSON::Parse(Local<String> json_string) {
}
MaybeLocal<String> JSON::Stringify(Local<Context> context,
- Local<Object> json_object) {
+ Local<Object> json_object,
+ Local<String> gap) {
PREPARE_FOR_EXECUTION(context, JSON, Stringify, String);
i::Handle<i::Object> object = Utils::OpenHandle(*json_object);
+ i::Handle<i::String> gap_string = gap.IsEmpty()
+ ? isolate->factory()->empty_string()
+ : Utils::OpenHandle(*gap);
i::Handle<i::Object> maybe;
has_pending_exception =
- !i::Runtime::BasicJsonStringify(isolate, object).ToHandle(&maybe);
+ !i::Runtime::BasicJsonStringify(isolate, object, gap_string)
+ .ToHandle(&maybe);
RETURN_ON_FAILED_EXECUTION(String);
Local<String> result;
has_pending_exception =
« no previous file with comments | « include/v8.h ('k') | src/js/json.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698