2009-11-26 Yury Semikhatsky <yurys@chromium.org>
authoryurys@chromium.org <yurys@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 26 Nov 2009 20:59:33 +0000 (20:59 +0000)
committeryurys@chromium.org <yurys@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 26 Nov 2009 20:59:33 +0000 (20:59 +0000)
        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: Remove unused DocumentLoader parameters from inspector methods.
        * inspector/InspectorResource.cpp:
        (WebCore::InspectorResource::addLength): Update loading end time when new data are received.
        * loader/ResourceLoadNotifier.cpp:
        (WebCore::ResourceLoadNotifier::didFailToLoad): Notify InspectorController about the failure.
        (WebCore::ResourceLoadNotifier::dispatchWillSendRequest):
        (WebCore::ResourceLoadNotifier::dispatchDidReceiveResponse):
        (WebCore::ResourceLoadNotifier::dispatchDidReceiveContentLength):
        (WebCore::ResourceLoadNotifier::dispatchDidFinishLoading):

2009-11-26  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:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@51421 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebCore/ChangeLog
WebCore/inspector/InspectorController.cpp
WebCore/inspector/InspectorController.h
WebCore/inspector/InspectorResource.cpp
WebCore/loader/ResourceLoadNotifier.cpp
WebKit/chromium/ChangeLog
WebKit/chromium/public/WebDevToolsAgent.h
WebKit/chromium/public/WebView.h
WebKit/chromium/src/WebViewImpl.cpp
WebKit/chromium/src/WebViewImpl.h

index 713b1fcdd01c604f67a5044ae26e54c88985bee0..727085c57d0e87f61e248786a9933f32e1b9046c 100644 (file)
@@ -1,3 +1,28 @@
+2009-11-26  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: Remove unused DocumentLoader parameters from inspector methods.
+        * inspector/InspectorResource.cpp:
+        (WebCore::InspectorResource::addLength): Update loading end time when new data are received.
+        * loader/ResourceLoadNotifier.cpp:
+        (WebCore::ResourceLoadNotifier::didFailToLoad): Notify InspectorController about the failure.
+        (WebCore::ResourceLoadNotifier::dispatchWillSendRequest):
+        (WebCore::ResourceLoadNotifier::dispatchDidReceiveResponse):
+        (WebCore::ResourceLoadNotifier::dispatchDidReceiveContentLength):
+        (WebCore::ResourceLoadNotifier::dispatchDidFinishLoading):
+
 2009-11-26  Daniel Bates  <dbates@webkit.org>
 
         Reviewed by Pavel Feldman.
index ddb13d2f8654f908b58cf88214ac0bc84e4f83f3..1c1653c947d7ec020593ce66e4d89f9b23f35ebc 100644 (file)
@@ -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)
@@ -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);
@@ -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)
@@ -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);
@@ -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);
index 22bd0765bd4de5d42d273b47aa6e0e6ed37332f2..c44ec2230d082cef2f8c3fbd5b33ce257730c231 100644 (file)
@@ -216,11 +216,11 @@ public:
     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);
 
index 381dfd56d509f52e3b09ca6de63216517eb3ddf2..5818627d37b38a9734023ed0e1f6b9a565386fc7 100644 (file)
@@ -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
index 4cddd01c39abe21890211f33b80e2bfef1e4acac..92804345b3dbdce65e2692b52cfc8aa36c8d754a 100644 (file)
@@ -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)
@@ -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
 }
 
@@ -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
 }
 
@@ -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
 }
 
@@ -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
 }
 
index bbe0137c84cc480a6c28b9182889a9296714bd34..87a2f05ac7ad9dd52cedb5386e1550b88fc8b0b2 100644 (file)
@@ -1,3 +1,22 @@
+2009-11-26  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-25  Dimitri Glazkov  <dglazkov@chromium.org>
 
         Reviewed by David Levin.
index cf4d7eafeddbedab68f235bc531f3def653ed747..4a44cb0de8ae09a699ccff50bdef4d515f93fe3e 100644 (file)
 
 namespace WebKit {
 class WebDevToolsAgentClient;
+class WebFrame;
 class WebString;
+class WebURLRequest;
+class WebURLResponse;
 class WebView;
 struct WebPoint;
+struct WebURLError;
 
 class WebDevToolsAgent {
 public:
@@ -70,6 +74,13 @@ public:
     // 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
index 8261afc5a95ac7f488bd6fe38aeeff55088b6e2b..29a3f9e209dde32505ff514d75ce93e95878d1a9 100644 (file)
@@ -191,6 +191,13 @@ public:
     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
index aaf717472c4d6317094183fe068686c610e6c187..7914a9ee8f1069ebdce64298a2c6d504f250ca94 100644 (file)
@@ -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"
@@ -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())
index 2b83a8e84bfd9b2db039414942d2f69cbf6d90f8..96227e3cf9f0b40e781e6c4843a2fe93675212e6 100644 (file)
@@ -143,6 +143,7 @@ public:
         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);