summaryrefslogtreecommitdiff
path: root/src/stream_base.h
diff options
context:
space:
mode:
authorTrevor Norris <trev.norris@gmail.com>2015-06-03 15:31:33 -0600
committerTrevor Norris <trev.norris@gmail.com>2015-06-17 12:58:39 -0600
commite56758a5e0ff6822e3105c0e69eb49accc42393c (patch)
tree25cc1ce181450f78f4dbce2a8d4489752c35cf7b /src/stream_base.h
parent5d0cee46bb90084e6dcd584deb5bc893862ce3b3 (diff)
downloadandroid-node-v8-e56758a5e0ff6822e3105c0e69eb49accc42393c.tar.gz
android-node-v8-e56758a5e0ff6822e3105c0e69eb49accc42393c.tar.bz2
android-node-v8-e56758a5e0ff6822e3105c0e69eb49accc42393c.zip
async-wrap: add provider id and object info cb
Re-add the wrapper class id to AsyncWrap instances so they can be tracked directly in a heapdump. Previously the class id was given without setting the heap dump wrapper class info provider. Causing a segfault when a heapdump was taken. This has been added, and the label_ set to the given provider name so each instance can be identified. The id will not be set of the passed object has no internal field count. As the class pointer cannot be retrieved from the object. In order to properly report the allocated size of each class, the new pure virtual method self_size() has been introduces. PR-URL: https://github.com/nodejs/io.js/pull/1896 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Diffstat (limited to 'src/stream_base.h')
-rw-r--r--src/stream_base.h10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/stream_base.h b/src/stream_base.h
index dfb0d31c66..31854b3435 100644
--- a/src/stream_base.h
+++ b/src/stream_base.h
@@ -48,6 +48,7 @@ class ShutdownWrap : public ReqWrap<uv_shutdown_t>,
}
inline StreamBase* wrap() const { return wrap_; }
+ size_t self_size() const override { return sizeof(*this); }
private:
StreamBase* const wrap_;
@@ -66,6 +67,8 @@ class WriteWrap: public ReqWrap<uv_write_t>,
inline StreamBase* wrap() const { return wrap_; }
+ size_t self_size() const override { return storage_size_; }
+
static void NewWriteWrap(const v8::FunctionCallbackInfo<v8::Value>& args) {
CHECK(args.IsConstructCall());
}
@@ -76,10 +79,12 @@ class WriteWrap: public ReqWrap<uv_write_t>,
WriteWrap(Environment* env,
v8::Local<v8::Object> obj,
StreamBase* wrap,
- DoneCb cb)
+ DoneCb cb,
+ size_t storage_size)
: ReqWrap(env, obj, AsyncWrap::PROVIDER_WRITEWRAP),
StreamReq<WriteWrap>(cb),
- wrap_(wrap) {
+ wrap_(wrap),
+ storage_size_(storage_size) {
Wrap(obj, this);
}
@@ -96,6 +101,7 @@ class WriteWrap: public ReqWrap<uv_write_t>,
void operator delete(void* ptr) { UNREACHABLE(); }
StreamBase* const wrap_;
+ const size_t storage_size_;
};
class StreamResource {