| Index: Source/bindings/v8/ScriptProfiler.cpp
|
| diff --git a/Source/bindings/v8/ScriptProfiler.cpp b/Source/bindings/v8/ScriptProfiler.cpp
|
| index 914a943a2063629d1cdb5b2b2744d9f4321bb495..a32c616d65211437946cffaaf527806fb8884373 100644
|
| --- a/Source/bindings/v8/ScriptProfiler.cpp
|
| +++ b/Source/bindings/v8/ScriptProfiler.cpp
|
| @@ -105,23 +105,9 @@ ScriptObject ScriptProfiler::objectByHeapObjectId(unsigned id)
|
| {
|
| v8::Isolate* isolate = v8::Isolate::GetCurrent();
|
| v8::HeapProfiler* profiler = isolate->GetHeapProfiler();
|
| - if (!profiler)
|
| - return ScriptObject();
|
| - // As ids are unique, it doesn't matter which HeapSnapshot owns HeapGraphNode.
|
| - // We need to find first HeapSnapshot containing a node with the specified id.
|
| - const v8::HeapGraphNode* node = 0;
|
| - for (int i = 0, l = profiler->GetSnapshotCount(); i < l; ++i) {
|
| - const v8::HeapSnapshot* snapshot = profiler->GetHeapSnapshot(i);
|
| - node = snapshot->GetNodeById(id);
|
| - if (node)
|
| - break;
|
| - }
|
| - if (!node)
|
| - return ScriptObject();
|
| -
|
| v8::HandleScope handleScope(isolate);
|
| - v8::Handle<v8::Value> value = node->GetHeapValue();
|
| - if (!value->IsObject())
|
| + v8::Handle<v8::Value> value = profiler->FindObjectById(id);
|
| + if (value.IsEmpty() || !value->IsObject())
|
| return ScriptObject();
|
|
|
| v8::Handle<v8::Object> object = value.As<v8::Object>();
|
| @@ -146,6 +132,13 @@ unsigned ScriptProfiler::getHeapObjectId(const ScriptValue& value)
|
| return id;
|
| }
|
|
|
| +void ScriptProfiler::clearHeapObjectIds()
|
| +{
|
| + v8::Isolate* isolate = v8::Isolate::GetCurrent();
|
| + v8::HeapProfiler* profiler = isolate->GetHeapProfiler();
|
| + profiler->ClearObjectIds();
|
| +}
|
| +
|
| namespace {
|
|
|
| class ActivityControlAdapter : public v8::ActivityControl {
|
|
|