Chromium Code Reviews| Index: Source/bindings/v8/ScriptProfiler.cpp |
| diff --git a/Source/bindings/v8/ScriptProfiler.cpp b/Source/bindings/v8/ScriptProfiler.cpp |
| index 8918165cf463a545afc49c8e65c389d8a22f6bd8..364784d8c68cb207ba0aec248e1c05e547351c44 100644 |
| --- a/Source/bindings/v8/ScriptProfiler.cpp |
| +++ b/Source/bindings/v8/ScriptProfiler.cpp |
| @@ -107,21 +107,10 @@ ScriptObject ScriptProfiler::objectByHeapObjectId(unsigned id) |
| 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 +135,13 @@ unsigned ScriptProfiler::getHeapObjectId(const ScriptValue& value) |
| return id; |
| } |
| +void ScriptProfiler::clearHeapObjectIds() |
| +{ |
| + v8::Isolate* isolate = v8::Isolate::GetCurrent(); |
| + v8::HeapProfiler* profiler = isolate->GetHeapProfiler(); |
|
alph
2013/12/04 10:18:41
Just curious, why do you check for profiler not be
yurys
2013/12/04 11:33:27
The check is redundant, removed it from ScriptProf
|
| + profiler->ClearObjectIds(); |
| +} |
| + |
| namespace { |
| class ActivityControlAdapter : public v8::ActivityControl { |