Chromium Code Reviews| Index: src/heap-profiler.cc |
| diff --git a/src/heap-profiler.cc b/src/heap-profiler.cc |
| index 07b631fa7332d8de6bc1b50f6987aae4d74e58cd..f983913082d5bd36f28e41fa622fc2bcdcbb3791 100644 |
| --- a/src/heap-profiler.cc |
| +++ b/src/heap-profiler.cc |
| @@ -364,6 +364,26 @@ HeapSnapshot* HeapProfiler::TakeSnapshot(String* name, |
| } |
| +void HeapProfiler::DefineWrapperClass( |
| + uint16_t class_id, v8::HeapProfiler::WrapperInfoCallback callback) { |
|
Vitaly Repeshko
2011/03/09 19:10:08
Assert class_id is not kNoClassId.
mnaganov (inactive)
2011/03/10 12:23:35
Done.
|
| + ASSERT(singleton_ != NULL); |
| + if (singleton_->wrapper_callbacks_.length() <= class_id) { |
| + singleton_->wrapper_callbacks_.AddBlock( |
| + NULL, class_id - singleton_->wrapper_callbacks_.length() + 1); |
| + } |
| + singleton_->wrapper_callbacks_[class_id] = callback; |
| +} |
| + |
| + |
| +v8::RetainedObjectInfo* HeapProfiler::ExecuteWrapperClassCallback( |
| + uint16_t class_id, Object** wrapper) { |
| + ASSERT(singleton_ != NULL); |
| + if (singleton_->wrapper_callbacks_.length() <= class_id) return NULL; |
| + return singleton_->wrapper_callbacks_[class_id]( |
| + class_id, Utils::ToLocal(Handle<Object>(wrapper))); |
| +} |
| + |
| + |
| HeapSnapshot* HeapProfiler::TakeSnapshotImpl(const char* name, |
| int type, |
| v8::ActivityControl* control) { |
| @@ -401,7 +421,7 @@ HeapSnapshot* HeapProfiler::TakeSnapshotImpl(const char* name, |
| HeapSnapshot* HeapProfiler::TakeSnapshotImpl(String* name, |
| int type, |
| v8::ActivityControl* control) { |
| - return TakeSnapshotImpl(snapshots_->GetName(name), type, control); |
| + return TakeSnapshotImpl(snapshots_->names()->GetName(name), type, control); |
| } |
| @@ -872,7 +892,8 @@ class AllocatingConstructorHeapProfileIterator { |
| const NumberAndSizeInfo& number_and_size) { |
| const char* name = cluster.GetSpecialCaseName(); |
| if (name == NULL) { |
| - name = snapshot_->collection()->GetFunctionName(cluster.constructor()); |
| + name = snapshot_->collection()->names()->GetFunctionName( |
| + cluster.constructor()); |
| } |
| AddEntryFromAggregatedSnapshot(snapshot_, |
| root_child_index_, |
| @@ -1013,7 +1034,8 @@ class AggregatedRetainerTreeAllocator : public HeapEntriesAllocator { |
| JSObjectsCluster cluster = HeapObjectAsCluster(obj); |
| const char* name = cluster.GetSpecialCaseName(); |
| if (name == NULL) { |
| - name = snapshot_->collection()->GetFunctionName(cluster.constructor()); |
| + name = snapshot_->collection()->names()->GetFunctionName( |
| + cluster.constructor()); |
| } |
| return AddEntryFromAggregatedSnapshot( |
| snapshot_, root_child_index_, HeapEntry::kObject, name, |