2010-10-05 Pavel Podivilov <podivilov@chromium.org>

        Reviewed by Pavel Feldman.

        Web Inspector: extract Inspector Instrumentation API as a class
        https://bugs.webkit.org/show_bug.cgi?id=47173

        * bindings/js/JSXMLHttpRequestCustom.cpp:
        (WebCore::JSXMLHttpRequest::send):
        * bindings/js/ScriptController.cpp:
        (WebCore::ScriptController::evaluateInWorld):
        * bindings/v8/V8DOMWindowShell.cpp:
        * bindings/v8/V8Proxy.cpp:
        (WebCore::V8Proxy::evaluate):
        (WebCore::V8Proxy::callFunction):
        * bindings/v8/custom/V8XMLHttpRequestCustom.cpp:
        (WebCore::V8XMLHttpRequest::sendCallback):
        * dom/Document.cpp:
        (WebCore::Document::recalcStyle):
        * dom/Document.h:
        * dom/Node.cpp:
        (WebCore::Node::dispatchGenericEvent):
        * html/parser/HTMLDocumentParser.cpp:
        (WebCore::HTMLDocumentParser::pumpTokenizer):
        * html/parser/HTMLDocumentParser.h:
        * inspector/InspectorInstrumentation.cpp:
        (WebCore::InspectorInstrumentation::hasFrontend):
        (WebCore::InspectorInstrumentation::retrieveTimelineAgent):
        * inspector/InspectorInstrumentation.h:
        (WebCore::InspectorInstrumentation::hasFrontends):
        (WebCore::InspectorInstrumentation::inspectorControllerForContext):
        (WebCore::InspectorInstrumentation::inspectorControllerForDocument):
        (WebCore::InspectorInstrumentation::inspectorControllerForFrame):
        (WebCore::InspectorInstrumentation::inspectorControllerForPage):
        * inspector/InspectorTimelineAgent.cpp:
        (WebCore::InspectorTimelineAgent::InspectorTimelineAgent):
        (WebCore::InspectorTimelineAgent::~InspectorTimelineAgent):
        * inspector/InspectorTimelineAgent.h:
        * loader/ResourceLoader.cpp:
        (WebCore::ResourceLoader::didReceiveResponse):
        (WebCore::ResourceLoader::didReceiveData):
        * loader/loader.cpp:
        (WebCore::Loader::load):
        * page/DOMTimer.cpp:
        (WebCore::DOMTimer::install):
        (WebCore::DOMTimer::removeById):
        (WebCore::DOMTimer::fired):
        * page/DOMTimer.h:
        * page/DOMWindow.cpp:
        (WebCore::DOMWindow::dispatchEvent):
        * page/DOMWindow.h:
        * page/FrameView.cpp:
        (WebCore::FrameView::layout):
        (WebCore::FrameView::paintContents):
        * page/FrameView.h:
        * page/Page.cpp:
        * page/Page.h:
        * rendering/RenderLayerBacking.cpp:
        (WebCore::RenderLayerBacking::paintContents):
        * xml/XMLHttpRequest.cpp:
        (WebCore::XMLHttpRequest::callReadyStateChangeListener):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@69283 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent ce662830
