diff options
author | Mikko Harju <mikko.a.harju@nokia.com> | 2011-10-12 09:41:10 +0300 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-10-12 13:43:04 +0200 |
commit | bdc94b43a90d003755255c59d94569b4a79c1126 (patch) | |
tree | 9cc5bc3e3ef8cf8bd424c9b0a8db9c3fce18978d /src | |
parent | e296dbcf5dc70a102b5e865277e52ba550619f0f (diff) |
Fix V8 heap snapshot in profiler service
Fixes the message parsing (use the option also for heap snapshot
commands).
Do not directly serialize the snapshot to the QByteArray under
QDataStream.
Change-Id: I3ad15a2debd6c2f912854610b6434744e0acd788
Reviewed-by: Christiaan Janssen <christiaan.janssen@nokia.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/declarative/debugger/qv8profilerservice.cpp | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/src/declarative/debugger/qv8profilerservice.cpp b/src/declarative/debugger/qv8profilerservice.cpp index 0afa4fa6c1..9195729c46 100644 --- a/src/declarative/debugger/qv8profilerservice.cpp +++ b/src/declarative/debugger/qv8profilerservice.cpp @@ -160,14 +160,12 @@ void QV8ProfilerService::messageReceived(const QByteArray &message) } if (command == "V8SNAPSHOT") { - QByteArray snapshotType; - ds >> snapshotType; - - if (snapshotType == "full") - d->takeSnapshot(v8::HeapSnapshot::kFull); - } else if (command == "deletesnapshots") { + if (option == "full") + d->takeSnapshot(v8::HeapSnapshot::kFull); + else if (option == "delete") { v8::HeapProfiler::DeleteAllSnapshots(); } + } QDeclarativeDebugService::messageReceived(message); } @@ -218,14 +216,14 @@ void QV8ProfilerServicePrivate::takeSnapshot(v8::HeapSnapshot::Type snapshotType v8::HandleScope scope; v8::Local<v8::String> title = v8::String::New(""); + QByteArray jsonSnapshot; + ByteArrayOutputStream bos(&jsonSnapshot); const v8::HeapSnapshot *snapshot = v8::HeapProfiler::TakeSnapshot(title, snapshotType); + snapshot->Serialize(&bos, v8::HeapSnapshot::kJSON); QByteArray data; QDataStream ds(&data, QIODevice::WriteOnly); - ds << (int)QV8ProfilerService::V8Snapshot; - - ByteArrayOutputStream bos(&data); - snapshot->Serialize(&bos, v8::HeapSnapshot::kJSON); + ds << (int)QV8ProfilerService::V8Snapshot << jsonSnapshot; q->sendMessage(data); } |