Diff
Modified: trunk/Source/WebCore/ChangeLog (116209 => 116210)
--- trunk/Source/WebCore/ChangeLog 2012-05-05 05:48:07 UTC (rev 116209)
+++ trunk/Source/WebCore/ChangeLog 2012-05-05 06:52:38 UTC (rev 116210)
@@ -1,3 +1,28 @@
+2012-05-04 Ilya Tikhonovsky <[email protected]>
+
+ Web Inspector: annotate ProfilerAgent.
+ https://bugs.webkit.org/show_bug.cgi?id=85630
+
+ Reviewed by Pavel Feldman.
+
+ * inspector/Inspector.json:
+ * inspector/InspectorProfilerAgent.cpp:
+ (WebCore::InspectorProfilerAgent::createProfileHeader):
+ (WebCore::InspectorProfilerAgent::createSnapshotHeader):
+ (WebCore::InspectorProfilerAgent::getProfileHeaders):
+ (WebCore):
+ (WebCore::InspectorProfilerAgent::getProfile):
+ * inspector/InspectorProfilerAgent.h:
+ (InspectorProfilerAgent):
+ * inspector/front-end/CSSSelectorProfileView.js:
+ * inspector/front-end/HeapSnapshotView.js:
+ (WebInspector.HeapSnapshotProfileType.prototype.createProfile):
+ * inspector/front-end/ProfileView.js:
+ * inspector/front-end/ProfilesPanel.js:
+ (WebInspector.ProfilesPanel.prototype.addProfileHeader):
+ (WebInspector.ProfilesPanel.prototype._addHeapSnapshotChunk):
+ (WebInspector.ProfilerDispatcher.prototype.resetProfiles):
+
2012-05-04 Gustavo Noronha Silva <[email protected]>
[GTK] Simplify how libWebCoreModules is linked in, and fix WebKit2 build
Modified: trunk/Source/WebCore/inspector/Inspector.json (116209 => 116210)
--- trunk/Source/WebCore/inspector/Inspector.json 2012-05-05 05:48:07 UTC (rev 116209)
+++ trunk/Source/WebCore/inspector/Inspector.json 2012-05-05 06:52:38 UTC (rev 116210)
@@ -2533,14 +2533,24 @@
"hidden": true,
"types": [
{
- "id": "Profile",
+ "id": "ProfileHeader",
"type": "object",
- "description": "Profile."
+ "description": "Profile header.",
+ "properties": [
+ { "name": "typeId", "type": "string", "enum": ["CPU", "CSS", "HEAP"], "description": "Profile type name." },
+ { "name": "title", "type": "string", "description": "Profile title." },
+ { "name": "uid", "type": "integer", "description": "Unique identifier of the profile." },
+ { "name": "maxJSObjectId", "type": "integer", "optional": true, "description": "Last seen JS object Id." }
+ ]
},
{
- "id": "ProfileHeader",
+ "id": "Profile",
"type": "object",
- "description": "Profile header."
+ "description": "Profile.",
+ "properties": [
+ { "name": "head", "type": "object", "optional": true },
+ { "name": "bottomUpHead", "type": "object", "optional": true }
+ ]
}
],
"commands": [
Modified: trunk/Source/WebCore/inspector/InspectorProfilerAgent.cpp (116209 => 116210)
--- trunk/Source/WebCore/inspector/InspectorProfilerAgent.cpp 2012-05-05 05:48:07 UTC (rev 116209)
+++ trunk/Source/WebCore/inspector/InspectorProfilerAgent.cpp 2012-05-05 06:52:38 UTC (rev 116210)
@@ -167,26 +167,25 @@
ScriptProfiler::collectGarbage();
}
-PassRefPtr<InspectorObject> InspectorProfilerAgent::createProfileHeader(const ScriptProfile& profile)
+PassRefPtr<TypeBuilder::Profiler::ProfileHeader> InspectorProfilerAgent::createProfileHeader(const ScriptProfile& profile)
{
- RefPtr<InspectorObject> header = InspectorObject::create();
- header->setString("title", profile.title());
- header->setNumber("uid", profile.uid());
- header->setString("typeId", String(CPUProfileType));
- return header;
+ return TypeBuilder::Profiler::ProfileHeader::create()
+ .setTypeId(TypeBuilder::Profiler::ProfileHeader::TypeId::CPU)
+ .setUid(profile.uid())
+ .setTitle(profile.title())
+ .release();
}
-PassRefPtr<InspectorObject> InspectorProfilerAgent::createSnapshotHeader(const ScriptHeapSnapshot& snapshot)
+PassRefPtr<TypeBuilder::Profiler::ProfileHeader> InspectorProfilerAgent::createSnapshotHeader(const ScriptHeapSnapshot& snapshot)
{
- RefPtr<InspectorObject> header = InspectorObject::create();
- header->setString("title", snapshot.title());
- header->setNumber("uid", snapshot.uid());
- header->setString("typeId", String(HeapProfileType));
- header->setNumber("maxJSObjectId", snapshot.maxSnapshotJSObjectId());
- return header;
+ RefPtr<TypeBuilder::Profiler::ProfileHeader> header = TypeBuilder::Profiler::ProfileHeader::create()
+ .setTypeId(TypeBuilder::Profiler::ProfileHeader::TypeId::HEAP)
+ .setUid(snapshot.uid())
+ .setTitle(snapshot.title());
+ header->setMaxJSObjectId(snapshot.maxSnapshotJSObjectId());
+ return header.release();
}
-
void InspectorProfilerAgent::causesRecompilation(ErrorString*, bool* result)
{
*result = ScriptProfiler::causesRecompilation();
@@ -241,9 +240,9 @@
return makeString(UserInitiatedProfileName, '.', String::number(m_currentUserInitiatedProfileNumber));
}
-void InspectorProfilerAgent::getProfileHeaders(ErrorString*, RefPtr<TypeBuilder::Array<InspectorObject> >& headers)
+void InspectorProfilerAgent::getProfileHeaders(ErrorString*, RefPtr<TypeBuilder::Array<TypeBuilder::Profiler::ProfileHeader> >& headers)
{
- headers = TypeBuilder::Array<InspectorObject>::create();
+ headers = TypeBuilder::Array<TypeBuilder::Profiler::ProfileHeader>::create();
ProfilesMap::iterator profilesEnd = m_profiles.end();
for (ProfilesMap::iterator it = m_profiles.begin(); it != profilesEnd; ++it)
@@ -268,22 +267,22 @@
} // namespace
-void InspectorProfilerAgent::getProfile(ErrorString*, const String& type, int rawUid, RefPtr<InspectorObject>& profileObject)
+void InspectorProfilerAgent::getProfile(ErrorString*, const String& type, int rawUid, RefPtr<TypeBuilder::Profiler::Profile>& profileObject)
{
unsigned uid = static_cast<unsigned>(rawUid);
if (type == CPUProfileType) {
ProfilesMap::iterator it = m_profiles.find(uid);
if (it != m_profiles.end()) {
- profileObject = createProfileHeader(*it->second);
- profileObject->setObject("head", it->second->buildInspectorObjectForHead());
+ profileObject = TypeBuilder::Profiler::Profile::create();
+ profileObject->setHead(it->second->buildInspectorObjectForHead());
if (it->second->bottomUpHead())
- profileObject->setObject("bottomUpHead", it->second->buildInspectorObjectForBottomUpHead());
+ profileObject->setBottomUpHead(it->second->buildInspectorObjectForBottomUpHead());
}
} else if (type == HeapProfileType) {
HeapSnapshotsMap::iterator it = m_snapshots.find(uid);
if (it != m_snapshots.end()) {
RefPtr<ScriptHeapSnapshot> snapshot = it->second;
- profileObject = createSnapshotHeader(*snapshot);
+ profileObject = TypeBuilder::Profiler::Profile::create();
if (m_frontend) {
OutputStream stream(m_frontend, uid);
snapshot->writeJSON(&stream);
Modified: trunk/Source/WebCore/inspector/InspectorProfilerAgent.h (116209 => 116210)
--- trunk/Source/WebCore/inspector/InspectorProfilerAgent.h 2012-05-05 05:48:07 UTC (rev 116209)
+++ trunk/Source/WebCore/inspector/InspectorProfilerAgent.h 2012-05-05 06:52:38 UTC (rev 116210)
@@ -85,8 +85,8 @@
void enable(bool skipRecompile);
bool enabled() { return m_enabled; }
String getCurrentUserInitiatedProfileName(bool incrementProfileNumber = false);
- virtual void getProfileHeaders(ErrorString*, RefPtr<TypeBuilder::Array<InspectorObject> >& headers);
- virtual void getProfile(ErrorString*, const String& type, int uid, RefPtr<InspectorObject>& profileObject);
+ virtual void getProfileHeaders(ErrorString*, RefPtr<TypeBuilder::Array<TypeBuilder::Profiler::ProfileHeader> >&);
+ virtual void getProfile(ErrorString*, const String& type, int uid, RefPtr<TypeBuilder::Profiler::Profile>&);
virtual void removeProfile(ErrorString*, const String& type, int uid);
virtual void setFrontend(InspectorFrontend*);
@@ -110,8 +110,8 @@
void resetFrontendProfiles();
void restoreEnablement();
- PassRefPtr<InspectorObject> createProfileHeader(const ScriptProfile& profile);
- PassRefPtr<InspectorObject> createSnapshotHeader(const ScriptHeapSnapshot& snapshot);
+ PassRefPtr<TypeBuilder::Profiler::ProfileHeader> createProfileHeader(const ScriptProfile&);
+ PassRefPtr<TypeBuilder::Profiler::ProfileHeader> createSnapshotHeader(const ScriptHeapSnapshot&);
InspectorConsoleAgent* m_consoleAgent;
InjectedScriptManager* m_injectedScriptManager;
Modified: trunk/Source/WebCore/inspector/front-end/CSSSelectorProfileView.js (116209 => 116210)
--- trunk/Source/WebCore/inspector/front-end/CSSSelectorProfileView.js 2012-05-05 05:48:07 UTC (rev 116209)
+++ trunk/Source/WebCore/inspector/front-end/CSSSelectorProfileView.js 2012-05-05 06:52:38 UTC (rev 116210)
@@ -351,11 +351,20 @@
return new WebInspector.CSSSelectorProfileView(profile);
},
+ /**
+ * @override
+ * @return {WebInspector.ProfileHeader}
+ */
createTemporaryProfile: function()
{
return new WebInspector.ProfileHeader(WebInspector.CSSSelectorProfileType.TypeId, WebInspector.UIString("Recording\u2026"));
},
+ /**
+ * @override
+ * @param {ProfilerAgent.ProfileHeader} profile
+ * @return {WebInspector.ProfileHeader}
+ */
createProfile: function(profile)
{
return new WebInspector.ProfileHeader(profile.typeId, profile.title, profile.uid);
Modified: trunk/Source/WebCore/inspector/front-end/HeapSnapshotView.js (116209 => 116210)
--- trunk/Source/WebCore/inspector/front-end/HeapSnapshotView.js 2012-05-05 05:48:07 UTC (rev 116209)
+++ trunk/Source/WebCore/inspector/front-end/HeapSnapshotView.js 2012-05-05 06:52:38 UTC (rev 116210)
@@ -749,14 +749,23 @@
return new WebInspector.HeapSnapshotView(WebInspector.panels.profiles, profile);
},
+ /**
+ * @override
+ * @return {WebInspector.ProfileHeader}
+ */
createTemporaryProfile: function()
{
return new WebInspector.ProfileHeader(WebInspector.HeapSnapshotProfileType.TypeId, WebInspector.UIString("Snapshotting\u2026"));
},
+ /**
+ * @override
+ * @param {ProfilerAgent.ProfileHeader} profile
+ * @return {WebInspector.ProfileHeader}
+ */
createProfile: function(profile)
{
- return new WebInspector.HeapProfileHeader(profile.typeId, profile.title, profile.uid, profile.maxJSObjectId);
+ return new WebInspector.HeapProfileHeader(profile.typeId, profile.title, profile.uid, profile.maxJSObjectId || 0);
}
}
Modified: trunk/Source/WebCore/inspector/front-end/ProfileView.js (116209 => 116210)
--- trunk/Source/WebCore/inspector/front-end/ProfileView.js 2012-05-05 05:48:07 UTC (rev 116209)
+++ trunk/Source/WebCore/inspector/front-end/ProfileView.js 2012-05-05 06:52:38 UTC (rev 116210)
@@ -618,11 +618,20 @@
return new WebInspector.CPUProfileView(profile);
},
+ /**
+ * @override
+ * @return {WebInspector.ProfileHeader}
+ */
createTemporaryProfile: function()
{
return new WebInspector.ProfileHeader(WebInspector.CPUProfileType.TypeId, WebInspector.UIString("Recording\u2026"));
},
+ /**
+ * @override
+ * @param {ProfilerAgent.ProfileHeader} profile
+ * @return {WebInspector.ProfileHeader}
+ */
createProfile: function(profile)
{
return new WebInspector.ProfileHeader(profile.typeId, profile.title, profile.uid);
Modified: trunk/Source/WebCore/inspector/front-end/ProfilesPanel.js (116209 => 116210)
--- trunk/Source/WebCore/inspector/front-end/ProfilesPanel.js 2012-05-05 05:48:07 UTC (rev 116209)
+++ trunk/Source/WebCore/inspector/front-end/ProfilesPanel.js 2012-05-05 06:52:38 UTC (rev 116210)
@@ -90,12 +90,19 @@
},
// Must be implemented by subclasses.
+ /**
+ * @return {WebInspector.ProfileHeader}
+ */
createTemporaryProfile: function()
{
throw new Error("Needs implemented.");
},
// Must be implemented by subclasses.
+ /**
+ * @param {ProfilerAgent.ProfileHeader} profile
+ * @return {WebInspector.ProfileHeader}
+ */
createProfile: function(profile)
{
throw new Error("Needs implemented.");
@@ -319,6 +326,9 @@
this._reset();
},
+ /**
+ * @param {WebInspector.ProfileType} profileType
+ */
_registerProfileType: function(profileType)
{
this._profileTypesByIdMap[profileType.id] = profileType;
@@ -328,12 +338,27 @@
this.sidebarTree.appendChild(profileType.treeElement);
},
- _makeKey: function(text, profileTypeId)
+ /**
+ * @param {string} text
+ * @param {string} profileTypeId
+ * @return {string}
+ */
+ _makeTitleKey: function(text, profileTypeId)
{
return escape(text) + '/' + escape(profileTypeId);
},
/**
+ * @param {number} id
+ * @param {string} profileTypeId
+ * @return {string}
+ */
+ _makeKey: function(id, profileTypeId)
+ {
+ return id + '/' + escape(profileTypeId);
+ },
+
+ /**
* @param {WebInspector.ProfileHeader} profile
*/
addProfileHeader: function(profile)
@@ -352,7 +377,7 @@
this._profilesIdMap[this._makeKey(profile.uid, typeId)] = profile;
if (!profile.title.startsWith(UserInitiatedProfileName)) {
- var profileTitleKey = this._makeKey(profile.title, typeId);
+ var profileTitleKey = this._makeTitleKey(profile.title, typeId);
if (!(profileTitleKey in this._profileGroups))
this._profileGroups[profileTitleKey] = [];
@@ -409,6 +434,9 @@
this.recordButton.title = this._selectedProfileType.buttonTooltip;
},
+ /**
+ * @param {WebInspector.ProfileHeader} profile
+ */
_removeProfileHeader: function(profile)
{
var typeId = profile.typeId;
@@ -424,7 +452,7 @@
}
delete this._profilesIdMap[this._makeKey(profile.uid, typeId)];
- var profileTitleKey = this._makeKey(profile.title, typeId);
+ var profileTitleKey = this._makeTitleKey(profile.title, typeId);
delete this._profileGroups[profileTitleKey];
sidebarParent.removeChild(profile._profilesTreeElement);
@@ -438,6 +466,9 @@
this.closeVisibleView();
},
+ /**
+ * @param {WebInspector.ProfileHeader} profile
+ */
showProfile: function(profile)
{
if (!profile || profile.isTemporary)
@@ -463,6 +494,10 @@
this.profileViewStatusBarItemsContainer.appendChild(statusBarItems[i]);
},
+ /**
+ * @param {string} typeId
+ * @return {Array.<WebInspector.ProfileHeader>}
+ */
getProfiles: function(typeId)
{
var result = [];
@@ -475,6 +510,10 @@
return result;
},
+ /**
+ * @param {string} typeId
+ * @return {WebInspector.ProfileHeader}
+ */
findTemporaryProfile: function(typeId)
{
var profilesCount = this._profiles.length;
@@ -484,6 +523,9 @@
return null;
},
+ /**
+ * @param {string} typeId
+ */
_removeTemporaryProfile: function(typeId)
{
var temporaryProfile = this.findTemporaryProfile(typeId);
@@ -491,16 +533,27 @@
this._removeProfileHeader(temporaryProfile);
},
+ /**
+ * @param {WebInspector.ProfileHeader} profile
+ */
hasProfile: function(profile)
{
return !!this._profilesIdMap[this._makeKey(profile.uid, profile.typeId)];
},
+ /**
+ * @param {string} typeId
+ * @param {number} uid
+ */
getProfile: function(typeId, uid)
{
return this._profilesIdMap[this._makeKey(uid, typeId)];
},
+ /**
+ * @param {number} uid
+ * @param {Function} callback
+ */
loadHeapSnapshot: function(uid, callback)
{
var profile = "" WebInspector.HeapSnapshotProfileType.TypeId)];
@@ -523,6 +576,10 @@
}
},
+ /**
+ * @param {number} uid
+ * @param {string} chunk
+ */
_addHeapSnapshotChunk: function(uid, chunk)
{
var profile = "" WebInspector.HeapSnapshotProfileType.TypeId)];
@@ -531,6 +588,9 @@
profile.proxy.pushJSONChunk(chunk);
},
+ /**
+ * @param {number} uid
+ */
_finishHeapSnapshot: function(uid)
{
var profile = "" WebInspector.HeapSnapshotProfileType.TypeId)];
@@ -549,22 +609,31 @@
profile.sidebarElement.subtitle = WebInspector.UIString("Parsing\u2026");
},
+ /**
+ * @param {WebInspector.View} view
+ */
showView: function(view)
{
this.showProfile(view.profile);
},
+ /**
+ * @param {string} typeId
+ */
getProfileType: function(typeId)
{
return this._profileTypesByIdMap[typeId];
},
+ /**
+ * @param {string} url
+ */
showProfileForURL: function(url)
{
var match = url.match(WebInspector.ProfileType.URLRegExp);
if (!match)
return;
- this.showProfile(this._profilesIdMap[this._makeKey(match[3], match[1])]);
+ this.showProfile(this._profilesIdMap[this._makeKey(Number(match[3]), match[1])]);
},
closeVisibleView: function()
@@ -574,13 +643,17 @@
delete this.visibleView;
},
+ /**
+ * @param {string} title
+ * @param {string} typeId
+ */
displayTitleForProfileLink: function(title, typeId)
{
title = unescape(title);
if (title.startsWith(UserInitiatedProfileName)) {
title = WebInspector.UIString("Profile %d", title.substring(UserInitiatedProfileName.length + 1));
} else {
- var titleKey = this._makeKey(title, typeId);
+ var titleKey = this._makeTitleKey(title, typeId);
if (!(titleKey in this._profileGroupsForLinks))
this._profileGroupsForLinks[titleKey] = 0;
@@ -872,6 +945,10 @@
this.profileViewStatusBarItemsContainer.style.left = Math.max(5 * 31, width) + "px";
},
+ /**
+ * @param {string} profileType
+ * @param {boolean} isProfiling
+ */
setRecordingProfile: function(profileType, isProfiling)
{
var profileTypeObject = this.getProfileType(profileType);
@@ -898,6 +975,10 @@
WebInspector.userMetrics.ProfilesHeapProfileTaken.record();
},
+ /**
+ * @param {number} done
+ * @param {number} total
+ */
_reportHeapSnapshotProgress: function(done, total)
{
var temporaryProfile = this.findTemporaryProfile(WebInspector.HeapSnapshotProfileType.TypeId);
@@ -922,11 +1003,6 @@
}
WebInspector.ProfilerDispatcher.prototype = {
- resetProfiles: function()
- {
- this._profiler._reset();
- },
-
/**
* @param {ProfilerAgent.ProfileHeader} profile
*/
@@ -936,21 +1012,47 @@
this._profiler.addProfileHeader(profileType.createProfile(profile));
},
+ /**
+ * @override
+ * @param {number} uid
+ * @param {string} chunk
+ */
addHeapSnapshotChunk: function(uid, chunk)
{
this._profiler._addHeapSnapshotChunk(uid, chunk);
},
+ /**
+ * @override
+ * @param {number} uid
+ */
finishHeapSnapshot: function(uid)
{
this._profiler._finishHeapSnapshot(uid);
},
+ /**
+ * @override
+ * @param {boolean} isProfiling
+ */
setRecordingProfile: function(isProfiling)
{
this._profiler.setRecordingProfile(WebInspector.CPUProfileType.TypeId, isProfiling);
},
+ /**
+ * @override
+ */
+ resetProfiles: function()
+ {
+ this._profiler._reset();
+ },
+
+ /**
+ * @override
+ * @param {number} done
+ * @param {number} total
+ */
reportHeapSnapshotProgress: function(done, total)
{
this._profiler._reportHeapSnapshotProgress(done, total);