Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(314)

Unified Diff: webkit/glue/devtools/js/debugger_agent.js

Issue 115299: Add initial version of DevTools Profiler (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webkit/glue/devtools/debugger_agent_impl.cc ('k') | webkit/glue/devtools/js/devtools.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/glue/devtools/js/debugger_agent.js
===================================================================
--- webkit/glue/devtools/js/debugger_agent.js (revision 15955)
+++ webkit/glue/devtools/js/debugger_agent.js (working copy)
@@ -17,6 +17,8 @@
goog.bind(this.handleDebuggerOutput_, this);
RemoteDebuggerAgent.DidGetContextId =
goog.bind(this.didGetContextId_, this);
+ RemoteDebuggerAgent.DidGetLogLines =
+ goog.bind(this.didGetLogLines_, this);
/**
* Id of the inspected page global context. It is used for filtering scripts.
@@ -63,6 +65,25 @@
* @type {boolean}
*/
this.scriptsCacheInitialized_ = false;
+
+ /**
+ * Whether user has stopped profiling and we are retrieving the rest of
+ * profiler's log.
+ * @type {boolean}
+ */
+ this.isProcessingProfile_ = false;
+
+ /**
+ * The position in log file to read from.
+ * @type {number}
+ */
+ this.lastProfileLogPosition_ = 0;
+
+ /**
+ * Profiler processor instance.
+ * @type {devtools.profiler.Processor}
+ */
+ this.profilerProcessor_ = new devtools.profiler.Processor();
};
@@ -287,6 +308,28 @@
/**
+ * Starts (resumes) profiling.
+ */
+devtools.DebuggerAgent.prototype.startProfiling = function() {
+ if (this.isProcessingProfile_) {
+ return;
+ }
+ RemoteDebuggerAgent.StartProfiling();
+ RemoteDebuggerAgent.GetLogLines(this.lastProfileLogPosition_);
+ WebInspector.setRecordingProfile(true);
+};
+
+
+/**
+ * Stops (pauses) profiling.
+ */
+devtools.DebuggerAgent.prototype.stopProfiling = function() {
+ this.isProcessingProfile_ = true;
+ RemoteDebuggerAgent.StopProfiling();
+};
+
+
+/**
* Removes specified breakpoint from the v8 debugger.
* @param {number} breakpointId Id of the breakpoint in the v8 debugger.
*/
@@ -519,6 +562,28 @@
}
this.addScriptInfo_(script);
};
+
+
+/**
+ * Handles a portion of a profiler log retrieved by GetLogLines call.
+ * @param {string} log A portion of profiler log.
+ * @param {number} newPosition The position in log file to read from
+ * next time.
+ */
+devtools.DebuggerAgent.prototype.didGetLogLines_ = function(
+ log, newPosition) {
+ if (log.length > 0) {
+ this.profilerProcessor_.processLogChunk(log);
+ this.lastProfileLogPosition_ = newPosition;
+ } else if (this.isProcessingProfile_) {
+ this.isProcessingProfile_ = false;
+ WebInspector.setRecordingProfile(false);
+ WebInspector.addProfile(this.profilerProcessor_.createProfileForView());
+ return;
+ }
+ setTimeout(function() { RemoteDebuggerAgent.GetLogLines(newPosition); },
+ this.isProcessingProfile_ ? 100 : 1000);
+};
/**
« no previous file with comments | « webkit/glue/devtools/debugger_agent_impl.cc ('k') | webkit/glue/devtools/js/devtools.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698