2010-10-05 Pavel Podivilov <podivilov@chromium.org>
Reviewed by Pavel Feldman.
Web Inspector: extract Inspector Instrumentation API as a class
https://bugs.webkit.org/show_bug.cgi?id=47173
* bindings/js/JSXMLHttpRequestCustom.cpp:
(WebCore::JSXMLHttpRequest::send):
* bindings/js/ScriptController.cpp:
(WebCore::ScriptController::evaluateInWorld):
* bindings/v8/V8DOMWindowShell.cpp:
* bindings/v8/V8Proxy.cpp:
(WebCore::V8Proxy::evaluate):
(WebCore::V8Proxy::callFunction):
* bindings/v8/custom/V8XMLHttpRequestCustom.cpp:
(WebCore::V8XMLHttpRequest::sendCallback):
* dom/Document.cpp:
(WebCore::Document::recalcStyle):
* dom/Document.h:
* dom/Node.cpp:
(WebCore::Node::dispatchGenericEvent):
* html/parser/HTMLDocumentParser.cpp:
(WebCore::HTMLDocumentParser::pumpTokenizer):
* html/parser/HTMLDocumentParser.h:
* inspector/InspectorInstrumentation.cpp:
(WebCore::InspectorInstrumentation::hasFrontend):
(WebCore::InspectorInstrumentation::retrieveTimelineAgent):
* inspector/InspectorInstrumentation.h:
(WebCore::InspectorInstrumentation::hasFrontends):
(WebCore::InspectorInstrumentation::inspectorControllerForContext):
(WebCore::InspectorInstrumentation::inspectorControllerForDocument):
(WebCore::InspectorInstrumentation::inspectorControllerForFrame):
(WebCore::InspectorInstrumentation::inspectorControllerForPage):
* inspector/InspectorTimelineAgent.cpp:
(WebCore::InspectorTimelineAgent::InspectorTimelineAgent):
(WebCore::InspectorTimelineAgent::~InspectorTimelineAgent):
* inspector/InspectorTimelineAgent.h:
* loader/ResourceLoader.cpp:
(WebCore::ResourceLoader::didReceiveResponse):
(WebCore::ResourceLoader::didReceiveData):
* loader/loader.cpp:
(WebCore::Loader::load):
* page/DOMTimer.cpp:
(WebCore::DOMTimer::install):
(WebCore::DOMTimer::removeById):
(WebCore::DOMTimer::fired):
* page/DOMTimer.h:
* page/DOMWindow.cpp:
(WebCore::DOMWindow::dispatchEvent):
* page/DOMWindow.h:
* page/FrameView.cpp:
(WebCore::FrameView::layout):
(WebCore::FrameView::paintContents):
* page/FrameView.h:
* page/Page.cpp:
* page/Page.h:
* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::paintContents):
* xml/XMLHttpRequest.cpp:
(WebCore::XMLHttpRequest::callReadyStateChangeListener):
2010-10-07 Zraly Mike <mike.zraly@nokia.com>
Reviewed by Andreas Kling.
......@@ -94,7 +94,7 @@ JSValue JSXMLHttpRequest::open(ExecState* exec)
JSValue JSXMLHttpRequest::send(ExecState* exec)
{
InspectorInstrumentation::instrumentWillSendXMLHttpRequest(impl()->scriptExecutionContext(), impl()->url());
InspectorInstrumentation::willSendXMLHttpRequest(impl()->scriptExecutionContext(), impl()->url());
ExceptionCode ec = 0;
if (!exec->argumentCount())
......
......@@ -28,7 +28,7 @@
#include "FrameLoaderClient.h"
#include "GCController.h"
#include "HTMLPlugInElement.h"
#include "InspectorTimelineAgent.h"
#include "InspectorInstrumentation.h"
#include "JSDocument.h"
#include "JSMainThreadExecState.h"
#include "NP_jsobject.h"
......@@ -142,19 +142,13 @@ ScriptValue ScriptController::evaluateInWorld(const ScriptSourceCode& sourceCode
RefPtr<Frame> protect = m_frame;
#if ENABLE(INSPECTOR)
if (InspectorTimelineAgent* timelineAgent = m_frame->page() ? m_frame->page()->inspectorTimelineAgent() : 0)
timelineAgent->willEvaluateScript(sourceURL, sourceCode.startLine());
#endif
InspectorInstrumentationCookie cookie = InspectorInstrumentation::willEvaluateScript(m_frame, sourceURL, sourceCode.startLine());
exec->globalData().timeoutChecker.start();
Completion comp = JSMainThreadExecState::evaluate(exec, exec->dynamicGlobalObject()->globalScopeChain(), jsSourceCode, shell);
exec->globalData().timeoutChecker.stop();
#if ENABLE(INSPECTOR)
if (InspectorTimelineAgent* timelineAgent = m_frame->page() ? m_frame->page()->inspectorTimelineAgent() : 0)
timelineAgent->didEvaluateScript();
#endif
InspectorInstrumentation::didEvaluateScript(m_frame, cookie);
// Evaluating the JavaScript could cause the frame to be deallocated
// so we start the keep alive timer here.
......
......@@ -37,7 +37,6 @@
#include "DocumentLoader.h"
#include "Frame.h"
#include "FrameLoaderClient.h"
#include "InspectorTimelineAgent.h"
#include "Page.h"
#include "PageGroup.h"
#include "ScriptController.h"
......
......@@ -39,7 +39,7 @@
#include "FrameLoaderClient.h"
#include "IDBFactoryBackendInterface.h"
#include "IDBPendingTransactionMonitor.h"
#include "InspectorTimelineAgent.h"
#include "InspectorInstrumentation.h"
#include "Page.h"
#include "PageGroup.h"
#include "PlatformBridge.h"
......@@ -376,10 +376,7 @@ v8::Local<v8::Value> V8Proxy::evaluate(const ScriptSourceCode& source, Node* nod
V8GCController::checkMemoryUsage();
#if ENABLE(INSPECTOR)
if (InspectorTimelineAgent* timelineAgent = m_frame->page() ? m_frame->page()->inspectorTimelineAgent() : 0)
timelineAgent->willEvaluateScript(source.url().isNull() ? String() : source.url().string(), source.startLine());
#endif
InspectorInstrumentationCookie cookie = InspectorInstrumentation::willEvaluateScript(m_frame, source.url().isNull() ? String() : source.url().string(), source.startLine());
v8::Local<v8::Value> result;
{
......@@ -414,10 +411,7 @@ v8::Local<v8::Value> V8Proxy::evaluate(const ScriptSourceCode& source, Node* nod
PlatformBridge::traceEventEnd("v8.run", node, "");
#endif
#if ENABLE(INSPECTOR)
if (InspectorTimelineAgent* timelineAgent = m_frame->page() ? m_frame->page()->inspectorTimelineAgent() : 0)
timelineAgent->didEvaluateScript();
#endif
InspectorInstrumentation::didEvaluateScript(m_frame, cookie);
return result;
}
......@@ -505,33 +499,23 @@ v8::Local<v8::Value> V8Proxy::callFunction(v8::Handle<v8::Function> function, v8
// execution finishs before firing the timer.
m_frame->keepAlive();
#if ENABLE(INSPECTOR)
Page* inspectedPage = InspectorTimelineAgent::instanceCount() ? m_frame->page(): 0;
if (inspectedPage) {
if (InspectorTimelineAgent* timelineAgent = inspectedPage->inspectorTimelineAgent()) {
v8::ScriptOrigin origin = function->GetScriptOrigin();
String resourceName("undefined");
int lineNumber = 1;
if (!origin.ResourceName().IsEmpty()) {
resourceName = toWebCoreString(origin.ResourceName());
lineNumber = function->GetScriptLineNumber() + 1;
}
timelineAgent->willCallFunction(resourceName, lineNumber);
} else
inspectedPage = 0;
InspectorInstrumentationCookie cookie = 0;
if (InspectorInstrumentation::hasFrontends()) {
v8::ScriptOrigin origin = function->GetScriptOrigin();
String resourceName("undefined");
int lineNumber = 1;
if (!origin.ResourceName().IsEmpty()) {
resourceName = toWebCoreString(origin.ResourceName());
lineNumber = function->GetScriptLineNumber() + 1;
}
cookie = InspectorInstrumentation::willCallFunction(m_frame, resourceName, lineNumber);
}
#endif // !ENABLE(INSPECTOR)
m_recursion++;
result = function->Call(receiver, argc, args);
m_recursion--;
#if ENABLE(INSPECTOR)
if (inspectedPage)
if (InspectorTimelineAgent* timelineAgent = inspectedPage->inspectorTimelineAgent())
timelineAgent->didCallFunction();
#endif // !ENABLE(INSPECTOR)
InspectorInstrumentation::didCallFunction(m_frame, cookie);
}
// Release the storage mutex if applicable.
......
......@@ -114,7 +114,7 @@ v8::Handle<v8::Value> V8XMLHttpRequest::sendCallback(const v8::Arguments& args)
INC_STATS("DOM.XMLHttpRequest.send()");
XMLHttpRequest* xmlHttpRequest = V8XMLHttpRequest::toNative(args.Holder());
InspectorInstrumentation::instrumentWillSendXMLHttpRequest(xmlHttpRequest->scriptExecutionContext(), xmlHttpRequest->url());
InspectorInstrumentation::willSendXMLHttpRequest(xmlHttpRequest->scriptExecutionContext(), xmlHttpRequest->url());
ExceptionCode ec = 0;
if (args.Length() < 1)
......
......@@ -88,7 +88,7 @@
#include "HitTestResult.h"
#include "ImageLoader.h"
#include "InspectorController.h"
#include "InspectorTimelineAgent.h"
#include "InspectorInstrumentation.h"
#include "KeyboardEvent.h"
#include "Logging.h"
#include "MessageEvent.h"
......@@ -1460,10 +1460,7 @@ void Document::recalcStyle(StyleChange change)
if (m_inStyleRecalc)
return; // Guard against re-entrancy. -dwh
#if ENABLE(INSPECTOR)
if (InspectorTimelineAgent* timelineAgent = inspectorTimelineAgent())
timelineAgent->willRecalculateStyle();
#endif
InspectorInstrumentationCookie cookie = InspectorInstrumentation::willRecalculateStyle(this);
m_inStyleRecalc = true;
suspendPostAttachCallbacks();
......@@ -1518,10 +1515,7 @@ bail_out:
implicitClose();
}
#if ENABLE(INSPECTOR)
if (InspectorTimelineAgent* timelineAgent = inspectorTimelineAgent())
timelineAgent->didRecalculateStyle();
#endif
InspectorInstrumentation::didRecalculateStyle(this, cookie);
}
void Document::updateStyleIfNeeded()
......@@ -4685,18 +4679,6 @@ bool Document::isXHTMLMPDocument() const
}
#endif
#if ENABLE(INSPECTOR)
InspectorTimelineAgent* Document::inspectorTimelineAgent() const
{
return page() ? page()->inspectorTimelineAgent() : 0;
}
InspectorController* Document::inspectorController() const
{
return page() ? page()->inspectorController() : 0;
}
#endif
#if ENABLE(FULLSCREEN_API)
void Document::webkitRequestFullScreenForElement(Element* element, unsigned short flags)
{
......
......@@ -88,7 +88,6 @@ class HTMLInputElement;
class HTMLMapElement;
class HitTestRequest;
class HitTestResult;
class InspectorTimelineAgent;
class IntPoint;
class DOMWrapperWorld;
class JSNode;
......@@ -480,10 +479,6 @@ public:
Frame* frame() const { return m_frame; } // can be NULL
Page* page() const; // can be NULL
Settings* settings() const; // can be NULL
#if ENABLE(INSPECTOR)
InspectorTimelineAgent* inspectorTimelineAgent() const; // can be NULL
virtual InspectorController* inspectorController() const; // can be NULL
#endif
PassRefPtr<Range> createRange();
......
......@@ -2602,7 +2602,7 @@ bool Node::dispatchGenericEvent(PassRefPtr<Event> prpEvent)
targetForWindowEvents = static_cast<Document*>(topLevelContainer)->domWindow();
}
int instrumentationCookie = InspectorInstrumentation::instrumentWillDispatchEvent(document(), *event, targetForWindowEvents, this, ancestors);
InspectorInstrumentationCookie cookie = InspectorInstrumentation::willDispatchEvent(document(), *event, targetForWindowEvents, this, ancestors);
// Give the target node a chance to do some work before DOM event handlers get a crack.
void* data = preDispatchEventHandler(event.get());
......@@ -2685,7 +2685,7 @@ doneDispatching:
doneWithDefault:
InspectorInstrumentation::instrumentDidDispatchEvent(document(), instrumentationCookie);
InspectorInstrumentation::didDispatchEvent(document(), cookie);
return !event->defaultPrevented();
}
......
......@@ -36,15 +36,12 @@
#include "HTMLScriptRunner.h"
#include "HTMLTreeBuilder.h"
#include "HTMLDocument.h"
#include "InspectorInstrumentation.h"
#include "NestingLevelIncrementer.h"
#include "Settings.h"
#include "XSSAuditor.h"
#include <wtf/CurrentTime.h>
#if ENABLE(INSPECTOR)
#include "InspectorTimelineAgent.h"
#endif
namespace WebCore {
using namespace HTMLNames;
......@@ -210,9 +207,12 @@ void HTMLDocumentParser::pumpTokenizer(SynchronousMode mode)
// ASSERT that this object is both attached to the Document and protected.
ASSERT(refCount() >= 2);
// We tell the InspectorTimelineAgent about every pump, even if we
// We tell the InspectorInstrumentation about every pump, even if we
// end up pumping nothing. It can filter out empty pumps itself.
willPumpLexer();
// FIXME: m_input.current().length() is only accurate if we
// end up parsing the whole buffer in this pump. We should pass how
// much we parsed as part of didWriteHTML instead of willWriteHTML.
InspectorInstrumentationCookie cookie = InspectorInstrumentation::willWriteHTML(document(), m_input.current().length(), m_tokenizer->lineNumber());
HTMLParserScheduler::PumpSession session;
// FIXME: This loop body has is now too long and needs cleanup.
......@@ -256,26 +256,7 @@ void HTMLDocumentParser::pumpTokenizer(SynchronousMode mode)
m_preloadScanner->scan();
}
didPumpLexer();
}
void HTMLDocumentParser::willPumpLexer()
{
#if ENABLE(INSPECTOR)
// FIXME: m_input.current().length() is only accurate if we
// end up parsing the whole buffer in this pump. We should pass how
// much we parsed as part of didWriteHTML instead of willWriteHTML.
if (InspectorTimelineAgent* timelineAgent = document()->inspectorTimelineAgent())
timelineAgent->willWriteHTML(m_input.current().length(), m_tokenizer->lineNumber());
#endif
}
void HTMLDocumentParser::didPumpLexer()
{
#if ENABLE(INSPECTOR)
if (InspectorTimelineAgent* timelineAgent = document()->inspectorTimelineAgent())
timelineAgent->didWriteHTML(m_tokenizer->lineNumber());
#endif
InspectorInstrumentation::didWriteHTML(document(), m_tokenizer->lineNumber(), cookie);
}
bool HTMLDocumentParser::hasInsertionPoint()
......
......@@ -103,9 +103,6 @@ private:
// CachedResourceClient
virtual void notifyFinished(CachedResource*);
void willPumpLexer();
void didPumpLexer();
enum SynchronousMode {
AllowYield,
ForceSynchronous,
......
......@@ -44,14 +44,12 @@
namespace WebCore {
int InspectorTimelineAgent::s_instanceCount = 0;
int InspectorTimelineAgent::s_id = 0;
InspectorTimelineAgent::InspectorTimelineAgent(InspectorFrontend* frontend)
: m_frontend(frontend)
, m_id(++s_id)
{
++s_instanceCount;
ScriptGCEvent::addEventListener(this);
ASSERT(m_frontend);
}
......@@ -78,8 +76,6 @@ void InspectorTimelineAgent::didGC(double startTime, double endTime, size_t coll
InspectorTimelineAgent::~InspectorTimelineAgent()
{
ASSERT(s_instanceCount);
--s_instanceCount;
ScriptGCEvent::removeEventListener(this);
}
......
......@@ -33,9 +33,7 @@
#if ENABLE(INSPECTOR)
#include "Document.h"
#include "InspectorValues.h"
#include "ScriptExecutionContext.h"
#include "ScriptGCEvent.h"
#include "ScriptGCEventListener.h"
#include <wtf/Vector.h>
......@@ -130,9 +128,6 @@ public:
virtual void didGC(double, double, size_t);
static int instanceCount() { return s_instanceCount; }
static InspectorTimelineAgent* retrieve(ScriptExecutionContext*);
private:
struct TimelineRecordEntry {
TimelineRecordEntry(PassRefPtr<InspectorObject> record, PassRefPtr<InspectorObject> data, PassRefPtr<InspectorArray> children, TimelineRecordType type)
......@@ -157,7 +152,7 @@ private:
InspectorFrontend* m_frontend;
Vector<TimelineRecordEntry> m_recordStack;
static int s_instanceCount;
static int s_id;
const int m_id;
struct GCEvent {
......@@ -173,13 +168,6 @@ private:
GCEvents m_gcEvents;
};
inline InspectorTimelineAgent* InspectorTimelineAgent::retrieve(ScriptExecutionContext* context)
{
if (context && context->isDocument())
return static_cast<Document*>(context)->inspectorTimelineAgent();
return 0;
}
} // namespace WebCore
#endif // !ENABLE(INSPECTOR)
......
......@@ -36,8 +36,7 @@
#include "Frame.h"
#include "FrameLoader.h"
#include "FrameLoaderClient.h"
#include "InspectorController.h"
#include "InspectorTimelineAgent.h"
#include "InspectorInstrumentation.h"
#include "Page.h"
#include "ProgressTracker.h"
#include "ResourceHandle.h"
......@@ -401,44 +400,20 @@ void ResourceLoader::didSendData(ResourceHandle*, unsigned long long bytesSent,
void ResourceLoader::didReceiveResponse(ResourceHandle*, const ResourceResponse& response)
{
#if ENABLE(INSPECTOR)
if (InspectorTimelineAgent::instanceCount()) {
InspectorTimelineAgent* timelineAgent = (m_frame && m_frame->page()) ? m_frame->page()->inspectorTimelineAgent() : 0;
if (timelineAgent)
timelineAgent->willReceiveResourceResponse(identifier(), response);
}
#endif
InspectorInstrumentationCookie cookie = InspectorInstrumentation::willReceiveResourceResponse(m_frame.get(), identifier(), response);
#if ENABLE(OFFLINE_WEB_APPLICATIONS)
if (documentLoader()->applicationCacheHost()->maybeLoadFallbackForResponse(this, response))
return;
#endif
didReceiveResponse(response);
#if ENABLE(INSPECTOR)
if (InspectorTimelineAgent::instanceCount()) {
InspectorTimelineAgent* timelineAgent = (m_frame && m_frame->page()) ? m_frame->page()->inspectorTimelineAgent() : 0;
if (timelineAgent)
timelineAgent->didReceiveResourceResponse();
}
#endif
InspectorInstrumentation::didReceiveResourceResponse(m_frame.get(), cookie);
}
void ResourceLoader::didReceiveData(ResourceHandle*, const char* data, int length, int lengthReceived)
{
#if ENABLE(INSPECTOR)
if (InspectorTimelineAgent::instanceCount()) {
InspectorTimelineAgent* timelineAgent = (m_frame && m_frame->page()) ? m_frame->page()->inspectorTimelineAgent() : 0;
if (timelineAgent)
timelineAgent->willReceiveResourceData(identifier());
}
#endif
InspectorInstrumentationCookie cookie = InspectorInstrumentation::willReceiveResourceData(m_frame.get(), identifier());
didReceiveData(data, length, lengthReceived, false);
#if ENABLE(INSPECTOR)
if (InspectorTimelineAgent::instanceCount()) {
InspectorTimelineAgent* timelineAgent = (m_frame && m_frame->page()) ? m_frame->page()->inspectorTimelineAgent() : 0;
if (timelineAgent)
timelineAgent->didReceiveResourceData();
}
#endif
InspectorInstrumentation::didReceiveResourceData(m_frame.get(), cookie);
}
void ResourceLoader::didFinishLoading(ResourceHandle*, double finishTime)
......
......@@ -28,7 +28,7 @@
#include "CachedImage.h"
#include "CachedResource.h"
#include "CachedResourceLoader.h"
#include "InspectorTimelineAgent.h"
#include "InspectorInstrumentation.h"
#include "Frame.h"
#include "FrameLoader.h"
#include "HTMLDocument.h"
......@@ -149,13 +149,7 @@ void Loader::load(CachedResourceLoader* cachedResourceLoader, CachedResource* re
host->servePendingRequests(priority);
} else {
// Handle asynchronously so early low priority requests don't get scheduled before later high priority ones
#if ENABLE(INSPECTOR)
if (InspectorTimelineAgent::instanceCount()) {
InspectorTimelineAgent* agent = cachedResourceLoader->doc()->inspectorTimelineAgent();
if (agent)
agent->didScheduleResourceRequest(resource->url());
}
#endif // ENABLE(INSPECTOR)
InspectorInstrumentation::didScheduleResourceRequest(cachedResourceLoader->doc(), resource->url());
scheduleServePendingRequests();
}
}
......
......@@ -27,7 +27,7 @@
#include "config.h"
#include "DOMTimer.h"
#include "InspectorTimelineAgent.h"
#include "InspectorInstrumentation.h"
#include "ScheduledAction.h"
#include "ScriptExecutionContext.h"
#include <wtf/HashSet.h>
......@@ -81,10 +81,7 @@ int DOMTimer::install(ScriptExecutionContext* context, PassOwnPtr<ScheduledActio
// or if it is a one-time timer and it has fired (DOMTimer::fired).
DOMTimer* timer = new DOMTimer(context, action, timeout, singleShot);
#if ENABLE(INSPECTOR)
if (InspectorTimelineAgent* timelineAgent = InspectorTimelineAgent::retrieve(context))
timelineAgent->didInstallTimer(timer->m_timeoutId, timeout, singleShot);
#endif
InspectorInstrumentation::didInstallTimer(context, timer->m_timeoutId, timeout, singleShot);
return timer->m_timeoutId;
}
......@@ -97,10 +94,7 @@ void DOMTimer::removeById(ScriptExecutionContext* context, int timeoutId)
if (timeoutId <= 0)
return;
#if ENABLE(INSPECTOR)
if (InspectorTimelineAgent* timelineAgent = InspectorTimelineAgent::retrieve(context))
timelineAgent->didRemoveTimer(timeoutId);
#endif
InspectorInstrumentation::didRemoveTimer(context, timeoutId);
delete context->findTimeout(timeoutId);
}
......@@ -110,10 +104,7 @@ void DOMTimer::fired()
ScriptExecutionContext* context = scriptExecutionContext();
timerNestingLevel = m_nestingLevel;
#if ENABLE(INSPECTOR)
if (InspectorTimelineAgent* timelineAgent = InspectorTimelineAgent::retrieve(context))
timelineAgent->willFireTimer(m_timeoutId);
#endif
InspectorInstrumentationCookie cookie = InspectorInstrumentation::willFireTimer(context, m_timeoutId);
// Simple case for non-one-shot timers.
if (isActive()) {
......@@ -125,10 +116,9 @@ void DOMTimer::fired()
// No access to member variables after this point, it can delete the timer.
m_action->execute(context);
#if ENABLE(INSPECTOR)
if (InspectorTimelineAgent* timelineAgent = InspectorTimelineAgent::retrieve(context))
timelineAgent->didFireTimer();
#endif
InspectorInstrumentation::didFireTimer(context, cookie);
return;
}
......@@ -140,10 +130,7 @@ void DOMTimer::fired()
action->execute(context);
#if ENABLE(INSPECTOR)
if (InspectorTimelineAgent* timelineAgent = InspectorTimelineAgent::retrieve(context))
timelineAgent->didFireTimer();
#endif
InspectorInstrumentation::didFireTimer(context, cookie);
timerNestingLevel = 0;
}
......
......@@ -34,8 +34,6 @@
namespace WebCore {
class InspectorTimelineAgent;
class DOMTimer : public SuspendableTimer {
public:
virtual ~DOMTimer();
......
......@@ -62,7 +62,7 @@
#include "IDBFactory.h"
#include "IDBFactoryBackendInterface.h"
#include "InspectorController.h"
#include "InspectorTimelineAgent.h"
#include "InspectorInstrumentation.h"
#include "KURL.h"
#include "Location.h"
#include "StyleMedia.h"
......@@ -1522,15 +1522,6 @@ void DOMWindow::dispatchLoadEvent()
#endif
}
#if ENABLE(INSPECTOR)
InspectorTimelineAgent* DOMWindow::inspectorTimelineAgent()
{
if (frame() && frame()->page())
return frame()->page()->inspectorTimelineAgent();
return 0;
}
#endif
bool DOMWindow::dispatchEvent(PassRefPtr<Event> prpEvent, PassRefPtr<EventTarget> prpTarget)
{
RefPtr<EventTarget> protect = this;
......@@ -1540,23 +1531,11 @@ bool DOMWindow::dispatchEvent(PassRefPtr<Event> prpEvent, PassRefPtr<EventTarget
event->setCurrentTarget(this);
event->setEventPhase(Event::AT_TARGET);
#if ENABLE(INSPECTOR)
Page* inspectedPage = InspectorTimelineAgent::instanceCount() && frame() ? frame()->page() : 0;
if (inspectedPage) {
if (InspectorTimelineAgent* timelineAgent = hasEventListeners(event->type()) ? inspectedPage->inspectorTimelineAgent() : 0)
timelineAgent->willDispatchEvent(*event);
else
inspectedPage = 0;
}
#endif
InspectorInstrumentationCookie cookie = InspectorInstrumentation::willDispatchEventOnWindow(frame(), *event, this);
bool result = fireEventListeners(event.get());
#if ENABLE(INSPECTOR)
if (inspectedPage)
if (InspectorTimelineAgent* timelineAgent = inspectedPage->inspectorTimelineAgent())
timelineAgent->didDispatchEvent();
#endif
InspectorInstrumentation::didDispatchEventOnWindow(frame(), cookie);
return result;
}
......
......@@ -57,7 +57,6 @@ namespace WebCore {
class Frame;
class History;
class IDBFactory;
class InspectorTimelineAgent;
class Location;
class StyleMedia;
class Navigator;
......@@ -407,7 +406,6 @@ namespace WebCore {
virtual void derefEventTarget() { deref(); }
virtual EventTargetData* eventTargetData();
virtual EventTargetData* ensureEventTargetData();
InspectorTimelineAgent* inspectorTimelineAgent();
RefPtr<SecurityOrigin> m_securityOrigin;
KURL m_url;
......
......@@ -45,7 +45,7 @@
#include "HTMLFrameSetElement.h"
#include "HTMLNames.h"
#include "HTMLPlugInImageElement.h"
#include "InspectorTimelineAgent.h"
#include "InspectorInstrumentation.h"
#include "OverflowEvent.h"
#include "RenderEmbeddedObject.h"
#include "RenderLayer.h"
......@@ -617,10 +617,7 @@ void FrameView::layout(bool allowSubtree)
if (isPainting())
return;
#if ENABLE(INSPECTOR)
if (InspectorTimelineAgent* timelineAgent = inspectorTimelineAgent())
timelineAgent->willLayout();
#endif
InspectorInstrumentationCookie cookie = InspectorInstrumentation::willLayout(m_frame.get());
if (!allowSubtree && m_layoutRoot) {
m_layoutRoot->markContainingBlocksForLayout(false);
......@@ -840,10 +837,7 @@ void FrameView::layout(bool allowSubtree)