Commit 08cddc42 authored by loislo@chromium.org's avatar loislo@chromium.org

Web Inspector: NMI add instrumentation to widely used ActiveDOMObjects....

Web Inspector: NMI add instrumentation to widely used ActiveDOMObjects. XMLHttpRequest, Prerenderer, HTMLMediaElement and DOMTimer.
https://bugs.webkit.org/show_bug.cgi?id=102818

Reviewed by Vsevolod Vlasov.

Our test bot counts pointers which don't match with objects allocated by tcmalloc.
This counter becomes nonzero after instrumenting ActiveDOMObject class.
It happens because it is the base class for many other classes (~30).
And almost all these classes use multiple inheritance.

* dom/Document.cpp:
(WebCore::Document::reportMemoryUsage):
* dom/DocumentEventQueue.cpp:
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::reportMemoryUsage):
(WebCore):
* html/HTMLMediaElement.h:
* loader/Prerenderer.cpp:
(WebCore::Prerenderer::reportMemoryUsage):
(WebCore):
* loader/Prerenderer.h:
(Prerenderer):
* page/DOMTimer.cpp:
(WebCore::DOMTimer::reportMemoryUsage):
(WebCore):
* page/DOMTimer.h:
(DOMTimer):
* xml/XMLHttpRequest.cpp:
(WebCore::XMLHttpRequest::reportMemoryUsage):
(WebCore):
* xml/XMLHttpRequest.h:
(XMLHttpRequest):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@135384 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 2f4c4b10
2012-11-21 Ilya Tikhonovsky <loislo@chromium.org>
Web Inspector: NMI add instrumentation to widely used ActiveDOMObjects. XMLHttpRequest, Prerenderer, HTMLMediaElement and DOMTimer.
https://bugs.webkit.org/show_bug.cgi?id=102818
Reviewed by Vsevolod Vlasov.
Our test bot counts pointers which don't match with objects allocated by tcmalloc.
This counter becomes nonzero after instrumenting ActiveDOMObject class.
It happens because it is the base class for many other classes (~30).
And almost all these classes use multiple inheritance.
* dom/Document.cpp:
(WebCore::Document::reportMemoryUsage):
* dom/DocumentEventQueue.cpp:
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::reportMemoryUsage):
(WebCore):
* html/HTMLMediaElement.h:
* loader/Prerenderer.cpp:
(WebCore::Prerenderer::reportMemoryUsage):
(WebCore):
* loader/Prerenderer.h:
(Prerenderer):
* page/DOMTimer.cpp:
(WebCore::DOMTimer::reportMemoryUsage):
(WebCore):
* page/DOMTimer.h:
(DOMTimer):
* xml/XMLHttpRequest.cpp:
(WebCore::XMLHttpRequest::reportMemoryUsage):
(WebCore):
* xml/XMLHttpRequest.h:
(XMLHttpRequest):
2012-11-21 Dan Carney <dcarney@google.com>
[V8] Add context checks to WorldContextHandle and V8DOMWindowShell
......@@ -5906,6 +5906,9 @@ void Document::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
info.addMember(m_eventQueue);
info.addMember(m_mediaCanStartListeners);
info.addMember(m_pendingTasks);
#if ENABLE(LINK_PRERENDER)
info.addMember(m_prerenderer);
#endif
}
class ImmutableAttributeDataCacheKey {
......
......@@ -47,6 +47,13 @@ public:
: SuspendableTimer(context)
, m_eventQueue(eventQueue) { }
virtual void reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const OVERRIDE
{
MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::DOM);
SuspendableTimer::reportMemoryUsage(memoryObjectInfo);
info.addWeakPointer(m_eventQueue);
}
private:
virtual void fired() { m_eventQueue->pendingEventTimerFired(); }
DocumentEventQueue* m_eventQueue;
......
......@@ -80,9 +80,11 @@
#include "ShadowRoot.h"
#include "TimeRanges.h"
#include "UUID.h"
#include "WebCoreMemoryInstrumentation.h"
#include <limits>
#include <wtf/CurrentTime.h>
#include <wtf/MathExtras.h>
#include <wtf/MemoryInstrumentationVector.h>
#include <wtf/NonCopyingSort.h>
#include <wtf/Uint8Array.h>
#include <wtf/text/CString.h>
......@@ -4590,5 +4592,41 @@ void HTMLMediaElement::removeBehaviorsRestrictionsAfterFirstUserGesture()
m_restrictions = NoRestrictions;
}
void HTMLMediaElement::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
{
MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::DOM);
HTMLElement::reportMemoryUsage(memoryObjectInfo);
ActiveDOMObject::reportMemoryUsage(memoryObjectInfo);
info.addMember(m_loadTimer);
info.addMember(m_progressEventTimer);
info.addMember(m_playbackProgressTimer);
info.addMember(m_playedTimeRanges);
info.addMember(m_asyncEventQueue);
info.addMember(m_currentSrc);
info.addMember(m_error);
info.addMember(m_currentSourceNode);
info.addMember(m_nextChildNodeToConsider);
info.addMember(m_player);
#if ENABLE(PLUGIN_PROXY_FOR_VIDEO)
info.addMember(m_proxyWidget);
#endif
#if ENABLE(MEDIA_SOURCE)
info.addMember(m_mediaSourceURL);
info.addMember(m_mediaSource);
#endif
#if ENABLE(VIDEO_TRACK)
info.addMember(m_textTracks);
info.addMember(m_textTracksWhenResourceSelectionBegan);
info.addMember(m_cueTree);
info.addMember(m_currentlyActiveCues);
#endif
info.addMember(m_mediaGroup);
info.addMember(m_mediaController);
#if PLATFORM(MAC)
info.addMember(m_sleepDisabler);
#endif
}
}
#endif
......@@ -320,6 +320,8 @@ public:
virtual bool willRespondToMouseClickEvents() OVERRIDE;
virtual void reportMemoryUsage(MemoryObjectInfo*) const;
protected:
HTMLMediaElement(const QualifiedName&, Document*, bool);
virtual ~HTMLMediaElement();
......
......@@ -41,7 +41,9 @@
#include "PrerendererClient.h"
#include "ReferrerPolicy.h"
#include "SecurityPolicy.h"
#include "WebCoreMemoryInstrumentation.h"
#include <wtf/MemoryInstrumentationVector.h>
#include <wtf/PassOwnPtr.h>
#include <wtf/PassRefPtr.h>
#include <wtf/RefPtr.h>
......@@ -142,6 +144,14 @@ PrerendererClient* Prerenderer::client()
return m_client;
}
void Prerenderer::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
{
MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::DOM);
ActiveDOMObject::reportMemoryUsage(memoryObjectInfo);
info.addMember(m_activeHandles);
info.addMember(m_suspendedHandles);
}
}
#endif // ENABLE(LINK_PRERENDER)
......@@ -59,6 +59,8 @@ public:
static PassOwnPtr<Prerenderer> create(Document*);
virtual void reportMemoryUsage(MemoryObjectInfo*) const;
private:
typedef Vector<RefPtr<PrerenderHandle> > HandleVector;
typedef Vector<KURL> KURLVector;
......
......@@ -30,6 +30,7 @@
#include "InspectorInstrumentation.h"
#include "ScheduledAction.h"
#include "ScriptExecutionContext.h"
#include "WebCoreMemoryInstrumentation.h"
#include <wtf/CurrentTime.h>
#include <wtf/HashSet.h>
#include <wtf/StdLibExtras.h>
......@@ -207,4 +208,12 @@ double DOMTimer::alignedFireTime(double fireTime) const
return fireTime;
}
void DOMTimer::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
{
MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::DOM);
SuspendableTimer::reportMemoryUsage(memoryObjectInfo);
info.addMember(m_action);
info.addMember(m_userGestureToken);
}
} // namespace WebCore
......@@ -53,6 +53,8 @@ namespace WebCore {
// to events like moving a tab to the background.
void adjustMinimumTimerInterval(double oldMinimumTimerInterval);
virtual void reportMemoryUsage(MemoryObjectInfo*) const OVERRIDE;
private:
DOMTimer(ScriptExecutionContext*, PassOwnPtr<ScheduledAction>, int interval, bool singleShot);
virtual void fired();
......
......@@ -51,6 +51,7 @@
#include "SharedBuffer.h"
#include "TextResourceDecoder.h"
#include "ThreadableLoader.h"
#include "WebCoreMemoryInstrumentation.h"
#include "XMLHttpRequestException.h"
#include "XMLHttpRequestProgressEvent.h"
#include "XMLHttpRequestUpload.h"
......@@ -1297,4 +1298,30 @@ EventTargetData* XMLHttpRequest::ensureEventTargetData()
return &m_eventTargetData;
}
void XMLHttpRequest::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
{
MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::DOM);
ScriptWrappable::reportMemoryUsage(memoryObjectInfo);
ActiveDOMObject::reportMemoryUsage(memoryObjectInfo);
info.addMember(m_upload);
info.addMember(m_url);
info.addMember(m_method);
info.addMember(m_requestHeaders);
info.addMember(m_requestEntityBody);
info.addMember(m_mimeTypeOverride);
info.addMember(m_responseBlob);
info.addMember(m_loader);
info.addMember(m_response);
info.addMember(m_responseEncoding);
info.addMember(m_decoder);
info.addMember(m_responseBuilder);
info.addMember(m_responseDocument);
info.addMember(m_binaryResponseBuilder);
info.addMember(m_responseArrayBuffer);
info.addMember(m_lastSendURL);
info.addMember(m_eventTargetData);
info.addMember(m_progressEventThrottle);
info.addMember(m_securityOrigin);
}
} // namespace WebCore
......@@ -135,6 +135,8 @@ public:
XMLHttpRequestUpload* upload();
XMLHttpRequestUpload* optionalUpload() const { return m_upload.get(); }
virtual void reportMemoryUsage(MemoryObjectInfo*) const;
DEFINE_ATTRIBUTE_EVENT_LISTENER(readystatechange);
DEFINE_ATTRIBUTE_EVENT_LISTENER(abort);
DEFINE_ATTRIBUTE_EVENT_LISTENER(error);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment