There is a mistake in InspectorProfilerAgent::enable(bool skipRecompile)
https://bugs.webkit.org/show_bug.cgi?id=97450

Patch by Peter Wang <peter.wang@torchmobile.com.cn> on 2012-09-24
Reviewed by Yury Semikhatsky.

The "InspectorProfilerAgent::enable()" should invokes "PageScriptDebugServer" in
no-worker thread.

No new test case.

* inspector/InspectorProfilerAgent.cpp:
(WebCore::PageProfilerAgent::recompileScript):
(PageProfilerAgent):
(WebCore::WorkerProfilerAgent::recompileScript):
(WorkerProfilerAgent):
(WebCore::InspectorProfilerAgent::disable):
(WebCore::InspectorProfilerAgent::enable):
* inspector/InspectorProfilerAgent.h:
(InspectorProfilerAgent):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@129438 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/inspector/InspectorProfilerAgent.cpp b/Source/WebCore/inspector/InspectorProfilerAgent.cpp
index 4540aa7..9c864c5 100644
--- a/Source/WebCore/inspector/InspectorProfilerAgent.cpp
+++ b/Source/WebCore/inspector/InspectorProfilerAgent.cpp
@@ -48,6 +48,7 @@
 #include "ScriptObject.h"
 #include "ScriptProfile.h"
 #include "ScriptProfiler.h"
+#include "WorkerScriptDebugServer.h"
 #include <wtf/OwnPtr.h>
 #include <wtf/text/StringConcatenate.h>
 
@@ -70,6 +71,11 @@
     virtual ~PageProfilerAgent() { }
 
 private:
+    virtual void recompileScript()
+    {
+        PageScriptDebugServer::shared().recompileAllJSFunctionsSoon();
+    }
+
     virtual void startProfiling(const String& title)
     {
         ScriptProfiler::startForPage(m_inspectedPage, title);
@@ -88,7 +94,6 @@
     return adoptPtr(new PageProfilerAgent(instrumentingAgents, consoleAgent, inspectedPage, inspectorState, injectedScriptManager));
 }
 
-
 #if ENABLE(WORKERS)
 class WorkerProfilerAgent : public InspectorProfilerAgent {
 public:
@@ -97,6 +102,8 @@
     virtual ~WorkerProfilerAgent() { }
 
 private:
+    virtual void recompileScript() { }
+
     virtual void startProfiling(const String& title)
     {
         ScriptProfiler::startForWorkerContext(m_workerContext, title);
@@ -222,7 +229,7 @@
         return;
     m_enabled = false;
     m_headersRequested = false;
-    PageScriptDebugServer::shared().recompileAllJSFunctionsSoon();
+    recompileScript();
 }
 
 void InspectorProfilerAgent::enable(bool skipRecompile)
@@ -231,7 +238,7 @@
         return;
     m_enabled = true;
     if (!skipRecompile)
-        PageScriptDebugServer::shared().recompileAllJSFunctionsSoon();
+        recompileScript();
 }
 
 String InspectorProfilerAgent::getCurrentUserInitiatedProfileName(bool incrementProfileNumber)