diff options
author | Joyee Cheung <joyeec9h3@gmail.com> | 2019-03-15 08:37:59 +0800 |
---|---|---|
committer | Joyee Cheung <joyeec9h3@gmail.com> | 2019-03-19 01:04:51 +0800 |
commit | ebcd50298e4daf59991a73557445155d8a64dbb1 (patch) | |
tree | e308ca761204c8d89963de1d067e2c4314590cc3 /src/heap_utils.cc | |
parent | 6d090124fd69516516d0b9c79b0bf3f8f072cef0 (diff) | |
download | android-node-v8-ebcd50298e4daf59991a73557445155d8a64dbb1.tar.gz android-node-v8-ebcd50298e4daf59991a73557445155d8a64dbb1.tar.bz2 android-node-v8-ebcd50298e4daf59991a73557445155d8a64dbb1.zip |
src: replace heap_utils.createHeapSnapshot with v8.getHeapSnapshot
Remove the internal testing utility and use the public API instead.
PR-URL: https://github.com/nodejs/node/pull/26671
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Minwoo Jung <minwoo@nodesource.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Diffstat (limited to 'src/heap_utils.cc')
-rw-r--r-- | src/heap_utils.cc | 48 |
1 files changed, 0 insertions, 48 deletions
diff --git a/src/heap_utils.cc b/src/heap_utils.cc index c54f0c41d7..6690abc78d 100644 --- a/src/heap_utils.cc +++ b/src/heap_utils.cc @@ -200,40 +200,6 @@ void BuildEmbedderGraph(const FunctionCallbackInfo<Value>& args) { args.GetReturnValue().Set(ret); } - -class BufferOutputStream : public v8::OutputStream { - public: - BufferOutputStream() : buffer_(new JSString()) {} - - void EndOfStream() override {} - int GetChunkSize() override { return 1024 * 1024; } - WriteResult WriteAsciiChunk(char* data, int size) override { - buffer_->Append(data, size); - return kContinue; - } - - Local<String> ToString(Isolate* isolate) { - return String::NewExternalOneByte(isolate, - buffer_.release()).ToLocalChecked(); - } - - private: - class JSString : public String::ExternalOneByteStringResource { - public: - void Append(char* data, size_t count) { - store_.append(data, count); - } - - const char* data() const override { return store_.data(); } - size_t length() const override { return store_.size(); } - - private: - std::string store_; - }; - - std::unique_ptr<JSString> buffer_; -}; - namespace { class FileOutputStream : public v8::OutputStream { public: @@ -370,17 +336,6 @@ inline bool WriteSnapshot(Isolate* isolate, const char* filename) { } // namespace -void CreateHeapSnapshot(const FunctionCallbackInfo<Value>& args) { - Isolate* isolate = args.GetIsolate(); - BufferOutputStream out; - TakeSnapshot(isolate, &out); - Local<Value> ret; - if (JSON::Parse(isolate->GetCurrentContext(), - out.ToString(isolate)).ToLocal(&ret)) { - args.GetReturnValue().Set(ret); - } -} - void CreateHeapSnapshotStream(const FunctionCallbackInfo<Value>& args) { Environment* env = Environment::GetCurrent(args); HandleScope scope(env->isolate()); @@ -431,9 +386,6 @@ void Initialize(Local<Object> target, "buildEmbedderGraph", BuildEmbedderGraph); env->SetMethodNoSideEffect(target, - "createHeapSnapshot", - CreateHeapSnapshot); - env->SetMethodNoSideEffect(target, "triggerHeapSnapshot", TriggerHeapSnapshot); env->SetMethodNoSideEffect(target, |