kJSON = 0 // See format description near 'Serialize' method.
};
- /** Returns heap snapshot type. */
- Type GetType() const;
+ /** Deprecated. Returns kFull. */
+ V8_DEPRECATED(Type GetType() const);
/** Returns heap snapshot UID (assigned by the profiler.) */
unsigned GetUid() const;
ObjectNameResolver* global_object_name_resolver = NULL);
/**
* Takes a heap snapshot and returns it. Title may be an empty string.
- * See HeapSnapshot::Type for types description.
*/
const HeapSnapshot* TakeHeapSnapshot(
Handle<String> title,
HeapSnapshot::Type HeapSnapshot::GetType() const {
i::Isolate* isolate = i::Isolate::Current();
IsDeadCheck(isolate, "v8::HeapSnapshot::GetType");
- return static_cast<HeapSnapshot::Type>(ToInternal(this)->type());
+ return kFull;
}
ObjectNameResolver* resolver) {
i::Isolate* isolate = i::Isolate::Current();
IsDeadCheck(isolate, "v8::HeapProfiler::TakeSnapshot");
- i::HeapSnapshot::Type internal_type = i::HeapSnapshot::kFull;
- switch (type) {
- case HeapSnapshot::kFull:
- internal_type = i::HeapSnapshot::kFull;
- break;
- default:
- UNREACHABLE();
- }
return reinterpret_cast<const HeapSnapshot*>(
isolate->heap_profiler()->TakeSnapshot(
- *Utils::OpenHandle(*title), internal_type, control, resolver));
+ *Utils::OpenHandle(*title), control, resolver));
}
ObjectNameResolver* resolver) {
return reinterpret_cast<const HeapSnapshot*>(
reinterpret_cast<i::HeapProfiler*>(this)->TakeSnapshot(
- *Utils::OpenHandle(*title), i::HeapSnapshot::kFull,
- control, resolver));
+ *Utils::OpenHandle(*title), control, resolver));
}
HeapSnapshot* HeapProfiler::TakeSnapshot(
const char* name,
- int type,
v8::ActivityControl* control,
v8::HeapProfiler::ObjectNameResolver* resolver) {
- HeapSnapshot::Type s_type = static_cast<HeapSnapshot::Type>(type);
- HeapSnapshot* result =
- snapshots_->NewSnapshot(s_type, name, next_snapshot_uid_++);
- bool generation_completed = true;
- switch (s_type) {
- case HeapSnapshot::kFull: {
- HeapSnapshotGenerator generator(result, control, resolver, heap());
- generation_completed = generator.GenerateSnapshot();
- break;
+ HeapSnapshot* result = snapshots_->NewSnapshot(name, next_snapshot_uid_++);
+ {
+ HeapSnapshotGenerator generator(result, control, resolver, heap());
+ if (!generator.GenerateSnapshot()) {
+ delete result;
+ result = NULL;
}
- default:
- UNREACHABLE();
- }
- if (!generation_completed) {
- delete result;
- result = NULL;
}
snapshots_->SnapshotGenerationFinished(result);
return result;
HeapSnapshot* HeapProfiler::TakeSnapshot(
String* name,
- int type,
v8::ActivityControl* control,
v8::HeapProfiler::ObjectNameResolver* resolver) {
- return TakeSnapshot(snapshots_->names()->GetName(name), type, control,
- resolver);
+ return TakeSnapshot(snapshots_->names()->GetName(name), control, resolver);
}
void HeapProfiler::StartHeapObjectsTracking() {
HeapSnapshot* TakeSnapshot(
const char* name,
- int type,
v8::ActivityControl* control,
v8::HeapProfiler::ObjectNameResolver* resolver);
HeapSnapshot* TakeSnapshot(
String* name,
- int type,
v8::ActivityControl* control,
v8::HeapProfiler::ObjectNameResolver* resolver);
static const int kExpectedHeapGraphEdgeSize = 12;
static const int kExpectedHeapEntrySize = 24;
static const int kExpectedHeapSnapshotsCollectionSize = 100;
- static const int kExpectedHeapSnapshotSize = 136;
+ static const int kExpectedHeapSnapshotSize = 132;
static const size_t kMaxSerializableSnapshotRawSize = 256 * MB;
};
static const int kExpectedHeapGraphEdgeSize = 24;
static const int kExpectedHeapEntrySize = 32;
static const int kExpectedHeapSnapshotsCollectionSize = 152;
- static const int kExpectedHeapSnapshotSize = 168;
+ static const int kExpectedHeapSnapshotSize = 160;
static const uint64_t kMaxSerializableSnapshotRawSize =
static_cast<uint64_t>(6000) * MB;
};
} // namespace
HeapSnapshot::HeapSnapshot(HeapSnapshotsCollection* collection,
- HeapSnapshot::Type type,
const char* title,
unsigned uid)
: collection_(collection),
- type_(type),
title_(title),
uid_(uid),
root_index_(HeapEntry::kNoEntry),
}
-HeapSnapshot* HeapSnapshotsCollection::NewSnapshot(HeapSnapshot::Type type,
- const char* name,
+HeapSnapshot* HeapSnapshotsCollection::NewSnapshot(const char* name,
unsigned uid) {
is_tracking_objects_ = true; // Start watching for heap objects moves.
- return new HeapSnapshot(this, type, name, uid);
+ return new HeapSnapshot(this, name, uid);
}
HeapSnapshot* HeapSnapshotJSONSerializer::CreateFakeSnapshot() {
HeapSnapshot* result = new HeapSnapshot(snapshot_->collection(),
- HeapSnapshot::kFull,
snapshot_->title(),
snapshot_->uid());
result->AddRootEntry();
// HeapSnapshotGenerator fills in a HeapSnapshot.
class HeapSnapshot {
public:
- enum Type {
- kFull = v8::HeapSnapshot::kFull
- };
-
HeapSnapshot(HeapSnapshotsCollection* collection,
- Type type,
const char* title,
unsigned uid);
void Delete();
HeapSnapshotsCollection* collection() { return collection_; }
- Type type() { return type_; }
const char* title() { return title_; }
unsigned uid() { return uid_; }
size_t RawSnapshotSize() const;
private:
HeapSnapshotsCollection* collection_;
- Type type_;
const char* title_;
unsigned uid_;
int root_index_;
void StartHeapObjectsTracking() { is_tracking_objects_ = true; }
void StopHeapObjectsTracking() { ids_.StopHeapObjectsTracking(); }
- HeapSnapshot* NewSnapshot(
- HeapSnapshot::Type type, const char* name, unsigned uid);
+ HeapSnapshot* NewSnapshot(const char* name, unsigned uid);
void SnapshotGenerationFinished(HeapSnapshot* snapshot);
List<HeapSnapshot*>* snapshots() { return &snapshots_; }
HeapSnapshot* GetSnapshot(unsigned uid);