Reviewed by Yury Semikhatsky.
Web Inspector: [Chromium] Use bottom-up CPU profile tree built in VM,
instead of building it on Inspector's side.
https://bugs.webkit.org/show_bug.cgi?id=61185
* bindings/js/ScriptProfile.cpp:
(WebCore::ScriptProfile::bottomUpHead):
(WebCore::ScriptProfile::buildInspectorObjectForBottomUpHead):
* bindings/js/ScriptProfile.h:
* bindings/v8/ScriptProfile.cpp:
(WebCore::ScriptProfile::bottomUpHead):
(WebCore::ScriptProfile::buildInspectorObjectForBottomUpHead):
* bindings/v8/ScriptProfile.h:
* inspector/InspectorProfilerAgent.cpp:
(WebCore::InspectorProfilerAgent::getProfile):
* inspector/front-end/ProfileView.js:
(WebInspector.CPUProfileView.prototype.get bottomUpProfileDataGridTree):
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@86947
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2011-05-20 Mikhail Naganov <mnaganov@chromium.org>
+
+ Reviewed by Yury Semikhatsky.
+
+ Web Inspector: [Chromium] Use bottom-up CPU profile tree built in VM,
+ instead of building it on Inspector's side.
+ https://bugs.webkit.org/show_bug.cgi?id=61185
+
+ * bindings/js/ScriptProfile.cpp:
+ (WebCore::ScriptProfile::bottomUpHead):
+ (WebCore::ScriptProfile::buildInspectorObjectForBottomUpHead):
+ * bindings/js/ScriptProfile.h:
+ * bindings/v8/ScriptProfile.cpp:
+ (WebCore::ScriptProfile::bottomUpHead):
+ (WebCore::ScriptProfile::buildInspectorObjectForBottomUpHead):
+ * bindings/v8/ScriptProfile.h:
+ * inspector/InspectorProfilerAgent.cpp:
+ (WebCore::InspectorProfilerAgent::getProfile):
+ * inspector/front-end/ProfileView.js:
+ (WebInspector.CPUProfileView.prototype.get bottomUpProfileDataGridTree):
+
2011-05-20 Adam Roben <aroben@apple.com>
Mac build fix after r86936
return m_profile->head();
}
+PassRefPtr<ScriptProfileNode> ScriptProfile::bottomUpHead() const
+{
+ // FIXME: implement building bottom-up profiles in C++ code,
+ // but consider https://bugs.webkit.org/show_bug.cgi?id=24604
+ return 0;
+}
+
#if ENABLE(INSPECTOR)
static PassRefPtr<InspectorObject> buildInspectorObjectFor(const JSC::ProfileNode* node)
{
{
return buildInspectorObjectFor(m_profile->head());
}
+
+PassRefPtr<InspectorObject> ScriptProfile::buildInspectorObjectForBottomUpHead() const
+{
+ return 0;
+}
#endif
} // namespace WebCore
String title() const;
unsigned int uid() const;
ScriptProfileNode* head() const;
+ PassRefPtr<ScriptProfileNode> bottomUpHead() const;
#if ENABLE(INSPECTOR)
PassRefPtr<InspectorObject> buildInspectorObjectForHead() const;
+ PassRefPtr<InspectorObject> buildInspectorObjectForBottomUpHead() const;
#endif
private:
return ScriptProfileNode::create(m_profile->GetTopDownRoot());
}
+PassRefPtr<ScriptProfileNode> ScriptProfile::bottomUpHead() const
+{
+ return ScriptProfileNode::create(m_profile->GetBottomUpRoot());
+}
+
static PassRefPtr<InspectorObject> buildInspectorObjectFor(const v8::CpuProfileNode* node)
{
v8::HandleScope handleScope;
return buildInspectorObjectFor(m_profile->GetTopDownRoot());
}
+PassRefPtr<InspectorObject> ScriptProfile::buildInspectorObjectForBottomUpHead() const
+{
+ return buildInspectorObjectFor(m_profile->GetBottomUpRoot());
+}
+
} // namespace WebCore
String title() const;
unsigned int uid() const;
PassRefPtr<ScriptProfileNode> head() const;
+ PassRefPtr<ScriptProfileNode> bottomUpHead() const;
PassRefPtr<InspectorObject> buildInspectorObjectForHead() const;
+ PassRefPtr<InspectorObject> buildInspectorObjectForBottomUpHead() const;
private:
ScriptProfile(const v8::CpuProfile* profile)
if (it != m_profiles.end()) {
*profileObject = createProfileHeader(*it->second);
(*profileObject)->setObject("head", it->second->buildInspectorObjectForHead());
+ if (it->second->bottomUpHead())
+ (*profileObject)->setObject("bottomUpHead", it->second->buildInspectorObjectForBottomUpHead());
}
} else if (type == HeapProfileType) {
HeapSnapshotsMap::iterator it = m_snapshots.find(uid);
get bottomUpProfileDataGridTree()
{
- if (!this._bottomUpProfileDataGridTree)
- this._bottomUpProfileDataGridTree = new WebInspector.BottomUpProfileDataGridTree(this, this.profile.head);
+ if (!this._bottomUpProfileDataGridTree) {
+ if (this.profile.bottomUpHead)
+ this._bottomUpProfileDataGridTree = new WebInspector.TopDownProfileDataGridTree(this, this.profile.bottomUpHead);
+ else
+ this._bottomUpProfileDataGridTree = new WebInspector.BottomUpProfileDataGridTree(this, this.profile.head);
+ }
return this._bottomUpProfileDataGridTree;
},