Commit 389a6246 authored by yurys@chromium.org's avatar yurys@chromium.org
Browse files

2010-12-29 Yury Semikhatsky <yurys@chromium.org>

        Reviewed by Pavel Feldman.

        inspector/timeline-network-resource.html fails when run twice
        https://bugs.webkit.org/show_bug.cgi?id=37394

        Send didReceiveResponse notification to the timeline agent from ResourceLoadNotifier
        instead of ResourceLoader::didReceiveResponse to cover the cases when resources
        are loaded from memory cache.

        Network notifications are now send to InspectorInstrumentation which dispatches
        them to interested agents and InspectorController.
        fix

        * inspector/timeline-network-resource-expected.txt:
        * inspector/timeline-network-resource.html:
        * inspector/timeline-network-resource.js:
2010-12-29  Yury Semikhatsky  <yurys@chromium.org>

        Reviewed by Pavel Feldman.

        inspector/timeline-network-resource.html fails when run twice
        https://bugs.webkit.org/show_bug.cgi?id=37394

        Send didReceiveResponse notification to the timeline agent from ResourceLoadNotifier
        instead of ResourceLoader::didReceiveResponse to cover the cases when resources
        are loaded from memory cache.

        Network notifications are now sent to InspectorInstrumentation which dispatches
        them to interested agents and InspectorController.

        * inspector/Inspector.idl:
        * inspector/InspectorApplicationCacheAgent.cpp:
        (WebCore::InspectorApplicationCacheAgent::didReceiveManifestResponse):
        * inspector/InspectorController.cpp:
        (WebCore::InspectorController::InspectorController):
        (WebCore::InspectorController::didCommitLoad):
        (WebCore::InspectorController::willSendRequest):
        (WebCore::InspectorController::didReceiveResponse):
        (WebCore::InspectorController::didFailLoading):
        (WebCore::InspectorController::resourceRetrievedByXMLHttpRequest):
        * inspector/InspectorController.h:
        * inspector/InspectorInstrumentation.cpp:
        (WebCore::InspectorInstrumentation::identifierForInitialRequestImpl):
        (WebCore::InspectorInstrumentation::willSendRequestImpl):
        (WebCore::InspectorInstrumentation::markResourceAsCachedImpl):
        (WebCore::InspectorInstrumentation::didLoadResourceFromMemoryCacheImpl):
        (WebCore::InspectorInstrumentation::willReceiveResourceResponseImpl):
        (WebCore::InspectorInstrumentation::didReceiveContentLengthImpl):
        (WebCore::InspectorInstrumentation::didFinishLoadingImpl):
        (WebCore::InspectorInstrumentation::didFailLoadingImpl):
        (WebCore::InspectorInstrumentation::resourceRetrievedByXMLHttpRequestImpl):
        (WebCore::InspectorInstrumentation::scriptImportedImpl):
        (WebCore::InspectorInstrumentation::retrieveResourceAgent):
        * inspector/InspectorInstrumentation.h:
        (WebCore::InspectorInstrumentation::identifierForInitialRequest):
        (WebCore::InspectorInstrumentation::willSendRequest):
        (WebCore::InspectorInstrumentation::markResourceAsCached):
        (WebCore::InspectorInstrumentation::didLoadResourceFromMemoryCache):
        (WebCore::InspectorInstrumentation::willReceiveResourceResponse):
        (WebCore::InspectorInstrumentation::didReceiveContentLength):
        (WebCore::InspectorInstrumentation::didFinishLoading):
        (WebCore::InspectorInstrumentation::didFailLoading):
        (WebCore::InspectorInstrumentation::resourceRetrievedByXMLHttpRequest):
        (WebCore::InspectorInstrumentation::scriptImported):
        * inspector/InspectorResourceAgent.cpp:
        (WebCore::InspectorResourceAgent::identifierForInitialRequest):
        * inspector/InspectorResourceAgent.h:
        * inspector/InspectorTimelineAgent.cpp:
        (WebCore::InspectorTimelineAgent::willSendResourceRequest):
        * inspector/InspectorTimelineAgent.h:
        * inspector/TimelineRecordFactory.cpp:
        (WebCore::TimelineRecordFactory::createResourceSendRequestData):
        * inspector/TimelineRecordFactory.h:
        * inspector/front-end/NetworkManager.js:
        (WebInspector.NetworkManager.prototype.identifierForInitialRequest):
        * inspector/front-end/TimelinePanel.js:
        (WebInspector.TimelinePanel.prototype.addRecordToTimeline):
        * loader/FrameLoader.cpp:
        (WebCore::FrameLoader::loadedResourceFromMemoryCache):
        * loader/ResourceLoadNotifier.cpp:
        (WebCore::ResourceLoadNotifier::didReceiveResponse):
        (WebCore::ResourceLoadNotifier::didFailToLoad):
        (WebCore::ResourceLoadNotifier::assignIdentifierToInitialRequest):
        (WebCore::ResourceLoadNotifier::dispatchWillSendRequest):
        (WebCore::ResourceLoadNotifier::dispatchDidReceiveResponse):
        (WebCore::ResourceLoadNotifier::dispatchDidReceiveContentLength):
        (WebCore::ResourceLoadNotifier::dispatchDidFinishLoading):
        (WebCore::ResourceLoadNotifier::sendRemainingDelegateMessages):
        * loader/ResourceLoader.cpp:
        (WebCore::ResourceLoader::didReceiveResponse):
        * loader/appcache/ApplicationCacheGroup.cpp:
        (WebCore::ApplicationCacheGroup::createResourceHandle):
        (WebCore::ApplicationCacheGroup::didReceiveResponse):
        (WebCore::ApplicationCacheGroup::didReceiveData):
        (WebCore::ApplicationCacheGroup::didFinishLoading):
        (WebCore::ApplicationCacheGroup::didFail):
        * loader/appcache/ApplicationCacheGroup.h:
        * workers/DefaultSharedWorkerRepository.cpp:
        (WebCore::SharedWorkerScriptLoader::notifyFinished):
        * workers/Worker.cpp:
        (WebCore::Worker::notifyFinished):
        * workers/WorkerContext.cpp:
        (WebCore::WorkerContext::importScripts):
        * xml/XMLHttpRequest.cpp:
        (WebCore::XMLHttpRequest::didFinishLoading):
2010-12-29  Yury Semikhatsky  <yurys@chromium.org>

        Reviewed by Pavel Feldman.

        inspector/timeline-network-resource.html fails when run twice
        https://bugs.webkit.org/show_bug.cgi?id=37394

        Send didReceiveResponse notification to the timeline agent from ResourceLoadNotifier
        instead of ResourceLoader::didReceiveResponse to cover the cases when resources
        are loaded from memory cache.

        Network notifications are now sent to InspectorInstrumentation which dispatches
        them to interested agents and InspectorController.

        * src/SharedWorkerRepository.cpp:
        (WebCore::SharedWorkerScriptLoader::notifyFinished):
        * src/WebDevToolsAgentImpl.cpp:
        (WebKit::WebDevToolsAgentImpl::mainFrame):
        (WebKit::WebDevToolsAgentImpl::identifierForInitialRequest):
        (WebKit::WebDevToolsAgentImpl::willSendRequest):
        (WebKit::WebDevToolsAgentImpl::didReceiveData):
        (WebKit::WebDevToolsAgentImpl::didReceiveResponse):
        (WebKit::WebDevToolsAgentImpl::didFinishLoading):
        (WebKit::WebDevToolsAgentImpl::didFailLoading):
        * src/WebDevToolsAgentImpl.h:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@75604 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent b296233e
2010-12-29 Yury Semikhatsky <yurys@chromium.org>
Reviewed by Pavel Feldman.
inspector/timeline-network-resource.html fails when run twice
https://bugs.webkit.org/show_bug.cgi?id=37394
Send didReceiveResponse notification to the timeline agent from ResourceLoadNotifier
instead of ResourceLoader::didReceiveResponse to cover the cases when resources
are loaded from memory cache.
Network notifications are now send to InspectorInstrumentation which dispatches
them to interested agents and InspectorController.
fix
* inspector/timeline-network-resource-expected.txt:
* inspector/timeline-network-resource.html:
* inspector/timeline-network-resource.js:
2011-01-12 Jeremy Orlow <jorlow@chromium.org>
 
Add forgotten file.
......
......@@ -8,7 +8,6 @@ ResourceSendRequest Properties:
identifier : <number>
url : <string>
requestMethod : "GET"
isMainResource : false
}
type : 12
usedHeapSize : <number>
......@@ -22,7 +21,7 @@ ResourceReceiveResponse Properties:
identifier : <number>
statusCode : 0
mimeType : <string>
expectedContentLength : 210
expectedContentLength : 208
url : <string>
}
children : <object>
......
......@@ -6,16 +6,16 @@
var scriptUrl = "timeline-network-resource.js";
function runAfterScriptIsEvaluated(continuation)
function runAfterScriptIsEvaluated()
{
function step()
{
if (!window.scriptEvaluated)
setTimeout(step, 100);
else
continuation();
}
setTimeout(step, 100);
printTimelineRecords(null, null, function(record) {
if (record.type === timelineAgentRecordType["ResourceSendRequest"])
printSend(record);
else if (record.type === timelineAgentRecordType["ResourceReceiveResponse"])
printReceive(record);
else if (record.type === timelineAgentRecordType["ResourceFinish"])
printFinish(record);
});
}
function printRecord(record)
......@@ -60,17 +60,6 @@ function doit()
var script = document.createElement("script");
script.src = scriptUrl;
document.body.appendChild(script);
runAfterScriptIsEvaluated(function() {
printTimelineRecords(null, null, function(record) {
if (record.type === timelineAgentRecordType["ResourceSendRequest"])
printSend(record);
else if (record.type === timelineAgentRecordType["ResourceReceiveResponse"])
printReceive(record);
else if (record.type === timelineAgentRecordType["ResourceFinish"])
printFinish(record);
});
});
}
</script>
......
......@@ -3,4 +3,4 @@
var element = document.createElement("div");
element.innerHTML = "Script resource loaded";
document.body.appendChild(element);
window.scriptEvaluated = true;
runAfterScriptIsEvaluated();
2010-12-29 Yury Semikhatsky <yurys@chromium.org>
Reviewed by Pavel Feldman.
inspector/timeline-network-resource.html fails when run twice
https://bugs.webkit.org/show_bug.cgi?id=37394
Send didReceiveResponse notification to the timeline agent from ResourceLoadNotifier
instead of ResourceLoader::didReceiveResponse to cover the cases when resources
are loaded from memory cache.
Network notifications are now sent to InspectorInstrumentation which dispatches
them to interested agents and InspectorController.
* inspector/Inspector.idl:
* inspector/InspectorApplicationCacheAgent.cpp:
(WebCore::InspectorApplicationCacheAgent::didReceiveManifestResponse):
* inspector/InspectorController.cpp:
(WebCore::InspectorController::InspectorController):
(WebCore::InspectorController::didCommitLoad):
(WebCore::InspectorController::willSendRequest):
(WebCore::InspectorController::didReceiveResponse):
(WebCore::InspectorController::didFailLoading):
(WebCore::InspectorController::resourceRetrievedByXMLHttpRequest):
* inspector/InspectorController.h:
* inspector/InspectorInstrumentation.cpp:
(WebCore::InspectorInstrumentation::identifierForInitialRequestImpl):
(WebCore::InspectorInstrumentation::willSendRequestImpl):
(WebCore::InspectorInstrumentation::markResourceAsCachedImpl):
(WebCore::InspectorInstrumentation::didLoadResourceFromMemoryCacheImpl):
(WebCore::InspectorInstrumentation::willReceiveResourceResponseImpl):
(WebCore::InspectorInstrumentation::didReceiveContentLengthImpl):
(WebCore::InspectorInstrumentation::didFinishLoadingImpl):
(WebCore::InspectorInstrumentation::didFailLoadingImpl):
(WebCore::InspectorInstrumentation::resourceRetrievedByXMLHttpRequestImpl):
(WebCore::InspectorInstrumentation::scriptImportedImpl):
(WebCore::InspectorInstrumentation::retrieveResourceAgent):
* inspector/InspectorInstrumentation.h:
(WebCore::InspectorInstrumentation::identifierForInitialRequest):
(WebCore::InspectorInstrumentation::willSendRequest):
(WebCore::InspectorInstrumentation::markResourceAsCached):
(WebCore::InspectorInstrumentation::didLoadResourceFromMemoryCache):
(WebCore::InspectorInstrumentation::willReceiveResourceResponse):
(WebCore::InspectorInstrumentation::didReceiveContentLength):
(WebCore::InspectorInstrumentation::didFinishLoading):
(WebCore::InspectorInstrumentation::didFailLoading):
(WebCore::InspectorInstrumentation::resourceRetrievedByXMLHttpRequest):
(WebCore::InspectorInstrumentation::scriptImported):
* inspector/InspectorResourceAgent.cpp:
(WebCore::InspectorResourceAgent::identifierForInitialRequest):
* inspector/InspectorResourceAgent.h:
* inspector/InspectorTimelineAgent.cpp:
(WebCore::InspectorTimelineAgent::willSendResourceRequest):
* inspector/InspectorTimelineAgent.h:
* inspector/TimelineRecordFactory.cpp:
(WebCore::TimelineRecordFactory::createResourceSendRequestData):
* inspector/TimelineRecordFactory.h:
* inspector/front-end/NetworkManager.js:
(WebInspector.NetworkManager.prototype.identifierForInitialRequest):
* inspector/front-end/TimelinePanel.js:
(WebInspector.TimelinePanel.prototype.addRecordToTimeline):
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::loadedResourceFromMemoryCache):
* loader/ResourceLoadNotifier.cpp:
(WebCore::ResourceLoadNotifier::didReceiveResponse):
(WebCore::ResourceLoadNotifier::didFailToLoad):
(WebCore::ResourceLoadNotifier::assignIdentifierToInitialRequest):
(WebCore::ResourceLoadNotifier::dispatchWillSendRequest):
(WebCore::ResourceLoadNotifier::dispatchDidReceiveResponse):
(WebCore::ResourceLoadNotifier::dispatchDidReceiveContentLength):
(WebCore::ResourceLoadNotifier::dispatchDidFinishLoading):
(WebCore::ResourceLoadNotifier::sendRemainingDelegateMessages):
* loader/ResourceLoader.cpp:
(WebCore::ResourceLoader::didReceiveResponse):
* loader/appcache/ApplicationCacheGroup.cpp:
(WebCore::ApplicationCacheGroup::createResourceHandle):
(WebCore::ApplicationCacheGroup::didReceiveResponse):
(WebCore::ApplicationCacheGroup::didReceiveData):
(WebCore::ApplicationCacheGroup::didFinishLoading):
(WebCore::ApplicationCacheGroup::didFail):
* loader/appcache/ApplicationCacheGroup.h:
* workers/DefaultSharedWorkerRepository.cpp:
(WebCore::SharedWorkerScriptLoader::notifyFinished):
* workers/Worker.cpp:
(WebCore::Worker::notifyFinished):
* workers/WorkerContext.cpp:
(WebCore::WorkerContext::importScripts):
* xml/XMLHttpRequest.cpp:
(WebCore::XMLHttpRequest::didFinishLoading):
2011-01-12 Pavel Podivilov <podivilov@chromium.org>
 
Reviewed by Pavel Feldman.
......
......@@ -91,7 +91,7 @@ module core {
[domain=Network] void resourceContent(in unsigned long frameId, in String url, in boolean base64Encode, out String content);
[notify, domain=Network] void frameDetachedFromParent(out unsigned long frameId);
[notify, domain=Network] void identifierForInitialRequest(out long identifier, out String url, out Object loader, out Value callStack);
[notify, domain=Network] void identifierForInitialRequest(out long identifier, out String url, out Object loader, out boolean isMainResourceLoader, out Value callStack);
[notify, domain=Network] void willSendRequest(out long identifier, out double time, out Object request, out Object redirectResponse);
[notify, domain=Network] void markResourceAsCached(out long identifier);
[notify, domain=Network] void didReceiveResponse(out long identifier, out double time, out String resourceType, out Object response);
......
......@@ -35,6 +35,7 @@
#include "InspectorController.h"
#include "InspectorFrontend.h"
#include "InspectorValues.h"
#include "NetworkStateNotifier.h"
#include "Page.h"
#include "ResourceResponse.h"
......@@ -46,18 +47,15 @@ InspectorApplicationCacheAgent::InspectorApplicationCacheAgent(InspectorControll
{
}
void InspectorApplicationCacheAgent::didReceiveManifestResponse(unsigned long identifier, const ResourceResponse& response)
{
m_inspectorController->didReceiveResponse(identifier, 0, response);
}
void InspectorApplicationCacheAgent::updateApplicationCacheStatus(ApplicationCacheHost::Status status)
void InspectorApplicationCacheAgent::updateApplicationCacheStatus(Frame* frame)
{
ApplicationCacheHost::Status status = frame->loader()->documentLoader()->applicationCacheHost()->status();
m_frontend->updateApplicationCacheStatus(status);
}
void InspectorApplicationCacheAgent::updateNetworkState(bool isNowOnline)
void InspectorApplicationCacheAgent::networkStateChanged()
{
bool isNowOnline = networkStateNotifier().onLine();
m_frontend->updateNetworkState(isNowOnline);
}
......
......@@ -33,6 +33,7 @@
namespace WebCore {
class Frame;
class InspectorArray;
class InspectorController;
class InspectorFrontend;
......@@ -46,9 +47,8 @@ public:
~InspectorApplicationCacheAgent() { }
// Backend to Frontend
void didReceiveManifestResponse(unsigned long identifier, const ResourceResponse&);
void updateApplicationCacheStatus(ApplicationCacheHost::Status);
void updateNetworkState(bool isNowOnline);
void updateApplicationCacheStatus(Frame*);
void networkStateChanged();
// From Frontend
void getApplicationCaches(RefPtr<InspectorValue>* applicationCaches);
......
......@@ -140,7 +140,6 @@ InspectorController::InspectorController(Page* page, InspectorClient* client)
, m_client(client)
, m_openingFrontend(false)
, m_cssAgent(new InspectorCSSAgent())
, m_mainResourceIdentifier(0)
, m_expiredConsoleMessageCount(0)
, m_previousMessage(0)
, m_settingsLoaded(false)
......@@ -759,7 +758,6 @@ void InspectorController::didCommitLoad(DocumentLoader* loader)
#endif
if (m_frontend) {
m_mainResourceIdentifier = 0;
m_frontend->didCommitLoad();
m_domAgent->setDocument(m_inspectedPage->mainFrame()->document());
}
......@@ -775,33 +773,6 @@ void InspectorController::frameDetachedFromParent(Frame* rootFrame)
m_resourceAgent->frameDetachedFromParent(rootFrame);
}
void InspectorController::didLoadResourceFromMemoryCache(DocumentLoader* loader, const CachedResource* cachedResource)
{
if (!enabled())
return;
ensureSettingsLoaded();
if (m_resourceAgent)
m_resourceAgent->didLoadResourceFromMemoryCache(loader, cachedResource);
}
void InspectorController::identifierForInitialRequest(unsigned long identifier, DocumentLoader* loader, const ResourceRequest& request)
{
if (!enabled())
return;
ASSERT(m_inspectedPage);
bool isMainResource = isMainResourceLoader(loader, request.url());
if (isMainResource)
m_mainResourceIdentifier = identifier;
ensureSettingsLoaded();
if (m_resourceAgent)
m_resourceAgent->identifierForInitialRequest(identifier, request.url(), loader);
}
void InspectorController::mainResourceFiredDOMContentEvent(DocumentLoader* loader, const KURL& url)
{
if (!enabled() || !isMainResourceLoader(loader, url))
......@@ -829,7 +800,7 @@ bool InspectorController::isMainResourceLoader(DocumentLoader* loader, const KUR
return loader->frame() == m_inspectedPage->mainFrame() && requestUrl == loader->requestURL();
}
void InspectorController::willSendRequest(unsigned long identifier, ResourceRequest& request, const ResourceResponse& redirectResponse)
void InspectorController::willSendRequest(ResourceRequest& request)
{
if (!enabled())
return;
......@@ -845,95 +816,37 @@ void InspectorController::willSendRequest(unsigned long identifier, ResourceRequ
request.setHTTPHeaderField(it->first, it->second);
}
}
bool isMainResource = m_mainResourceIdentifier == identifier;
if (m_timelineAgent)
m_timelineAgent->willSendResourceRequest(identifier, isMainResource, request);
if (m_resourceAgent)
m_resourceAgent->willSendRequest(identifier, request, redirectResponse);
}
void InspectorController::markResourceAsCached(unsigned long identifier)
void InspectorController::didReceiveResponse(unsigned long identifier, const ResourceResponse& response)
{
if (!enabled())
return;
if (m_resourceAgent)
m_resourceAgent->markResourceAsCached(identifier);
}
void InspectorController::didReceiveResponse(unsigned long identifier, DocumentLoader* loader, const ResourceResponse& response)
{
if (!enabled())
return;
if (m_resourceAgent)
m_resourceAgent->didReceiveResponse(identifier, loader, response);
if (response.httpStatusCode() >= 400) {
String message = makeString("Failed to load resource: the server responded with a status of ", String::number(response.httpStatusCode()), " (", response.httpStatusText(), ')');
addConsoleMessage(new ConsoleMessage(OtherMessageSource, NetworkErrorMessageType, ErrorMessageLevel, message, response.url().string(), identifier));
}
}
void InspectorController::didReceiveContentLength(unsigned long identifier, int lengthReceived)
{
if (!enabled())
return;
if (m_resourceAgent)
m_resourceAgent->didReceiveContentLength(identifier, lengthReceived);
}
void InspectorController::didFinishLoading(unsigned long identifier, double finishTime)
{
if (!enabled())
return;
if (m_timelineAgent)
m_timelineAgent->didFinishLoadingResource(identifier, false, finishTime);
if (m_resourceAgent)
m_resourceAgent->didFinishLoading(identifier, finishTime);
}
void InspectorController::didFailLoading(unsigned long identifier, const ResourceError& error)
{
if (!enabled())
return;
if (m_timelineAgent)
m_timelineAgent->didFinishLoadingResource(identifier, true, 0);
String message = "Failed to load resource";
if (!error.localizedDescription().isEmpty())
message += ": " + error.localizedDescription();
addConsoleMessage(new ConsoleMessage(OtherMessageSource, NetworkErrorMessageType, ErrorMessageLevel, message, error.failingURL(), identifier));
if (m_resourceAgent)
m_resourceAgent->didFailLoading(identifier, error);
if (!error.localizedDescription().isEmpty())
message += ": " + error.localizedDescription();
addConsoleMessage(new ConsoleMessage(OtherMessageSource, NetworkErrorMessageType, ErrorMessageLevel, message, error.failingURL(), identifier));
}
void InspectorController::resourceRetrievedByXMLHttpRequest(unsigned long identifier, const String& sourceString, const String& url, const String& sendURL, unsigned sendLineNumber)
void InspectorController::resourceRetrievedByXMLHttpRequest(const String& url, const String& sendURL, unsigned sendLineNumber)
{
if (!enabled())
return;
if (m_state->getBoolean(InspectorState::monitoringXHR))
addMessageToConsole(JSMessageSource, LogMessageType, LogMessageLevel, "XHR finished loading: \"" + url + "\".", sendLineNumber, sendURL);
if (m_resourceAgent)
m_resourceAgent->setInitialContent(identifier, sourceString, "XHR");
}
void InspectorController::scriptImported(unsigned long identifier, const String& sourceString)
{
if (!enabled())
return;
if (m_resourceAgent)
m_resourceAgent->setInitialContent(identifier, sourceString, "Script");
}
void InspectorController::ensureSettingsLoaded()
......
......@@ -158,22 +158,9 @@ public:
void didCommitLoad(DocumentLoader*);
void frameDetachedFromParent(Frame*);
void didLoadResourceFromMemoryCache(DocumentLoader*, const CachedResource*);
void identifierForInitialRequest(unsigned long identifier, DocumentLoader*, const ResourceRequest&);
void willSendRequest(unsigned long identifier, ResourceRequest&, const ResourceResponse& redirectResponse);
void markResourceAsCached(unsigned long identifier);
void didReceiveResponse(unsigned long identifier, DocumentLoader*, const ResourceResponse&);
void didReceiveContentLength(unsigned long identifier, int lengthReceived);
void didFinishLoading(unsigned long identifier, double finishTime);
void didFailLoading(unsigned long identifier, const ResourceError&);
void resourceRetrievedByXMLHttpRequest(unsigned long identifier, const String& sourceString, const String& url, const String& sendURL, unsigned sendLineNumber);
void scriptImported(unsigned long identifier, const String& sourceString);
void setExtraHeaders(PassRefPtr<InspectorObject>);
void ensureSettingsLoaded();
void startTimelineProfiler();
void stopTimelineProfiler();
InspectorTimelineAgent* timelineAgent() { return m_timelineAgent.get(); }
......@@ -277,21 +264,27 @@ public:
static const unsigned defaultAttachedHeight;
private:
void getInspectorState(RefPtr<InspectorObject>* state);
void setConsoleMessagesEnabled(bool enabled);
friend class InspectorBackend;
friend class InspectorBackendDispatcher;
friend class InspectorInstrumentation;
friend class InjectedScriptHost;
void willSendRequest(ResourceRequest&);
void didReceiveResponse(unsigned long identifier, const ResourceResponse&);
void didFailLoading(unsigned long identifier, const ResourceError&);
void resourceRetrievedByXMLHttpRequest(const String& url, const String& sendURL, unsigned sendLineNumber);
void ensureSettingsLoaded();
void getInspectorState(RefPtr<InspectorObject>* state);
void setConsoleMessagesEnabled(bool);
void populateScriptObjects();
void restoreDebugger();
enum ProfilerRestoreAction {
ProfilerRestoreNoAction = 0,
ProfilerRestoreResetAgent = 1
};
void populateScriptObjects();
void restoreDebugger();
void restoreProfiler(ProfilerRestoreAction action);
void unbindAllResources();
void setSearchingForNode(bool enabled);
......@@ -349,7 +342,6 @@ private:
RefPtr<Node> m_nodeToFocus;
RefPtr<InspectorResourceAgent> m_resourceAgent;
unsigned long m_mainResourceIdentifier;
Vector<OwnPtr<ConsoleMessage> > m_consoleMessages;
unsigned m_expiredConsoleMessageCount;
HashMap<String, double> m_times;
......
......@@ -34,11 +34,14 @@
#if ENABLE(INSPECTOR)
#include "DOMWindow.h"
#include "DocumentLoader.h"
#include "Event.h"
#include "EventContext.h"
#include "InspectorApplicationCacheAgent.h"
#include "InspectorController.h"
#include "InspectorDOMAgent.h"
#include "InspectorDebuggerAgent.h"
#include "InspectorResourceAgent.h"
#include "InspectorTimelineAgent.h"
#include "XMLHttpRequest.h"
#include <wtf/text/CString.h>
......@@ -372,6 +375,40 @@ void InspectorInstrumentation::didRecalculateStyleImpl(const InspectorInstrument
timelineAgent->didRecalculateStyle();
}
void InspectorInstrumentation::identifierForInitialRequestImpl(InspectorController* ic, unsigned long identifier, DocumentLoader* loader, const ResourceRequest& request)
{
if (!ic->enabled())
return;
ic->ensureSettingsLoaded();
if (InspectorResourceAgent* resourceAgent = retrieveResourceAgent(ic))
resourceAgent->identifierForInitialRequest(identifier, request.url(), loader, ic->isMainResourceLoader(loader, request.url()));
}
void InspectorInstrumentation::willSendRequestImpl(InspectorController* ic, unsigned long identifier, ResourceRequest& request, const ResourceResponse& redirectResponse)
{
ic->willSendRequest(request);
if (InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(ic))
timelineAgent->willSendResourceRequest(identifier, request);
if (InspectorResourceAgent* resourceAgent = retrieveResourceAgent(ic))
resourceAgent->willSendRequest(identifier, request, redirectResponse);
}
void InspectorInstrumentation::markResourceAsCachedImpl(InspectorController* ic, unsigned long identifier)
{
if (InspectorResourceAgent* resourceAgent = retrieveResourceAgent(ic))
resourceAgent->markResourceAsCached(identifier);
}
void InspectorInstrumentation::didLoadResourceFromMemoryCacheImpl(InspectorController* ic, DocumentLoader* loader, const CachedResource* cachedResource)
{
if (!ic->enabled())
return;
ic->ensureSettingsLoaded();
if (InspectorResourceAgent* resourceAgent = retrieveResourceAgent(ic))
resourceAgent->didLoadResourceFromMemoryCache(loader, cachedResource);
}
InspectorInstrumentationCookie InspectorInstrumentation::willReceiveResourceDataImpl(InspectorController* inspectorController, unsigned long identifier)
{
int timelineAgentId = 0;
......@@ -400,12 +437,54 @@ InspectorInstrumentationCookie InspectorInstrumentation::willReceiveResourceResp
return InspectorInstrumentationCookie(inspectorController, timelineAgentId);
}
void InspectorInstrumentation::didReceiveResourceResponseImpl(const InspectorInstrumentationCookie& cookie)
void InspectorInstrumentation::didReceiveResourceResponseImpl(const InspectorInstrumentationCookie& cookie, unsigned long identifier, DocumentLoader* loader, const ResourceResponse& response)
{
InspectorController* ic = cookie.first;
if (InspectorResourceAgent* resourceAgent = retrieveResourceAgent(ic))
resourceAgent->didReceiveResponse(identifier, loader, response);
// FIXME(52282): move this to console agent.
ic->didReceiveResponse(identifier, response);
if (InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(cookie))
timelineAgent->didReceiveResourceResponse();
}
void InspectorInstrumentation::didReceiveContentLengthImpl(InspectorController* ic, unsigned long identifier, int lengthReceived)
{
if (InspectorResourceAgent* resourceAgent = retrieveResourceAgent(ic))
resourceAgent->didReceiveContentLength(identifier, lengthReceived);
}
void InspectorInstrumentation::didFinishLoadingImpl(InspectorController* ic, unsigned long identifier, double finishTime)
{
if (InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(ic))
timelineAgent->didFinishLoadingResource(identifier, false, finishTime);
if (InspectorResourceAgent* resourceAgent = retrieveResourceAgent(ic))
resourceAgent->didFinishLoading(identifier, finishTime);
}
void InspectorInstrumentation::didFailLoadingImpl(InspectorController* ic, unsigned long identifier, const ResourceError& error)
{
// FIXME(52282): move this to console agent.
ic->didFailLoading(identifier, error);
if (InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(ic))
timelineAgent->didFinishLoadingResource(identifier, true, 0);
if (InspectorResourceAgent* resourceAgent = retrieveResourceAgent(ic))
resourceAgent->didFailLoading(identifier, error);
}
void InspectorInstrumentation::resourceRetrievedByXMLHttpRequestImpl(InspectorController* ic, unsigned long identifier, const String& sourceString, const String& url, const String& sendURL, unsigned sendLineNumber)
{
ic->resourceRetrievedByXMLHttpRequest(url, sendURL, sendLineNumber);
if (InspectorResourceAgent* resourceAgent = retrieveResourceAgent(ic))
resourceAgent->setInitialContent(identifier, sourceString, "XHR");
}
void InspectorInstrumentation::scriptImportedImpl(InspectorController* ic, unsigned long identifier, const String& sourceString)
{
if (InspectorResourceAgent* resourceAgent = retrieveResourceAgent(ic))
resourceAgent->setInitialContent(identifier, sourceString, "Script");
}
InspectorInstrumentationCookie InspectorInstrumentation::willWriteHTMLImpl(InspectorController* inspectorController, unsigned int length, unsigned int startLine)
{
int timelineAgentId = 0;
......@@ -445,6 +524,20 @@ void InspectorInstrumentation::didCloseWebSocketImpl(InspectorController* inspec
}
#endif
#if ENABLE(OFFLINE_WEB_APPLICATIONS)
void InspectorInstrumentation::networkStateChangedImpl(InspectorController* ic)
{