Skip to content

Commit

Permalink
2009-11-27 Yury Semikhatsky <yurys@chromium.org>
Browse files Browse the repository at this point in the history
        Reviewed by Pavel Feldman.

        This is a WebCore part of the fix that allows to view plugin
        resources loaded by plugins.

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

        * inspector/InspectorController.cpp:
        (WebCore::InspectorController::willSendRequest):
        (WebCore::InspectorController::didReceiveResponse):
        (WebCore::InspectorController::didReceiveContentLength):
        (WebCore::InspectorController::didFinishLoading):
        (WebCore::InspectorController::didFailLoading):
        * inspector/InspectorController.h:
        * inspector/InspectorResource.cpp:
        (WebCore::InspectorResource::addLength):
        * loader/ResourceLoadNotifier.cpp:
        (WebCore::ResourceLoadNotifier::didFailToLoad):
        (WebCore::ResourceLoadNotifier::dispatchWillSendRequest):
        (WebCore::ResourceLoadNotifier::dispatchDidReceiveResponse):
        (WebCore::ResourceLoadNotifier::dispatchDidReceiveContentLength):
        (WebCore::ResourceLoadNotifier::dispatchDidFinishLoading):
2009-11-27  Yury Semikhatsky  <yurys@chromium.org>

        Reviewed by Pavel Feldman.

        WebCore part of the fix that allows to view plugin
        resources loaded by plugins. Methods that for resource
        loading notifications are exposed through WebDevToolsAgent
        interface to the glue code to allow Chromium's plugin
        implementation to notify InspectorController about resource
        loading in plugins.

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

        * public/WebDevToolsAgent.h:
        * public/WebView.h:
        * src/WebViewImpl.cpp:
        (WebKit::WebViewImpl::createUniqueIdentifierForRequest):
        * src/WebViewImpl.h:


Canonical link: https://commits.webkit.org/42869@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@51440 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
yury-s committed Nov 27, 2009
1 parent 6a86ec2 commit e69b937
Show file tree
Hide file tree
Showing 10 changed files with 97 additions and 15 deletions.
25 changes: 25 additions & 0 deletions WebCore/ChangeLog
@@ -1,3 +1,28 @@
2009-11-27 Yury Semikhatsky <yurys@chromium.org>

Reviewed by Pavel Feldman.

This is a WebCore part of the fix that allows to view plugin
resources loaded by plugins.

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

* inspector/InspectorController.cpp:
(WebCore::InspectorController::willSendRequest):
(WebCore::InspectorController::didReceiveResponse):
(WebCore::InspectorController::didReceiveContentLength):
(WebCore::InspectorController::didFinishLoading):
(WebCore::InspectorController::didFailLoading):
* inspector/InspectorController.h:
* inspector/InspectorResource.cpp:
(WebCore::InspectorResource::addLength):
* loader/ResourceLoadNotifier.cpp:
(WebCore::ResourceLoadNotifier::didFailToLoad):
(WebCore::ResourceLoadNotifier::dispatchWillSendRequest):
(WebCore::ResourceLoadNotifier::dispatchDidReceiveResponse):
(WebCore::ResourceLoadNotifier::dispatchDidReceiveContentLength):
(WebCore::ResourceLoadNotifier::dispatchDidFinishLoading):

2009-11-27 Yury Semikhatsky <yurys@chromium.org>

Reviewed by Pavel Feldman.
Expand Down
13 changes: 7 additions & 6 deletions WebCore/inspector/InspectorController.cpp
Expand Up @@ -939,10 +939,11 @@ bool InspectorController::isMainResourceLoader(DocumentLoader* loader, const KUR
return loader->frame() == m_inspectedPage->mainFrame() && requestUrl == loader->requestURL();
}

void InspectorController::willSendRequest(DocumentLoader* loader, unsigned long identifier, ResourceRequest& request, const ResourceResponse& redirectResponse)
void InspectorController::willSendRequest(unsigned long identifier, const ResourceRequest& request, const ResourceResponse& redirectResponse)
{
bool isMainResource = (m_mainResource && m_mainResource->identifier() == identifier);
if (m_timelineAgent)
m_timelineAgent->willSendResourceRequest(identifier, isMainResourceLoader(loader, request.url()), request);
m_timelineAgent->willSendResourceRequest(identifier, isMainResource, request);

RefPtr<InspectorResource> resource = getTrackedResource(identifier);
if (!resource)
Expand All @@ -959,7 +960,7 @@ void InspectorController::willSendRequest(DocumentLoader* loader, unsigned long
resource->createScriptObject(m_frontend.get());
}

void InspectorController::didReceiveResponse(DocumentLoader*, unsigned long identifier, const ResourceResponse& response)
void InspectorController::didReceiveResponse(unsigned long identifier, const ResourceResponse& response)
{
if (m_timelineAgent)
m_timelineAgent->didReceiveResourceResponse(identifier, response);
Expand All @@ -975,7 +976,7 @@ void InspectorController::didReceiveResponse(DocumentLoader*, unsigned long iden
resource->updateScriptObject(m_frontend.get());
}

void InspectorController::didReceiveContentLength(DocumentLoader*, unsigned long identifier, int lengthReceived)
void InspectorController::didReceiveContentLength(unsigned long identifier, int lengthReceived)
{
RefPtr<InspectorResource> resource = getTrackedResource(identifier);
if (!resource)
Expand All @@ -987,7 +988,7 @@ void InspectorController::didReceiveContentLength(DocumentLoader*, unsigned long
resource->updateScriptObject(m_frontend.get());
}

void InspectorController::didFinishLoading(DocumentLoader*, unsigned long identifier)
void InspectorController::didFinishLoading(unsigned long identifier)
{
if (m_timelineAgent)
m_timelineAgent->didFinishLoadingResource(identifier, false);
Expand All @@ -1006,7 +1007,7 @@ void InspectorController::didFinishLoading(DocumentLoader*, unsigned long identi
resource->updateScriptObject(m_frontend.get());
}

void InspectorController::didFailLoading(DocumentLoader*, unsigned long identifier, const ResourceError& /*error*/)
void InspectorController::didFailLoading(unsigned long identifier, const ResourceError& /*error*/)
{
if (m_timelineAgent)
m_timelineAgent->didFinishLoadingResource(identifier, true);
Expand Down
10 changes: 5 additions & 5 deletions WebCore/inspector/InspectorController.h
Expand Up @@ -216,11 +216,11 @@ class InspectorController
void didLoadResourceFromMemoryCache(DocumentLoader*, const CachedResource*);

void identifierForInitialRequest(unsigned long identifier, DocumentLoader*, const ResourceRequest&);
void willSendRequest(DocumentLoader*, unsigned long identifier, ResourceRequest&, const ResourceResponse& redirectResponse);
void didReceiveResponse(DocumentLoader*, unsigned long identifier, const ResourceResponse&);
void didReceiveContentLength(DocumentLoader*, unsigned long identifier, int lengthReceived);
void didFinishLoading(DocumentLoader*, unsigned long identifier);
void didFailLoading(DocumentLoader*, unsigned long identifier, const ResourceError&);
void willSendRequest(unsigned long identifier, const ResourceRequest&, const ResourceResponse& redirectResponse);
void didReceiveResponse(unsigned long identifier, const ResourceResponse&);
void didReceiveContentLength(unsigned long identifier, int lengthReceived);
void didFinishLoading(unsigned long identifier);
void didFailLoading(unsigned long identifier, const ResourceError&);
void resourceRetrievedByXMLHttpRequest(unsigned long identifier, const ScriptString& sourceString);
void scriptImported(unsigned long identifier, const String& sourceString);

Expand Down
6 changes: 6 additions & 0 deletions WebCore/inspector/InspectorResource.cpp
Expand Up @@ -381,6 +381,12 @@ void InspectorResource::addLength(int lengthReceived)
{
m_length += lengthReceived;
m_changes.set(LengthChange);

// Update load time, otherwise the resource will
// have start time == end time and 0 load duration
// until its loading is completed.
m_endTime = currentTime();
m_changes.set(TimingChange);
}

} // namespace WebCore
Expand Down
13 changes: 9 additions & 4 deletions WebCore/loader/ResourceLoadNotifier.cpp
Expand Up @@ -96,6 +96,11 @@ void ResourceLoadNotifier::didFailToLoad(ResourceLoader* loader, const ResourceE

if (!error.isNull())
m_frame->loader()->client()->dispatchDidFailLoading(loader->documentLoader(), loader->identifier(), error);

#if ENABLE(INSPECTOR)
if (Page* page = m_frame->page())
page->inspectorController()->didFailLoading(loader->identifier(), error);
#endif
}

void ResourceLoadNotifier::didLoadResourceByXMLHttpRequest(unsigned long identifier, const ScriptString& sourceString)
Expand Down Expand Up @@ -126,7 +131,7 @@ void ResourceLoadNotifier::dispatchWillSendRequest(DocumentLoader* loader, unsig

#if ENABLE(INSPECTOR)
if (Page* page = m_frame->page())
page->inspectorController()->willSendRequest(loader, identifier, request, redirectResponse);
page->inspectorController()->willSendRequest(identifier, request, redirectResponse);
#endif
}

Expand All @@ -136,7 +141,7 @@ void ResourceLoadNotifier::dispatchDidReceiveResponse(DocumentLoader* loader, un

#if ENABLE(INSPECTOR)
if (Page* page = m_frame->page())
page->inspectorController()->didReceiveResponse(loader, identifier, r);
page->inspectorController()->didReceiveResponse(identifier, r);
#endif
}

Expand All @@ -146,7 +151,7 @@ void ResourceLoadNotifier::dispatchDidReceiveContentLength(DocumentLoader* loade

#if ENABLE(INSPECTOR)
if (Page* page = m_frame->page())
page->inspectorController()->didReceiveContentLength(loader, identifier, length);
page->inspectorController()->didReceiveContentLength(identifier, length);
#endif
}

Expand All @@ -156,7 +161,7 @@ void ResourceLoadNotifier::dispatchDidFinishLoading(DocumentLoader* loader, unsi

#if ENABLE(INSPECTOR)
if (Page* page = m_frame->page())
page->inspectorController()->didFinishLoading(loader, identifier);
page->inspectorController()->didFinishLoading(identifier);
#endif
}

Expand Down
19 changes: 19 additions & 0 deletions WebKit/chromium/ChangeLog
@@ -1,3 +1,22 @@
2009-11-27 Yury Semikhatsky <yurys@chromium.org>

Reviewed by Pavel Feldman.

WebCore part of the fix that allows to view plugin
resources loaded by plugins. Methods that for resource
loading notifications are exposed through WebDevToolsAgent
interface to the glue code to allow Chromium's plugin
implementation to notify InspectorController about resource
loading in plugins.

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

* public/WebDevToolsAgent.h:
* public/WebView.h:
* src/WebViewImpl.cpp:
(WebKit::WebViewImpl::createUniqueIdentifierForRequest):
* src/WebViewImpl.h:

2009-11-26 Yury Semikhatsky <yurys@chromium.org>

Not reviewed. Build fix: revert r51421.
Expand Down
11 changes: 11 additions & 0 deletions WebKit/chromium/public/WebDevToolsAgent.h
Expand Up @@ -35,9 +35,13 @@

namespace WebKit {
class WebDevToolsAgentClient;
class WebFrame;
class WebString;
class WebURLRequest;
class WebURLResponse;
class WebView;
struct WebPoint;
struct WebURLError;

class WebDevToolsAgent {
public:
Expand Down Expand Up @@ -70,6 +74,13 @@ class WebDevToolsAgent {
// Installs dispatch handle that is going to be called periodically
// while on a breakpoint.
WEBKIT_API static void setMessageLoopDispatchHandler(MessageLoopDispatchHandler);

virtual void identifierForInitialRequest(unsigned long resourceId, WebFrame*, const WebURLRequest&) = 0;
virtual void willSendRequest(unsigned long resourceId, const WebURLRequest&) = 0;
virtual void didReceiveData(unsigned long resourceId, int length) = 0;
virtual void didReceiveResponse(unsigned long resourceId, const WebURLResponse&) = 0;
virtual void didFinishLoading(unsigned long resourceId) = 0;
virtual void didFailLoading(unsigned long resourceId, const WebURLError&) = 0;
};

} // namespace WebKit
Expand Down
7 changes: 7 additions & 0 deletions WebKit/chromium/public/WebView.h
Expand Up @@ -191,6 +191,13 @@ class WebView : public WebWidget {
virtual bool setDropEffect(bool accept) = 0;


// Support for resource loading initiated by plugins -------------------

// Returns next unused request identifier which is unique within the
// parent Page.
virtual unsigned long createUniqueIdentifierForRequest() = 0;


// Developer tools -----------------------------------------------------

// Inspect a particular point in the WebView. (x = -1 || y = -1) is a
Expand Down
7 changes: 7 additions & 0 deletions WebKit/chromium/src/WebViewImpl.cpp
Expand Up @@ -70,6 +70,7 @@
#include "PluginInfoStore.h"
#include "PopupMenuChromium.h"
#include "PopupMenuClient.h"
#include "ProgressTracker.h"
#include "RenderView.h"
#include "ResourceHandle.h"
#include "SecurityOrigin.h"
Expand Down Expand Up @@ -1475,6 +1476,12 @@ int WebViewImpl::dragIdentity()
return 0;
}

unsigned long WebViewImpl::createUniqueIdentifierForRequest() {
if (m_page)
return m_page->progress()->createUniqueIdentifier();
return 0;
}

void WebViewImpl::inspectElementAt(const WebPoint& point)
{
if (!m_page.get())
Expand Down
1 change: 1 addition & 0 deletions WebKit/chromium/src/WebViewImpl.h
Expand Up @@ -143,6 +143,7 @@ class WebViewImpl : public WebView, public RefCounted<WebViewImpl> {
const WebPoint& screenPoint);
virtual int dragIdentity();
virtual bool setDropEffect(bool accept);
virtual unsigned long createUniqueIdentifierForRequest();
virtual void inspectElementAt(const WebPoint& point);
virtual WebString inspectorSettings() const;
virtual void setInspectorSettings(const WebString& settings);
Expand Down

0 comments on commit e69b937

Please sign in to comment.