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

Side by Side Diff: src/api.cc

Issue 3311028: Implement heap snapshots serialization into JSON. API is designed (Closed)
Patch Set: Comments addressed Created 10 years, 3 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 unified diff | Download patch
« no previous file with comments | « include/v8-profiler.h ('k') | src/profile-generator.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2009 the V8 project authors. All rights reserved. 1 // Copyright 2009 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 4721 matching lines...) Expand 10 before | Expand all | Expand 10 after
4732 4732
4733 4733
4734 const HeapSnapshotsDiff* HeapSnapshot::CompareWith( 4734 const HeapSnapshotsDiff* HeapSnapshot::CompareWith(
4735 const HeapSnapshot* snapshot) const { 4735 const HeapSnapshot* snapshot) const {
4736 IsDeadCheck("v8::HeapSnapshot::CompareWith"); 4736 IsDeadCheck("v8::HeapSnapshot::CompareWith");
4737 return reinterpret_cast<const HeapSnapshotsDiff*>( 4737 return reinterpret_cast<const HeapSnapshotsDiff*>(
4738 ToInternal(this)->CompareWith(ToInternal(snapshot))); 4738 ToInternal(this)->CompareWith(ToInternal(snapshot)));
4739 } 4739 }
4740 4740
4741 4741
4742 void HeapSnapshot::Serialize(OutputStream* stream,
4743 HeapSnapshot::SerializationFormat format) const {
4744 IsDeadCheck("v8::HeapSnapshot::Serialize");
4745 ApiCheck(format == kJSON,
4746 "v8::HeapSnapshot::Serialize",
4747 "Unknown serialization format");
4748 ApiCheck(stream->GetOutputEncoding() == OutputStream::kAscii,
4749 "v8::HeapSnapshot::Serialize",
4750 "Unsupported output encoding");
4751 ApiCheck(stream->GetChunkSize() > 0,
4752 "v8::HeapSnapshot::Serialize",
4753 "Invalid stream chunk size");
4754 i::HeapSnapshotJSONSerializer serializer(ToInternal(this));
4755 serializer.Serialize(stream);
4756 }
4757
4758
4742 int HeapProfiler::GetSnapshotsCount() { 4759 int HeapProfiler::GetSnapshotsCount() {
4743 IsDeadCheck("v8::HeapProfiler::GetSnapshotsCount"); 4760 IsDeadCheck("v8::HeapProfiler::GetSnapshotsCount");
4744 return i::HeapProfiler::GetSnapshotsCount(); 4761 return i::HeapProfiler::GetSnapshotsCount();
4745 } 4762 }
4746 4763
4747 4764
4748 const HeapSnapshot* HeapProfiler::GetSnapshot(int index) { 4765 const HeapSnapshot* HeapProfiler::GetSnapshot(int index) {
4749 IsDeadCheck("v8::HeapProfiler::GetSnapshot"); 4766 IsDeadCheck("v8::HeapProfiler::GetSnapshot");
4750 return reinterpret_cast<const HeapSnapshot*>( 4767 return reinterpret_cast<const HeapSnapshot*>(
4751 i::HeapProfiler::GetSnapshot(index)); 4768 i::HeapProfiler::GetSnapshot(index));
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
4856 4873
4857 4874
4858 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) { 4875 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) {
4859 HandleScopeImplementer* thread_local = 4876 HandleScopeImplementer* thread_local =
4860 reinterpret_cast<HandleScopeImplementer*>(storage); 4877 reinterpret_cast<HandleScopeImplementer*>(storage);
4861 thread_local->IterateThis(v); 4878 thread_local->IterateThis(v);
4862 return storage + ArchiveSpacePerThread(); 4879 return storage + ArchiveSpacePerThread();
4863 } 4880 }
4864 4881
4865 } } // namespace v8::internal 4882 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « include/v8-profiler.h ('k') | src/profile-generator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698