Commit f58fc046 authored by yurys@chromium.org's avatar yurys@chromium.org

Web Inspector: enable Profiles panel for workers

https://bugs.webkit.org/show_bug.cgi?id=79908

Introduced worker profiler agent. Enabled script profiling for
workers.

Reviewed by Pavel Feldman.

* bindings/js/ScriptProfiler.cpp:
(WebCore::ScriptProfiler::startForPage):
(WebCore):
(WebCore::ScriptProfiler::startForWorkerContext):
(WebCore::ScriptProfiler::stopForPage):
(WebCore::ScriptProfiler::stopForWorkerContext):
* bindings/js/ScriptProfiler.h:
(WebCore):
(ScriptProfiler):
* bindings/v8/ScriptProfiler.cpp:
(WebCore::ScriptProfiler::startForPage):
(WebCore):
(WebCore::ScriptProfiler::startForWorkerContext):
(WebCore::ScriptProfiler::stopForPage):
(WebCore::ScriptProfiler::stopForWorkerContext):
* bindings/v8/ScriptProfiler.h:
(WebCore):
(ScriptProfiler):
* inspector/InspectorProfilerAgent.cpp:
(WebCore):
(PageProfilerAgent):
(WebCore::PageProfilerAgent::PageProfilerAgent):
(WebCore::PageProfilerAgent::~PageProfilerAgent):
(WebCore::PageProfilerAgent::startProfiling):
(WebCore::PageProfilerAgent::stopProfiling):
(WebCore::InspectorProfilerAgent::create):
(WorkerProfilerAgent):
(WebCore::WorkerProfilerAgent::WorkerProfilerAgent):
(WebCore::WorkerProfilerAgent::~WorkerProfilerAgent):
(WebCore::WorkerProfilerAgent::startProfiling):
(WebCore::WorkerProfilerAgent::stopProfiling):
(WebCore::InspectorProfilerAgent::InspectorProfilerAgent):
(WebCore::InspectorProfilerAgent::start):
(WebCore::InspectorProfilerAgent::stop):
* inspector/InspectorProfilerAgent.h:
(WebCore):
(InspectorProfilerAgent):
* inspector/WorkerInspectorController.cpp:
(WebCore::WorkerInspectorController::WorkerInspectorController):
(WebCore::WorkerInspectorController::connectFrontend):
(WebCore::WorkerInspectorController::disconnectFrontend):
(WebCore::WorkerInspectorController::restoreInspectorStateFromCookie):
* inspector/WorkerInspectorController.h:
(WebCore):
(WorkerInspectorController):
* inspector/front-end/ProfilesPanel.js:
* inspector/front-end/inspector.js:
(WebInspector._createPanels):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@109214 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent f9e7d617
2012-02-29 Yury Semikhatsky <yurys@chromium.org>
Web Inspector: enable Profiles panel for workers
https://bugs.webkit.org/show_bug.cgi?id=79908
Introduced worker profiler agent. Enabled script profiling for
workers.
Reviewed by Pavel Feldman.
* bindings/js/ScriptProfiler.cpp:
(WebCore::ScriptProfiler::startForPage):
(WebCore):
(WebCore::ScriptProfiler::startForWorkerContext):
(WebCore::ScriptProfiler::stopForPage):
(WebCore::ScriptProfiler::stopForWorkerContext):
* bindings/js/ScriptProfiler.h:
(WebCore):
(ScriptProfiler):
* bindings/v8/ScriptProfiler.cpp:
(WebCore::ScriptProfiler::startForPage):
(WebCore):
(WebCore::ScriptProfiler::startForWorkerContext):
(WebCore::ScriptProfiler::stopForPage):
(WebCore::ScriptProfiler::stopForWorkerContext):
* bindings/v8/ScriptProfiler.h:
(WebCore):
(ScriptProfiler):
* inspector/InspectorProfilerAgent.cpp:
(WebCore):
(PageProfilerAgent):
(WebCore::PageProfilerAgent::PageProfilerAgent):
(WebCore::PageProfilerAgent::~PageProfilerAgent):
(WebCore::PageProfilerAgent::startProfiling):
(WebCore::PageProfilerAgent::stopProfiling):
(WebCore::InspectorProfilerAgent::create):
(WorkerProfilerAgent):
(WebCore::WorkerProfilerAgent::WorkerProfilerAgent):
(WebCore::WorkerProfilerAgent::~WorkerProfilerAgent):
(WebCore::WorkerProfilerAgent::startProfiling):
(WebCore::WorkerProfilerAgent::stopProfiling):
(WebCore::InspectorProfilerAgent::InspectorProfilerAgent):
(WebCore::InspectorProfilerAgent::start):
(WebCore::InspectorProfilerAgent::stop):
* inspector/InspectorProfilerAgent.h:
(WebCore):
(InspectorProfilerAgent):
* inspector/WorkerInspectorController.cpp:
(WebCore::WorkerInspectorController::WorkerInspectorController):
(WebCore::WorkerInspectorController::connectFrontend):
(WebCore::WorkerInspectorController::disconnectFrontend):
(WebCore::WorkerInspectorController::restoreInspectorStateFromCookie):
* inspector/WorkerInspectorController.h:
(WebCore):
(WorkerInspectorController):
* inspector/front-end/ProfilesPanel.js:
* inspector/front-end/inspector.js:
(WebInspector._createPanels):
2012-02-29 Alexander Pavlov <apavlov@chromium.org> 2012-02-29 Alexander Pavlov <apavlov@chromium.org>
Web Inspector: Clicking relative links fails when query string contains a slash Web Inspector: Clicking relative links fails when query string contains a slash
...@@ -30,9 +30,13 @@ ...@@ -30,9 +30,13 @@
#include "ScriptProfiler.h" #include "ScriptProfiler.h"
#include "Frame.h"
#include "GCController.h" #include "GCController.h"
#include "JSDOMBinding.h" #include "JSDOMBinding.h"
#include "JSDOMWindow.h"
#include "Page.h"
#include "ScriptObject.h" #include "ScriptObject.h"
#include "ScriptState.h"
#include <profiler/Profiler.h> #include <profiler/Profiler.h>
namespace WebCore { namespace WebCore {
...@@ -52,12 +56,38 @@ void ScriptProfiler::start(ScriptState* state, const String& title) ...@@ -52,12 +56,38 @@ void ScriptProfiler::start(ScriptState* state, const String& title)
JSC::Profiler::profiler()->startProfiling(state, stringToUString(title)); JSC::Profiler::profiler()->startProfiling(state, stringToUString(title));
} }
void ScriptProfiler::startForPage(Page* inspectedPage, const String& title)
{
JSC::ExecState* scriptState = toJSDOMWindow(inspectedPage->mainFrame(), debuggerWorld())->globalExec();
start(scriptState, title);
}
#if ENABLE(WORKERS)
void ScriptProfiler::startForWorkerContext(WorkerContext* context, const String& title)
{
start(scriptStateFromWorkerContext(context), title);
}
#endif
PassRefPtr<ScriptProfile> ScriptProfiler::stop(ScriptState* state, const String& title) PassRefPtr<ScriptProfile> ScriptProfiler::stop(ScriptState* state, const String& title)
{ {
RefPtr<JSC::Profile> profile = JSC::Profiler::profiler()->stopProfiling(state, stringToUString(title)); RefPtr<JSC::Profile> profile = JSC::Profiler::profiler()->stopProfiling(state, stringToUString(title));
return ScriptProfile::create(profile); return ScriptProfile::create(profile);
} }
PassRefPtr<ScriptProfile> ScriptProfiler::stopForPage(Page* inspectedPage, const String& title)
{
JSC::ExecState* scriptState = toJSDOMWindow(inspectedPage->mainFrame(), debuggerWorld())->globalExec();
return stop(scriptState, title);
}
#if ENABLE(WORKERS)
PassRefPtr<ScriptProfile> ScriptProfiler::stopForWorkerContext(WorkerContext* context, const String& title)
{
return stop(scriptStateFromWorkerContext(context), title);
}
#endif
} // namespace WebCore } // namespace WebCore
#endif // ENABLE(JAVASCRIPT_DEBUGGER) #endif // ENABLE(JAVASCRIPT_DEBUGGER)
...@@ -37,7 +37,9 @@ ...@@ -37,7 +37,9 @@
namespace WebCore { namespace WebCore {
class DOMWrapperVisitor; class DOMWrapperVisitor;
class Page;
class ScriptObject; class ScriptObject;
class WorkerContext;
class ScriptProfiler { class ScriptProfiler {
WTF_MAKE_NONCOPYABLE(ScriptProfiler); WTF_MAKE_NONCOPYABLE(ScriptProfiler);
...@@ -54,7 +56,15 @@ public: ...@@ -54,7 +56,15 @@ public:
static void collectGarbage(); static void collectGarbage();
static ScriptObject objectByHeapObjectId(unsigned id); static ScriptObject objectByHeapObjectId(unsigned id);
static void start(ScriptState* state, const String& title); static void start(ScriptState* state, const String& title);
static void startForPage(Page*, const String& title);
#if ENABLE(WORKERS)
static void startForWorkerContext(WorkerContext*, const String& title);
#endif
static PassRefPtr<ScriptProfile> stop(ScriptState* state, const String& title); static PassRefPtr<ScriptProfile> stop(ScriptState* state, const String& title);
static PassRefPtr<ScriptProfile> stopForPage(Page*, const String& title);
#if ENABLE(WORKERS)
static PassRefPtr<ScriptProfile> stopForWorkerContext(WorkerContext*, const String& title);
#endif
static PassRefPtr<ScriptHeapSnapshot> takeHeapSnapshot(const String&, HeapSnapshotProgress*) { return 0; } static PassRefPtr<ScriptHeapSnapshot> takeHeapSnapshot(const String&, HeapSnapshotProgress*) { return 0; }
static bool causesRecompilation() { return true; } static bool causesRecompilation() { return true; }
static bool isSampling() { return false; } static bool isSampling() { return false; }
......
...@@ -49,6 +49,18 @@ void ScriptProfiler::start(ScriptState* state, const String& title) ...@@ -49,6 +49,18 @@ void ScriptProfiler::start(ScriptState* state, const String& title)
v8::CpuProfiler::StartProfiling(v8String(title)); v8::CpuProfiler::StartProfiling(v8String(title));
} }
void ScriptProfiler::startForPage(Page*, const String& title)
{
return start(0, title);
}
#if ENABLE(WORKERS)
void ScriptProfiler::startForWorkerContext(WorkerContext*, const String& title)
{
return start(0, title);
}
#endif
PassRefPtr<ScriptProfile> ScriptProfiler::stop(ScriptState* state, const String& title) PassRefPtr<ScriptProfile> ScriptProfiler::stop(ScriptState* state, const String& title)
{ {
v8::HandleScope hs; v8::HandleScope hs;
...@@ -58,6 +70,20 @@ PassRefPtr<ScriptProfile> ScriptProfiler::stop(ScriptState* state, const String& ...@@ -58,6 +70,20 @@ PassRefPtr<ScriptProfile> ScriptProfiler::stop(ScriptState* state, const String&
return profile ? ScriptProfile::create(profile) : 0; return profile ? ScriptProfile::create(profile) : 0;
} }
PassRefPtr<ScriptProfile> ScriptProfiler::stopForPage(Page*, const String& title)
{
// Use null script state to avoid filtering by context security token.
// All functions from all iframes should be visible from Inspector UI.
return stop(0, title);
}
#if ENABLE(WORKERS)
PassRefPtr<ScriptProfile> ScriptProfiler::stopForWorkerContext(WorkerContext*, const String& title)
{
return stop(0, title);
}
#endif
void ScriptProfiler::collectGarbage() void ScriptProfiler::collectGarbage()
{ {
v8::V8::LowMemoryNotification(); v8::V8::LowMemoryNotification();
......
...@@ -41,7 +41,9 @@ ...@@ -41,7 +41,9 @@
namespace WebCore { namespace WebCore {
class DOMWrapperVisitor; class DOMWrapperVisitor;
class Page;
class ScriptObject; class ScriptObject;
class WorkerContext;
class ScriptProfiler { class ScriptProfiler {
WTF_MAKE_NONCOPYABLE(ScriptProfiler); WTF_MAKE_NONCOPYABLE(ScriptProfiler);
...@@ -58,7 +60,15 @@ public: ...@@ -58,7 +60,15 @@ public:
static void collectGarbage(); static void collectGarbage();
static ScriptObject objectByHeapObjectId(unsigned id); static ScriptObject objectByHeapObjectId(unsigned id);
static void start(ScriptState* state, const String& title); static void start(ScriptState* state, const String& title);
static void startForPage(Page*, const String& title);
#if ENABLE(WORKERS)
static void startForWorkerContext(WorkerContext*, const String& title);
#endif
static PassRefPtr<ScriptProfile> stop(ScriptState* state, const String& title); static PassRefPtr<ScriptProfile> stop(ScriptState* state, const String& title);
static PassRefPtr<ScriptProfile> stopForPage(Page*, const String& title);
#if ENABLE(WORKERS)
static PassRefPtr<ScriptProfile> stopForWorkerContext(WorkerContext*, const String& title);
#endif
static PassRefPtr<ScriptHeapSnapshot> takeHeapSnapshot(const String& title, HeapSnapshotProgress*); static PassRefPtr<ScriptHeapSnapshot> takeHeapSnapshot(const String& title, HeapSnapshotProgress*);
static bool causesRecompilation() { return false; } static bool causesRecompilation() { return false; }
static bool isSampling() { return true; } static bool isSampling() { return true; }
......
...@@ -50,10 +50,6 @@ ...@@ -50,10 +50,6 @@
#include <wtf/OwnPtr.h> #include <wtf/OwnPtr.h>
#include <wtf/text/StringConcatenate.h> #include <wtf/text/StringConcatenate.h>
#if USE(JSC)
#include "JSDOMWindow.h"
#endif
namespace WebCore { namespace WebCore {
namespace ProfilerAgentState { namespace ProfilerAgentState {
...@@ -65,15 +61,63 @@ static const char* const UserInitiatedProfileName = "org.webkit.profiles.user-in ...@@ -65,15 +61,63 @@ static const char* const UserInitiatedProfileName = "org.webkit.profiles.user-in
static const char* const CPUProfileType = "CPU"; static const char* const CPUProfileType = "CPU";
static const char* const HeapProfileType = "HEAP"; static const char* const HeapProfileType = "HEAP";
class PageProfilerAgent : public InspectorProfilerAgent {
public:
PageProfilerAgent(InstrumentingAgents* instrumentingAgents, InspectorConsoleAgent* consoleAgent, Page* inspectedPage, InspectorState* state, InjectedScriptManager* injectedScriptManager)
: InspectorProfilerAgent(instrumentingAgents, consoleAgent, state, injectedScriptManager), m_inspectedPage(inspectedPage) { }
virtual ~PageProfilerAgent() { }
private:
virtual void startProfiling(const String& title)
{
ScriptProfiler::startForPage(m_inspectedPage, title);
}
virtual PassRefPtr<ScriptProfile> stopProfiling(const String& title)
{
return ScriptProfiler::stopForPage(m_inspectedPage, title);
}
Page* m_inspectedPage;
};
PassOwnPtr<InspectorProfilerAgent> InspectorProfilerAgent::create(InstrumentingAgents* instrumentingAgents, InspectorConsoleAgent* consoleAgent, Page* inspectedPage, InspectorState* inspectorState, InjectedScriptManager* injectedScriptManager) PassOwnPtr<InspectorProfilerAgent> InspectorProfilerAgent::create(InstrumentingAgents* instrumentingAgents, InspectorConsoleAgent* consoleAgent, Page* inspectedPage, InspectorState* inspectorState, InjectedScriptManager* injectedScriptManager)
{ {
return adoptPtr(new InspectorProfilerAgent(instrumentingAgents, consoleAgent, inspectedPage, inspectorState, injectedScriptManager)); return adoptPtr(new PageProfilerAgent(instrumentingAgents, consoleAgent, inspectedPage, inspectorState, injectedScriptManager));
}
#if ENABLE(WORKERS)
class WorkerProfilerAgent : public InspectorProfilerAgent {
public:
WorkerProfilerAgent(InstrumentingAgents* instrumentingAgents, InspectorConsoleAgent* consoleAgent, WorkerContext* workerContext, InspectorState* state, InjectedScriptManager* injectedScriptManager)
: InspectorProfilerAgent(instrumentingAgents, consoleAgent, state, injectedScriptManager), m_workerContext(workerContext) { }
virtual ~WorkerProfilerAgent() { }
private:
virtual void startProfiling(const String& title)
{
ScriptProfiler::startForWorkerContext(m_workerContext, title);
}
virtual PassRefPtr<ScriptProfile> stopProfiling(const String& title)
{
return ScriptProfiler::stopForWorkerContext(m_workerContext, title);
}
WorkerContext* m_workerContext;
};
PassOwnPtr<InspectorProfilerAgent> InspectorProfilerAgent::create(InstrumentingAgents* instrumentingAgents, InspectorConsoleAgent* consoleAgent, WorkerContext* workerContext, InspectorState* inspectorState, InjectedScriptManager* injectedScriptManager)
{
return adoptPtr(new WorkerProfilerAgent(instrumentingAgents, consoleAgent, workerContext, inspectorState, injectedScriptManager));
} }
#endif
InspectorProfilerAgent::InspectorProfilerAgent(InstrumentingAgents* instrumentingAgents, InspectorConsoleAgent* consoleAgent, Page* inspectedPage, InspectorState* inspectorState, InjectedScriptManager* injectedScriptManager) InspectorProfilerAgent::InspectorProfilerAgent(InstrumentingAgents* instrumentingAgents, InspectorConsoleAgent* consoleAgent, InspectorState* inspectorState, InjectedScriptManager* injectedScriptManager)
: InspectorBaseAgent<InspectorProfilerAgent>("Profiler", instrumentingAgents, inspectorState) : InspectorBaseAgent<InspectorProfilerAgent>("Profiler", instrumentingAgents, inspectorState)
, m_consoleAgent(consoleAgent) , m_consoleAgent(consoleAgent)
, m_inspectedPage(inspectedPage)
, m_injectedScriptManager(injectedScriptManager) , m_injectedScriptManager(injectedScriptManager)
, m_frontend(0) , m_frontend(0)
, m_enabled(false) , m_enabled(false)
...@@ -318,12 +362,7 @@ void InspectorProfilerAgent::start(ErrorString*) ...@@ -318,12 +362,7 @@ void InspectorProfilerAgent::start(ErrorString*)
} }
m_recordingUserInitiatedProfile = true; m_recordingUserInitiatedProfile = true;
String title = getCurrentUserInitiatedProfileName(true); String title = getCurrentUserInitiatedProfileName(true);
#if USE(JSC) startProfiling(title);
JSC::ExecState* scriptState = toJSDOMWindow(m_inspectedPage->mainFrame(), debuggerWorld())->globalExec();
#else
ScriptState* scriptState = 0;
#endif
ScriptProfiler::start(scriptState, title);
addStartProfilingMessageToConsole(title, 0, String()); addStartProfilingMessageToConsole(title, 0, String());
toggleRecordButton(true); toggleRecordButton(true);
m_state->setBoolean(ProfilerAgentState::userInitiatedProfiling, true); m_state->setBoolean(ProfilerAgentState::userInitiatedProfiling, true);
...@@ -335,14 +374,7 @@ void InspectorProfilerAgent::stop(ErrorString*) ...@@ -335,14 +374,7 @@ void InspectorProfilerAgent::stop(ErrorString*)
return; return;
m_recordingUserInitiatedProfile = false; m_recordingUserInitiatedProfile = false;
String title = getCurrentUserInitiatedProfileName(); String title = getCurrentUserInitiatedProfileName();
#if USE(JSC) RefPtr<ScriptProfile> profile = stopProfiling(title);
JSC::ExecState* scriptState = toJSDOMWindow(m_inspectedPage->mainFrame(), debuggerWorld())->globalExec();
#else
// Use null script state to avoid filtering by context security token.
// All functions from all iframes should be visible from Inspector UI.
ScriptState* scriptState = 0;
#endif
RefPtr<ScriptProfile> profile = ScriptProfiler::stop(scriptState, title);
if (profile) if (profile)
addProfile(profile, 0, String()); addProfile(profile, 0, String());
toggleRecordButton(false); toggleRecordButton(false);
......
...@@ -52,6 +52,7 @@ class InstrumentingAgents; ...@@ -52,6 +52,7 @@ class InstrumentingAgents;
class Page; class Page;
class ScriptHeapSnapshot; class ScriptHeapSnapshot;
class ScriptProfile; class ScriptProfile;
class WorkerContext;
typedef String ErrorString; typedef String ErrorString;
...@@ -59,6 +60,9 @@ class InspectorProfilerAgent : public InspectorBaseAgent<InspectorProfilerAgent> ...@@ -59,6 +60,9 @@ class InspectorProfilerAgent : public InspectorBaseAgent<InspectorProfilerAgent>
WTF_MAKE_NONCOPYABLE(InspectorProfilerAgent); WTF_MAKE_FAST_ALLOCATED; WTF_MAKE_NONCOPYABLE(InspectorProfilerAgent); WTF_MAKE_FAST_ALLOCATED;
public: public:
static PassOwnPtr<InspectorProfilerAgent> create(InstrumentingAgents*, InspectorConsoleAgent*, Page*, InspectorState*, InjectedScriptManager*); static PassOwnPtr<InspectorProfilerAgent> create(InstrumentingAgents*, InspectorConsoleAgent*, Page*, InspectorState*, InjectedScriptManager*);
#if ENABLE(WORKERS)
static PassOwnPtr<InspectorProfilerAgent> create(InstrumentingAgents*, InspectorConsoleAgent*, WorkerContext*, InspectorState*, InjectedScriptManager*);
#endif
virtual ~InspectorProfilerAgent(); virtual ~InspectorProfilerAgent();
void addProfile(PassRefPtr<ScriptProfile> prpProfile, unsigned lineNumber, const String& sourceURL); void addProfile(PassRefPtr<ScriptProfile> prpProfile, unsigned lineNumber, const String& sourceURL);
...@@ -94,6 +98,11 @@ public: ...@@ -94,6 +98,11 @@ public:
virtual void getObjectByHeapObjectId(ErrorString*, int id, const String* objectGroup, RefPtr<InspectorObject>& result); virtual void getObjectByHeapObjectId(ErrorString*, int id, const String* objectGroup, RefPtr<InspectorObject>& result);
protected:
InspectorProfilerAgent(InstrumentingAgents*, InspectorConsoleAgent*, InspectorState*, InjectedScriptManager*);
virtual void startProfiling(const String& title) = 0;
virtual PassRefPtr<ScriptProfile> stopProfiling(const String& title) = 0;
private: private:
typedef HashMap<unsigned int, RefPtr<ScriptProfile> > ProfilesMap; typedef HashMap<unsigned int, RefPtr<ScriptProfile> > ProfilesMap;
typedef HashMap<unsigned int, RefPtr<ScriptHeapSnapshot> > HeapSnapshotsMap; typedef HashMap<unsigned int, RefPtr<ScriptHeapSnapshot> > HeapSnapshotsMap;
...@@ -101,12 +110,10 @@ private: ...@@ -101,12 +110,10 @@ private:
void resetFrontendProfiles(); void resetFrontendProfiles();
void restoreEnablement(); void restoreEnablement();
InspectorProfilerAgent(InstrumentingAgents*, InspectorConsoleAgent*, Page*, InspectorState*, InjectedScriptManager*);
PassRefPtr<InspectorObject> createProfileHeader(const ScriptProfile& profile); PassRefPtr<InspectorObject> createProfileHeader(const ScriptProfile& profile);
PassRefPtr<InspectorObject> createSnapshotHeader(const ScriptHeapSnapshot& snapshot); PassRefPtr<InspectorObject> createSnapshotHeader(const ScriptHeapSnapshot& snapshot);
InspectorConsoleAgent* m_consoleAgent; InspectorConsoleAgent* m_consoleAgent;
Page* m_inspectedPage;
InjectedScriptManager* m_injectedScriptManager; InjectedScriptManager* m_injectedScriptManager;
InspectorFrontend::Profiler* m_frontend; InspectorFrontend::Profiler* m_frontend;
bool m_enabled; bool m_enabled;
......
...@@ -41,6 +41,7 @@ ...@@ -41,6 +41,7 @@
#include "InspectorConsoleAgent.h" #include "InspectorConsoleAgent.h"
#include "InspectorFrontend.h" #include "InspectorFrontend.h"
#include "InspectorFrontendChannel.h" #include "InspectorFrontendChannel.h"
#include "InspectorProfilerAgent.h"
#include "InspectorState.h" #include "InspectorState.h"
#include "InspectorStateClient.h" #include "InspectorStateClient.h"
#include "InstrumentingAgents.h" #include "InstrumentingAgents.h"
...@@ -93,11 +94,13 @@ WorkerInspectorController::WorkerInspectorController(WorkerContext* workerContex ...@@ -93,11 +94,13 @@ WorkerInspectorController::WorkerInspectorController(WorkerContext* workerContex
, m_injectedScriptManager(InjectedScriptManager::createForWorker()) , m_injectedScriptManager(InjectedScriptManager::createForWorker())
{ {
m_runtimeAgent = WorkerRuntimeAgent::create(m_instrumentingAgents.get(), m_state.get(), m_injectedScriptManager.get(), workerContext);
m_consoleAgent = WorkerConsoleAgent::create(m_instrumentingAgents.get(), m_state.get(), m_injectedScriptManager.get());
#if ENABLE(JAVASCRIPT_DEBUGGER) #if ENABLE(JAVASCRIPT_DEBUGGER)
m_debuggerAgent = WorkerDebuggerAgent::create(m_instrumentingAgents.get(), m_state.get(), workerContext, m_injectedScriptManager.get()); m_debuggerAgent = WorkerDebuggerAgent::create(m_instrumentingAgents.get(), m_state.get(), workerContext, m_injectedScriptManager.get());
m_profilerAgent = InspectorProfilerAgent::create(m_instrumentingAgents.get(), m_consoleAgent.get(), workerContext, m_state.get(), m_injectedScriptManager.get());
#endif #endif
m_runtimeAgent = WorkerRuntimeAgent::create(m_instrumentingAgents.get(), m_state.get(), m_injectedScriptManager.get(), workerContext);
m_consoleAgent = WorkerConsoleAgent::create(m_instrumentingAgents.get(), m_state.get(), m_injectedScriptManager.get());
m_injectedScriptManager->injectedScriptHost()->init(0 m_injectedScriptManager->injectedScriptHost()->init(0
, 0 , 0
...@@ -127,11 +130,13 @@ void WorkerInspectorController::connectFrontend() ...@@ -127,11 +130,13 @@ void WorkerInspectorController::connectFrontend()
m_consoleAgent->registerInDispatcher(m_backendDispatcher.get()); m_consoleAgent->registerInDispatcher(m_backendDispatcher.get());
#if ENABLE(JAVASCRIPT_DEBUGGER) #if ENABLE(JAVASCRIPT_DEBUGGER)
m_debuggerAgent->registerInDispatcher(m_backendDispatcher.get()); m_debuggerAgent->registerInDispatcher(m_backendDispatcher.get());
m_profilerAgent->registerInDispatcher(m_backendDispatcher.get());
#endif #endif
m_runtimeAgent->registerInDispatcher(m_backendDispatcher.get()); m_runtimeAgent->registerInDispatcher(m_backendDispatcher.get());
#if ENABLE(JAVASCRIPT_DEBUGGER) #if ENABLE(JAVASCRIPT_DEBUGGER)
m_debuggerAgent->setFrontend(m_frontend.get()); m_debuggerAgent->setFrontend(m_frontend.get());
m_profilerAgent->setFrontend(m_frontend.get());
#endif #endif
m_consoleAgent->setFrontend(m_frontend.get()); m_consoleAgent->setFrontend(m_frontend.get());
} }
...@@ -147,6 +152,7 @@ void WorkerInspectorController::disconnectFrontend() ...@@ -147,6 +152,7 @@ void WorkerInspectorController::disconnectFrontend()
m_state->mute(); m_state->mute();
#if ENABLE(JAVASCRIPT_DEBUGGER) #if ENABLE(JAVASCRIPT_DEBUGGER)
m_debuggerAgent->clearFrontend(); m_debuggerAgent->clearFrontend();
m_profilerAgent->clearFrontend();
#endif #endif
m_consoleAgent->clearFrontend(); m_consoleAgent->clearFrontend();
...@@ -162,6 +168,7 @@ void WorkerInspectorController::restoreInspectorStateFromCookie(const String& in ...@@ -162,6 +168,7 @@ void WorkerInspectorController::restoreInspectorStateFromCookie(const String& in
#if ENABLE(JAVASCRIPT_DEBUGGER) #if ENABLE(JAVASCRIPT_DEBUGGER)
m_debuggerAgent->restore(); m_debuggerAgent->restore();
m_profilerAgent->restore();
#endif #endif
m_consoleAgent->restore(); m_consoleAgent->restore();
} }
......
...@@ -51,6 +51,7 @@ class InspectorFrontend; ...@@ -51,6 +51,7 @@ class InspectorFrontend;
class InspectorFrontendChannel; class InspectorFrontendChannel;
class InspectorConsoleAgent; class InspectorConsoleAgent;
class InspectorInstrumentation; class InspectorInstrumentation;
class InspectorProfilerAgent;
class InspectorRuntimeAgent; class InspectorRuntimeAgent;
class InspectorState; class InspectorState;
class InspectorStateClient; class InspectorStateClient;
...@@ -83,6 +84,7 @@ private: ...@@ -83,6 +84,7 @@ private:
OwnPtr<InjectedScriptManager> m_injectedScriptManager; OwnPtr<InjectedScriptManager> m_injectedScriptManager;
#if ENABLE(JAVASCRIPT_DEBUGGER) #if ENABLE(JAVASCRIPT_DEBUGGER)
OwnPtr<InspectorDebuggerAgent> m_debuggerAgent; OwnPtr<InspectorDebuggerAgent> m_debuggerAgent;
OwnPtr<InspectorProfilerAgent> m_profilerAgent;
#endif #endif
OwnPtr<InspectorRuntimeAgent> m_runtimeAgent; OwnPtr<InspectorRuntimeAgent> m_runtimeAgent;
OwnPtr<InspectorConsoleAgent> m_consoleAgent; OwnPtr<InspectorConsoleAgent> m_consoleAgent;
......
...@@ -142,7 +142,8 @@ WebInspector.ProfilesPanel = function() ...@@ -142,7 +142,8 @@ WebInspector.ProfilesPanel = function()
this._launcherView.setUpEventListeners(); this._launcherView.setUpEventListeners();
this._registerProfileType(new WebInspector.CPUProfileType()); this._registerProfileType(new WebInspector.CPUProfileType());
this._registerProfileType(new WebInspector.CSSSelectorProfileType()); if (!WebInspector.WorkerManager.isWorkerFrontend())
this._registerProfileType(new WebInspector.CSSSelectorProfileType());
if (Capabilities.heapProfilerPresent) if (Capabilities.heapProfilerPresent)
this._registerProfileType(new WebInspector.DetailedHeapshotProfileType()); this._registerProfileType(new WebInspector.DetailedHeapshotProfileType());
......
...@@ -39,6 +39,7 @@ var WebInspector = { ...@@ -39,6 +39,7 @@ var WebInspector = {
if (WebInspector.WorkerManager.isWorkerFrontend()) { if (WebInspector.WorkerManager.isWorkerFrontend()) {
this.panels.scripts = new WebInspector.ScriptsPanel(this.debuggerPresentationModel); this.panels.scripts = new WebInspector.ScriptsPanel(this.debuggerPresentationModel);
this.panels.profiles = new WebInspector.ProfilesPanel();
this.panels.console = new WebInspector.ConsolePanel(); this.panels.console = new WebInspector.ConsolePanel();
return; return;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment