OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2010, Google Inc. All rights reserved. | 2 * Copyright (c) 2010, Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 28 matching lines...) Expand all Loading... |
39 namespace WebCore { | 39 namespace WebCore { |
40 | 40 |
41 ScriptProfile::~ScriptProfile() | 41 ScriptProfile::~ScriptProfile() |
42 { | 42 { |
43 const_cast<v8::CpuProfile*>(m_profile)->Delete(); | 43 const_cast<v8::CpuProfile*>(m_profile)->Delete(); |
44 } | 44 } |
45 | 45 |
46 String ScriptProfile::title() const | 46 String ScriptProfile::title() const |
47 { | 47 { |
48 v8::HandleScope scope(v8::Isolate::GetCurrent()); | 48 v8::HandleScope scope(v8::Isolate::GetCurrent()); |
49 return toWebCoreString(m_profile->GetTitle()); | 49 return toCoreString(m_profile->GetTitle()); |
50 } | 50 } |
51 | 51 |
52 unsigned int ScriptProfile::uid() const | 52 unsigned int ScriptProfile::uid() const |
53 { | 53 { |
54 return m_profile->GetUid(); | 54 return m_profile->GetUid(); |
55 } | 55 } |
56 | 56 |
57 double ScriptProfile::idleTime() const | 57 double ScriptProfile::idleTime() const |
58 { | 58 { |
59 return m_idleTime; | 59 return m_idleTime; |
(...skipping 14 matching lines...) Expand all Loading... |
74 v8::HandleScope handleScope(v8::Isolate::GetCurrent()); | 74 v8::HandleScope handleScope(v8::Isolate::GetCurrent()); |
75 | 75 |
76 RefPtr<TypeBuilder::Array<TypeBuilder::Profiler::CPUProfileNode> > children
= TypeBuilder::Array<TypeBuilder::Profiler::CPUProfileNode>::create(); | 76 RefPtr<TypeBuilder::Array<TypeBuilder::Profiler::CPUProfileNode> > children
= TypeBuilder::Array<TypeBuilder::Profiler::CPUProfileNode>::create(); |
77 const int childrenCount = node->GetChildrenCount(); | 77 const int childrenCount = node->GetChildrenCount(); |
78 for (int i = 0; i < childrenCount; i++) { | 78 for (int i = 0; i < childrenCount; i++) { |
79 const v8::CpuProfileNode* child = node->GetChild(i); | 79 const v8::CpuProfileNode* child = node->GetChild(i); |
80 children->addItem(buildInspectorObjectFor(child)); | 80 children->addItem(buildInspectorObjectFor(child)); |
81 } | 81 } |
82 | 82 |
83 RefPtr<TypeBuilder::Profiler::CPUProfileNode> result = TypeBuilder::Profiler
::CPUProfileNode::create() | 83 RefPtr<TypeBuilder::Profiler::CPUProfileNode> result = TypeBuilder::Profiler
::CPUProfileNode::create() |
84 .setFunctionName(toWebCoreString(node->GetFunctionName())) | 84 .setFunctionName(toCoreString(node->GetFunctionName())) |
85 .setScriptId(String::number(node->GetScriptId())) | 85 .setScriptId(String::number(node->GetScriptId())) |
86 .setUrl(toWebCoreString(node->GetScriptResourceName())) | 86 .setUrl(toCoreString(node->GetScriptResourceName())) |
87 .setLineNumber(node->GetLineNumber()) | 87 .setLineNumber(node->GetLineNumber()) |
88 .setColumnNumber(node->GetColumnNumber()) | 88 .setColumnNumber(node->GetColumnNumber()) |
89 .setHitCount(node->GetHitCount()) | 89 .setHitCount(node->GetHitCount()) |
90 .setCallUID(node->GetCallUid()) | 90 .setCallUID(node->GetCallUid()) |
91 .setChildren(children.release()) | 91 .setChildren(children.release()) |
92 .setDeoptReason(node->GetBailoutReason()); | 92 .setDeoptReason(node->GetBailoutReason()); |
93 result->setId(node->GetNodeId()); | 93 result->setId(node->GetNodeId()); |
94 return result.release(); | 94 return result.release(); |
95 } | 95 } |
96 | 96 |
97 PassRefPtr<TypeBuilder::Profiler::CPUProfileNode> ScriptProfile::buildInspectorO
bjectForHead() const | 97 PassRefPtr<TypeBuilder::Profiler::CPUProfileNode> ScriptProfile::buildInspectorO
bjectForHead() const |
98 { | 98 { |
99 return buildInspectorObjectFor(m_profile->GetTopDownRoot()); | 99 return buildInspectorObjectFor(m_profile->GetTopDownRoot()); |
100 } | 100 } |
101 | 101 |
102 PassRefPtr<TypeBuilder::Array<int> > ScriptProfile::buildInspectorObjectForSampl
es() const | 102 PassRefPtr<TypeBuilder::Array<int> > ScriptProfile::buildInspectorObjectForSampl
es() const |
103 { | 103 { |
104 RefPtr<TypeBuilder::Array<int> > array = TypeBuilder::Array<int>::create(); | 104 RefPtr<TypeBuilder::Array<int> > array = TypeBuilder::Array<int>::create(); |
105 int count = m_profile->GetSamplesCount(); | 105 int count = m_profile->GetSamplesCount(); |
106 for (int i = 0; i < count; i++) | 106 for (int i = 0; i < count; i++) |
107 array->addItem(m_profile->GetSample(i)->GetNodeId()); | 107 array->addItem(m_profile->GetSample(i)->GetNodeId()); |
108 return array.release(); | 108 return array.release(); |
109 } | 109 } |
110 | 110 |
111 | 111 |
112 } // namespace WebCore | 112 } // namespace WebCore |
OLD | NEW |