Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Web Inspector: memory instrumentation for Resource{Request/Response}Base

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

Reviewed by Vsevolod Vlasov.

Added reportMemoryUsage methods to ResourceRequestBase, ResourceResponseBase
and several related classes.

* dom/MemoryInstrumentation.cpp:
(WebCore::MemoryInstrumentation::addInstrumentedObjectImpl): added overrides
for String, StringImpl and AtomicString object types so that we can reuse
existing addInstrumentedCollection method instead of adding a counterpart
that would operate on not instrumented content. Next step would be to get
rid od addObject overrides for these types so that all kinds of Strings are
considered as instrumented classes despite they don't have reportMemoryUsage
method.
(WebCore):
* dom/MemoryInstrumentation.h:
(WebCore::MemoryInstrumentation::addInstrumentedObjectImpl):
(MemoryInstrumentation):
* loader/DocumentLoader.cpp:
(WebCore::DocumentLoader::reportMemoryUsage):
* platform/network/FormData.cpp:
(WebCore::FormData::reportMemoryUsage):
(WebCore):
* platform/network/FormData.h:
(WebCore):
(FormData):
* platform/network/ResourceRequestBase.cpp:
(WebCore::ResourceRequestBase::reportMemoryUsage):
(WebCore):
* platform/network/ResourceRequestBase.h:
(ResourceRequestBase):
* platform/network/ResourceResponseBase.cpp:
(WebCore):
(WebCore::ResourceResponseBase::reportMemoryUsage):
* platform/network/ResourceResponseBase.h:
(WebCore):
(ResourceResponseBase):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@125763 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information...
commit 500a05b79d7a9f4af287de1b87406ec582982e3c 1 parent 3013715
@yury-s yury-s authored
View
42 Source/WebCore/ChangeLog
@@ -1,3 +1,45 @@
+2012-08-16 Yury Semikhatsky <yurys@chromium.org>
+
+ Web Inspector: memory instrumentation for Resource{Request/Response}Base
+ https://bugs.webkit.org/show_bug.cgi?id=94109
+
+ Reviewed by Vsevolod Vlasov.
+
+ Added reportMemoryUsage methods to ResourceRequestBase, ResourceResponseBase
+ and several related classes.
+
+ * dom/MemoryInstrumentation.cpp:
+ (WebCore::MemoryInstrumentation::addInstrumentedObjectImpl): added overrides
+ for String, StringImpl and AtomicString object types so that we can reuse
+ existing addInstrumentedCollection method instead of adding a counterpart
+ that would operate on not instrumented content. Next step would be to get
+ rid od addObject overrides for these types so that all kinds of Strings are
+ considered as instrumented classes despite they don't have reportMemoryUsage
+ method.
+ (WebCore):
+ * dom/MemoryInstrumentation.h:
+ (WebCore::MemoryInstrumentation::addInstrumentedObjectImpl):
+ (MemoryInstrumentation):
+ * loader/DocumentLoader.cpp:
+ (WebCore::DocumentLoader::reportMemoryUsage):
+ * platform/network/FormData.cpp:
+ (WebCore::FormData::reportMemoryUsage):
+ (WebCore):
+ * platform/network/FormData.h:
+ (WebCore):
+ (FormData):
+ * platform/network/ResourceRequestBase.cpp:
+ (WebCore::ResourceRequestBase::reportMemoryUsage):
+ (WebCore):
+ * platform/network/ResourceRequestBase.h:
+ (ResourceRequestBase):
+ * platform/network/ResourceResponseBase.cpp:
+ (WebCore):
+ (WebCore::ResourceResponseBase::reportMemoryUsage):
+ * platform/network/ResourceResponseBase.h:
+ (WebCore):
+ (ResourceResponseBase):
+
2012-08-16 Adam Barth <abarth@webkit.org>
Delete DOMWindow::securityOrigin()
View
5 Source/WebCore/dom/MemoryInstrumentation.cpp
@@ -58,4 +58,9 @@ void MemoryInstrumentation::addObject(const KURL& url, ObjectType objectType)
addObject(url.innerURL(), objectType);
}
+void MemoryInstrumentation::addInstrumentedObjectImpl(const AtomicString* const& string, ObjectType objectType, OwningType)
+{
+ addObject(static_cast<const String&>(*string), objectType);
+}
+
} // namespace WebCore
View
4 Source/WebCore/dom/MemoryInstrumentation.h
@@ -137,6 +137,10 @@ class MemoryInstrumentation {
static void addObject(MemoryInstrumentation* instrumentation, const T* const& t, ObjectType ownerObjectType) { instrumentation->addObjectImpl(t, ownerObjectType, byPointer); }
};
+ // FIXME: get rid of addObject(String)
+ void addInstrumentedObjectImpl(const String* const& string, ObjectType objectType, OwningType) { addObject(*string, objectType); }
+ void addInstrumentedObjectImpl(const StringImpl* const& string, ObjectType objectType, OwningType) { addObject(string, objectType); }
+ void addInstrumentedObjectImpl(const AtomicString* const&, ObjectType, OwningType);
template <typename T> void addInstrumentedObjectImpl(const T* const&, ObjectType, OwningType);
template <typename T> void addInstrumentedObjectImpl(const DataRef<T>* const&, ObjectType, OwningType);
template <typename T> void addInstrumentedObjectImpl(const OwnPtr<T>* const&, ObjectType, OwningType);
View
9 Source/WebCore/loader/DocumentLoader.cpp
@@ -363,11 +363,18 @@ void DocumentLoader::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
info.addInstrumentedHashSet(m_subresourceLoaders);
info.addInstrumentedHashSet(m_multipartSubresourceLoaders);
info.addInstrumentedHashSet(m_plugInStreamLoaders);
+ info.addInstrumentedMember(m_substituteData);
info.addMember(m_pageTitle.string());
info.addMember(m_overrideEncoding);
info.addVector(m_responses);
+ info.addInstrumentedMember(m_originalRequest);
+ info.addInstrumentedMember(m_originalRequestCopy);
+ info.addInstrumentedMember(m_request);
+ info.addInstrumentedMember(m_response);
+ info.addInstrumentedMember(m_lastCheckedRequest);
+ info.addInstrumentedVector(m_responses);
info.addHashMap(m_pendingSubstituteResources);
- info.addHashSet(m_resourcesClientKnowsAbout);
+ info.addInstrumentedHashSet(m_resourcesClientKnowsAbout);
info.addVector(m_resourcesLoadedFromMemoryCacheForClientNotification);
info.addMember(m_clientRedirectSourceForHistory);
info.addInstrumentedMember(m_mainResourceData);
View
7 Source/WebCore/platform/network/FormData.cpp
@@ -32,6 +32,7 @@
#include "FormDataBuilder.h"
#include "FormDataList.h"
#include "MIMETypeRegistry.h"
+#include "MemoryInstrumentation.h"
#include "Page.h"
#include "TextEncoding.h"
#include <wtf/Decoder.h>
@@ -356,6 +357,12 @@ void FormData::removeGeneratedFilesIfNeeded()
m_hasGeneratedFiles = false;
}
+void FormData::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
+{
+ MemoryClassInfo info(memoryObjectInfo, this, MemoryInstrumentation::Loader);
+ info.addVector(m_boundary);
+}
+
static void encode(Encoder& encoder, const FormDataElement& element)
{
encoder.encodeUInt32(element.m_type);
View
3  Source/WebCore/platform/network/FormData.h
@@ -30,6 +30,7 @@ namespace WebCore {
class Document;
class FormDataList;
+class MemoryObjectInfo;
class TextEncoding;
class FormDataElement {
@@ -152,6 +153,8 @@ class FormData : public RefCounted<FormData> {
bool containsPasswordData() const { return m_containsPasswordData; }
void setContainsPasswordData(bool containsPasswordData) { m_containsPasswordData = containsPasswordData; }
+ void reportMemoryUsage(MemoryObjectInfo*) const;
+
static EncodingType parseEncodingType(const String& type)
{
if (equalIgnoringCase(type, "text/plain"))
View
15 Source/WebCore/platform/network/ResourceRequestBase.cpp
@@ -24,8 +24,9 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
-
#include "ResourceRequestBase.h"
+
+#include "MemoryInstrumentation.h"
#include "ResourceRequest.h"
using namespace std;
@@ -443,6 +444,18 @@ bool ResourceRequestBase::isConditional() const
m_httpHeaderFields.contains("If-Unmodified-Since"));
}
+void ResourceRequestBase::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
+{
+ MemoryClassInfo info(memoryObjectInfo, this, MemoryInstrumentation::Loader);
+ info.addMember(m_url);
+ info.addMember(m_firstPartyForCookies);
+ info.addInstrumentedMember(m_httpMethod);
+ info.addHashMap(m_httpHeaderFields);
+ info.addInstrumentedMapEntries(m_httpHeaderFields);
+ info.addInstrumentedVector(m_responseContentDispositionEncodingFallbackArray);
+ info.addInstrumentedMember(m_httpBody);
+}
+
double ResourceRequestBase::defaultTimeoutInterval()
{
return s_defaultTimeoutInterval;
View
3  Source/WebCore/platform/network/ResourceRequestBase.h
@@ -44,6 +44,7 @@ namespace WebCore {
ReturnCacheDataDontLoad // results of a post - allow stale data and only use cache
};
+ class MemoryObjectInfo;
class ResourceRequest;
struct CrossThreadResourceRequestData;
@@ -132,6 +133,8 @@ namespace WebCore {
bool reportRawHeaders() const { return m_reportRawHeaders; }
void setReportRawHeaders(bool reportRawHeaders) { m_reportRawHeaders = reportRawHeaders; }
+ void reportMemoryUsage(MemoryObjectInfo*) const;
+
static double defaultTimeoutInterval(); // May return 0 when using platform default.
static void setDefaultTimeoutInterval(double);
View
15 Source/WebCore/platform/network/ResourceResponseBase.cpp
@@ -28,6 +28,7 @@
#include "ResourceResponseBase.h"
#include "HTTPParsers.h"
+#include "MemoryInstrumentation.h"
#include "ResourceResponse.h"
#include <wtf/CurrentTime.h>
#include <wtf/MathExtras.h>
@@ -566,6 +567,20 @@ void ResourceResponseBase::lazyInit(InitLevel initLevel) const
{
const_cast<ResourceResponse*>(static_cast<const ResourceResponse*>(this))->platformLazyInit(initLevel);
}
+
+void ResourceResponseBase::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
+{
+ MemoryClassInfo info(memoryObjectInfo, this, MemoryInstrumentation::Loader);
+ info.addMember(m_url);
+ info.addInstrumentedMember(m_mimeType);
+ info.addInstrumentedMember(m_textEncodingName);
+ info.addInstrumentedMember(m_suggestedFilename);
+ info.addInstrumentedMember(m_httpStatusText);
+ info.addHashMap(m_httpHeaderFields);
+ info.addInstrumentedMapEntries(m_httpHeaderFields);
+ info.addMember(m_resourceLoadTiming);
+ info.addMember(m_resourceLoadInfo);
+}
bool ResourceResponseBase::compare(const ResourceResponse& a, const ResourceResponse& b)
{
View
3  Source/WebCore/platform/network/ResourceResponseBase.h
@@ -41,6 +41,7 @@
namespace WebCore {
+class MemoryObjectInfo;
class ResourceResponse;
struct CrossThreadResourceResponseData;
@@ -126,6 +127,8 @@ class ResourceResponseBase {
return 1280;
}
+ void reportMemoryUsage(MemoryObjectInfo*) const;
+
static bool compare(const ResourceResponse&, const ResourceResponse&);
protected:
Please sign in to comment.
Something went wrong with that request. Please try again.