Commit 619d4535 authored by yurys's avatar yurys Committed by Commit bot

Remove uid and title from HeapSnapshot

None of these fields is used in Blink. Embedder always can implement them using existing API.

BUG=chromium:465651
LOG=Y

Review URL: https://codereview.chromium.org/983833006

Cr-Commit-Position: refs/heads/master@{#27113}
parent 0fcebccd
...@@ -313,12 +313,6 @@ class V8_EXPORT HeapSnapshot { ...@@ -313,12 +313,6 @@ class V8_EXPORT HeapSnapshot {
kJSON = 0 // See format description near 'Serialize' method. kJSON = 0 // See format description near 'Serialize' method.
}; };
/** Returns heap snapshot UID (assigned by the profiler.) */
unsigned GetUid() const;
/** Returns heap snapshot title. */
Handle<String> GetTitle() const;
/** Returns the root node of the heap graph. */ /** Returns the root node of the heap graph. */
const HeapGraphNode* GetRoot() const; const HeapGraphNode* GetRoot() const;
...@@ -367,7 +361,8 @@ class V8_EXPORT HeapSnapshot { ...@@ -367,7 +361,8 @@ class V8_EXPORT HeapSnapshot {
* Nodes reference strings, other nodes, and edges by their indexes * Nodes reference strings, other nodes, and edges by their indexes
* in corresponding arrays. * in corresponding arrays.
*/ */
void Serialize(OutputStream* stream, SerializationFormat format) const; void Serialize(OutputStream* stream,
SerializationFormat format = kJSON) const;
}; };
...@@ -452,13 +447,19 @@ class V8_EXPORT HeapProfiler { ...@@ -452,13 +447,19 @@ class V8_EXPORT HeapProfiler {
}; };
/** /**
* Takes a heap snapshot and returns it. Title may be an empty string. * Takes a heap snapshot and returns it. Title parameter is deprecated and
* should be an empty string.
* TODO: deprecate this method.
*/ */
const HeapSnapshot* TakeHeapSnapshot( const HeapSnapshot* TakeHeapSnapshot(
Handle<String> title, Handle<String> title,
ActivityControl* control = NULL, ActivityControl* control = NULL,
ObjectNameResolver* global_object_name_resolver = NULL); ObjectNameResolver* global_object_name_resolver = NULL);
const HeapSnapshot* TakeHeapSnapshot(
ActivityControl* control = NULL,
ObjectNameResolver* global_object_name_resolver = NULL);
/** /**
* Starts tracking of heap objects population statistics. After calling * Starts tracking of heap objects population statistics. After calling
* this method, all heap objects relocations done by the garbage collector * this method, all heap objects relocations done by the garbage collector
......
...@@ -7620,18 +7620,6 @@ void HeapSnapshot::Delete() { ...@@ -7620,18 +7620,6 @@ void HeapSnapshot::Delete() {
} }
unsigned HeapSnapshot::GetUid() const {
return ToInternal(this)->uid();
}
Handle<String> HeapSnapshot::GetTitle() const {
i::Isolate* isolate = i::Isolate::Current();
return ToApiHandle<String>(
isolate->factory()->InternalizeUtf8String(ToInternal(this)->title()));
}
const HeapGraphNode* HeapSnapshot::GetRoot() const { const HeapGraphNode* HeapSnapshot::GetRoot() const {
return reinterpret_cast<const HeapGraphNode*>(ToInternal(this)->root()); return reinterpret_cast<const HeapGraphNode*>(ToInternal(this)->root());
} }
...@@ -7711,9 +7699,15 @@ const HeapSnapshot* HeapProfiler::TakeHeapSnapshot( ...@@ -7711,9 +7699,15 @@ const HeapSnapshot* HeapProfiler::TakeHeapSnapshot(
Handle<String> title, Handle<String> title,
ActivityControl* control, ActivityControl* control,
ObjectNameResolver* resolver) { ObjectNameResolver* resolver) {
return TakeHeapSnapshot(control, resolver);
}
const HeapSnapshot* HeapProfiler::TakeHeapSnapshot(
ActivityControl* control, ObjectNameResolver* resolver) {
return reinterpret_cast<const HeapSnapshot*>( return reinterpret_cast<const HeapSnapshot*>(
reinterpret_cast<i::HeapProfiler*>(this)->TakeSnapshot( reinterpret_cast<i::HeapProfiler*>(this)
*Utils::OpenHandle(*title), control, resolver)); ->TakeSnapshot(control, resolver));
} }
......
...@@ -15,7 +15,6 @@ namespace internal { ...@@ -15,7 +15,6 @@ namespace internal {
HeapProfiler::HeapProfiler(Heap* heap) HeapProfiler::HeapProfiler(Heap* heap)
: ids_(new HeapObjectsMap(heap)), : ids_(new HeapObjectsMap(heap)),
names_(new StringsStorage(heap)), names_(new StringsStorage(heap)),
next_snapshot_uid_(1),
is_tracking_object_moves_(false) { is_tracking_object_moves_(false) {
} }
...@@ -63,10 +62,9 @@ v8::RetainedObjectInfo* HeapProfiler::ExecuteWrapperClassCallback( ...@@ -63,10 +62,9 @@ v8::RetainedObjectInfo* HeapProfiler::ExecuteWrapperClassCallback(
HeapSnapshot* HeapProfiler::TakeSnapshot( HeapSnapshot* HeapProfiler::TakeSnapshot(
const char* name,
v8::ActivityControl* control, v8::ActivityControl* control,
v8::HeapProfiler::ObjectNameResolver* resolver) { v8::HeapProfiler::ObjectNameResolver* resolver) {
HeapSnapshot* result = new HeapSnapshot(this, name, next_snapshot_uid_++); HeapSnapshot* result = new HeapSnapshot(this);
{ {
HeapSnapshotGenerator generator(result, control, resolver, heap()); HeapSnapshotGenerator generator(result, control, resolver, heap());
if (!generator.GenerateSnapshot()) { if (!generator.GenerateSnapshot()) {
...@@ -82,14 +80,6 @@ HeapSnapshot* HeapProfiler::TakeSnapshot( ...@@ -82,14 +80,6 @@ HeapSnapshot* HeapProfiler::TakeSnapshot(
} }
HeapSnapshot* HeapProfiler::TakeSnapshot(
String* name,
v8::ActivityControl* control,
v8::HeapProfiler::ObjectNameResolver* resolver) {
return TakeSnapshot(names_->GetName(name), control, resolver);
}
void HeapProfiler::StartHeapObjectsTracking(bool track_allocations) { void HeapProfiler::StartHeapObjectsTracking(bool track_allocations) {
ids_->UpdateHeapObjectsMap(); ids_->UpdateHeapObjectsMap();
is_tracking_object_moves_ = true; is_tracking_object_moves_ = true;
......
...@@ -22,11 +22,6 @@ class HeapProfiler { ...@@ -22,11 +22,6 @@ class HeapProfiler {
size_t GetMemorySizeUsedByProfiler(); size_t GetMemorySizeUsedByProfiler();
HeapSnapshot* TakeSnapshot( HeapSnapshot* TakeSnapshot(
const char* name,
v8::ActivityControl* control,
v8::HeapProfiler::ObjectNameResolver* resolver);
HeapSnapshot* TakeSnapshot(
String* name,
v8::ActivityControl* control, v8::ActivityControl* control,
v8::HeapProfiler::ObjectNameResolver* resolver); v8::HeapProfiler::ObjectNameResolver* resolver);
...@@ -73,7 +68,6 @@ class HeapProfiler { ...@@ -73,7 +68,6 @@ class HeapProfiler {
SmartPointer<HeapObjectsMap> ids_; SmartPointer<HeapObjectsMap> ids_;
List<HeapSnapshot*> snapshots_; List<HeapSnapshot*> snapshots_;
SmartPointer<StringsStorage> names_; SmartPointer<StringsStorage> names_;
unsigned next_snapshot_uid_;
List<v8::HeapProfiler::WrapperInfoCallback> wrapper_callbacks_; List<v8::HeapProfiler::WrapperInfoCallback> wrapper_callbacks_;
SmartPointer<AllocationTracker> allocation_tracker_; SmartPointer<AllocationTracker> allocation_tracker_;
bool is_tracking_object_moves_; bool is_tracking_object_moves_;
......
...@@ -178,12 +178,8 @@ template <> struct SnapshotSizeConstants<8> { ...@@ -178,12 +178,8 @@ template <> struct SnapshotSizeConstants<8> {
} // namespace } // namespace
HeapSnapshot::HeapSnapshot(HeapProfiler* profiler, HeapSnapshot::HeapSnapshot(HeapProfiler* profiler)
const char* title,
unsigned uid)
: profiler_(profiler), : profiler_(profiler),
title_(title),
uid_(uid),
root_index_(HeapEntry::kNoEntry), root_index_(HeapEntry::kNoEntry),
gc_roots_index_(HeapEntry::kNoEntry), gc_roots_index_(HeapEntry::kNoEntry),
max_snapshot_js_object_id_(0) { max_snapshot_js_object_id_(0) {
...@@ -2883,12 +2879,7 @@ void HeapSnapshotJSONSerializer::SerializeNodes() { ...@@ -2883,12 +2879,7 @@ void HeapSnapshotJSONSerializer::SerializeNodes() {
void HeapSnapshotJSONSerializer::SerializeSnapshot() { void HeapSnapshotJSONSerializer::SerializeSnapshot() {
writer_->AddString("\"title\":\""); writer_->AddString("\"meta\":");
writer_->AddString(snapshot_->title());
writer_->AddString("\"");
writer_->AddString(",\"uid\":");
writer_->AddNumber(snapshot_->uid());
writer_->AddString(",\"meta\":");
// The object describing node serialization layout. // The object describing node serialization layout.
// We use a set of macros to improve readability. // We use a set of macros to improve readability.
#define JSON_A(s) "[" s "]" #define JSON_A(s) "[" s "]"
......
...@@ -141,14 +141,10 @@ class HeapEntry BASE_EMBEDDED { ...@@ -141,14 +141,10 @@ class HeapEntry BASE_EMBEDDED {
// HeapSnapshotGenerator fills in a HeapSnapshot. // HeapSnapshotGenerator fills in a HeapSnapshot.
class HeapSnapshot { class HeapSnapshot {
public: public:
HeapSnapshot(HeapProfiler* profiler, explicit HeapSnapshot(HeapProfiler* profiler);
const char* title,
unsigned uid);
void Delete(); void Delete();
HeapProfiler* profiler() { return profiler_; } HeapProfiler* profiler() { return profiler_; }
const char* title() { return title_; }
unsigned uid() { return uid_; }
size_t RawSnapshotSize() const; size_t RawSnapshotSize() const;
HeapEntry* root() { return &entries_[root_index_]; } HeapEntry* root() { return &entries_[root_index_]; }
HeapEntry* gc_roots() { return &entries_[gc_roots_index_]; } HeapEntry* gc_roots() { return &entries_[gc_roots_index_]; }
...@@ -181,8 +177,6 @@ class HeapSnapshot { ...@@ -181,8 +177,6 @@ class HeapSnapshot {
HeapEntry* AddGcSubrootEntry(int tag, SnapshotObjectId id); HeapEntry* AddGcSubrootEntry(int tag, SnapshotObjectId id);
HeapProfiler* profiler_; HeapProfiler* profiler_;
const char* title_;
unsigned uid_;
int root_index_; int root_index_;
int gc_roots_index_; int gc_roots_index_;
int gc_subroot_indexes_[VisitorSynchronization::kNumberOfSyncTags]; int gc_subroot_indexes_[VisitorSynchronization::kNumberOfSyncTags];
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment