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 {
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. */
const HeapGraphNode* GetRoot() const;
......@@ -367,7 +361,8 @@ class V8_EXPORT HeapSnapshot {
* Nodes reference strings, other nodes, and edges by their indexes
* 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 {
};
/**
* 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(
Handle<String> title,
ActivityControl* control = 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
* this method, all heap objects relocations done by the garbage collector
......
......@@ -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 {
return reinterpret_cast<const HeapGraphNode*>(ToInternal(this)->root());
}
......@@ -7711,9 +7699,15 @@ const HeapSnapshot* HeapProfiler::TakeHeapSnapshot(
Handle<String> title,
ActivityControl* control,
ObjectNameResolver* resolver) {
return TakeHeapSnapshot(control, resolver);
}
const HeapSnapshot* HeapProfiler::TakeHeapSnapshot(
ActivityControl* control, ObjectNameResolver* resolver) {
return reinterpret_cast<const HeapSnapshot*>(
reinterpret_cast<i::HeapProfiler*>(this)->TakeSnapshot(
*Utils::OpenHandle(*title), control, resolver));
reinterpret_cast<i::HeapProfiler*>(this)
->TakeSnapshot(control, resolver));
}
......
......@@ -15,7 +15,6 @@ namespace internal {
HeapProfiler::HeapProfiler(Heap* heap)
: ids_(new HeapObjectsMap(heap)),
names_(new StringsStorage(heap)),
next_snapshot_uid_(1),
is_tracking_object_moves_(false) {
}
......@@ -63,10 +62,9 @@ v8::RetainedObjectInfo* HeapProfiler::ExecuteWrapperClassCallback(
HeapSnapshot* HeapProfiler::TakeSnapshot(
const char* name,
v8::ActivityControl* control,
v8::HeapProfiler::ObjectNameResolver* resolver) {
HeapSnapshot* result = new HeapSnapshot(this, name, next_snapshot_uid_++);
HeapSnapshot* result = new HeapSnapshot(this);
{
HeapSnapshotGenerator generator(result, control, resolver, heap());
if (!generator.GenerateSnapshot()) {
......@@ -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) {
ids_->UpdateHeapObjectsMap();
is_tracking_object_moves_ = true;
......
......@@ -22,11 +22,6 @@ class HeapProfiler {
size_t GetMemorySizeUsedByProfiler();
HeapSnapshot* TakeSnapshot(
const char* name,
v8::ActivityControl* control,
v8::HeapProfiler::ObjectNameResolver* resolver);
HeapSnapshot* TakeSnapshot(
String* name,
v8::ActivityControl* control,
v8::HeapProfiler::ObjectNameResolver* resolver);
......@@ -73,7 +68,6 @@ class HeapProfiler {
SmartPointer<HeapObjectsMap> ids_;
List<HeapSnapshot*> snapshots_;
SmartPointer<StringsStorage> names_;
unsigned next_snapshot_uid_;
List<v8::HeapProfiler::WrapperInfoCallback> wrapper_callbacks_;
SmartPointer<AllocationTracker> allocation_tracker_;
bool is_tracking_object_moves_;
......
......@@ -178,12 +178,8 @@ template <> struct SnapshotSizeConstants<8> {
} // namespace
HeapSnapshot::HeapSnapshot(HeapProfiler* profiler,
const char* title,
unsigned uid)
HeapSnapshot::HeapSnapshot(HeapProfiler* profiler)
: profiler_(profiler),
title_(title),
uid_(uid),
root_index_(HeapEntry::kNoEntry),
gc_roots_index_(HeapEntry::kNoEntry),
max_snapshot_js_object_id_(0) {
......@@ -2883,12 +2879,7 @@ void HeapSnapshotJSONSerializer::SerializeNodes() {
void HeapSnapshotJSONSerializer::SerializeSnapshot() {
writer_->AddString("\"title\":\"");
writer_->AddString(snapshot_->title());
writer_->AddString("\"");
writer_->AddString(",\"uid\":");
writer_->AddNumber(snapshot_->uid());
writer_->AddString(",\"meta\":");
writer_->AddString("\"meta\":");
// The object describing node serialization layout.
// We use a set of macros to improve readability.
#define JSON_A(s) "[" s "]"
......
......@@ -141,14 +141,10 @@ class HeapEntry BASE_EMBEDDED {
// HeapSnapshotGenerator fills in a HeapSnapshot.
class HeapSnapshot {
public:
HeapSnapshot(HeapProfiler* profiler,
const char* title,
unsigned uid);
explicit HeapSnapshot(HeapProfiler* profiler);
void Delete();
HeapProfiler* profiler() { return profiler_; }
const char* title() { return title_; }
unsigned uid() { return uid_; }
size_t RawSnapshotSize() const;
HeapEntry* root() { return &entries_[root_index_]; }
HeapEntry* gc_roots() { return &entries_[gc_roots_index_]; }
......@@ -181,8 +177,6 @@ class HeapSnapshot {
HeapEntry* AddGcSubrootEntry(int tag, SnapshotObjectId id);
HeapProfiler* profiler_;
const char* title_;
unsigned uid_;
int root_index_;
int gc_roots_index_;
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