- Revision
- 138450
- Author
- [email protected]
- Date
- 2012-12-24 21:23:19 -0800 (Mon, 24 Dec 2012)
Log Message
Web Inspector: add async API for passing renderer process memory stats
https://bugs.webkit.org/show_bug.cgi?id=105278
Patch by Alexei Filippov <[email protected]> on 2012-12-24
Reviewed by Yury Semikhatsky.
On some platforms (e.g. Linux) it may take some time to collect
total process memory information as it involves an IPC out of a
sandboxed renderer process. So add an async way to collect the statistics.
Source/Platform:
* chromium/public/Platform.h:
(Platform):
(ProcessMemorySizesCallback):
(WebKit::Platform::ProcessMemorySizesCallback::~ProcessMemorySizesCallback):
(WebKit::Platform::requestProcessMemorySizes):
Source/WebCore:
* platform/MemoryUsageSupport.cpp:
(WebCore::MemoryUsageSupport::requestProcessMemorySizes):
(WebCore):
* platform/MemoryUsageSupport.h:
(MemoryUsageSupport):
(ProcessMemorySizesCallback):
(WebCore::MemoryUsageSupport::ProcessMemorySizesCallback::~ProcessMemorySizesCallback):
* platform/chromium/MemoryUsageSupportChromium.cpp:
(WebCore::MemoryUsageSupport::requestProcessMemorySizes):
(WebCore):
* platform/qt/MemoryUsageSupportQt.cpp:
(WebCore::MemoryUsageSupport::requestProcessMemorySizes):
(WebCore):
Modified Paths
Diff
Modified: trunk/Source/Platform/ChangeLog (138449 => 138450)
--- trunk/Source/Platform/ChangeLog 2012-12-25 02:17:08 UTC (rev 138449)
+++ trunk/Source/Platform/ChangeLog 2012-12-25 05:23:19 UTC (rev 138450)
@@ -1,3 +1,20 @@
+2012-12-24 Alexei Filippov <[email protected]>
+
+ Web Inspector: add async API for passing renderer process memory stats
+ https://bugs.webkit.org/show_bug.cgi?id=105278
+
+ Reviewed by Yury Semikhatsky.
+
+ On some platforms (e.g. Linux) it may take some time to collect
+ total process memory information as it involves an IPC out of a
+ sandboxed renderer process. So add an async way to collect the statistics.
+
+ * chromium/public/Platform.h:
+ (Platform):
+ (ProcessMemorySizesCallback):
+ (WebKit::Platform::ProcessMemorySizesCallback::~ProcessMemorySizesCallback):
+ (WebKit::Platform::requestProcessMemorySizes):
+
2012-12-18 Dana Jansens <[email protected]>
[chromium] Make WebLayerTreeView::loseCompositorContext non-pure virtual
Modified: trunk/Source/Platform/chromium/public/Platform.h (138449 => 138450)
--- trunk/Source/Platform/chromium/public/Platform.h 2012-12-25 02:17:08 UTC (rev 138449)
+++ trunk/Source/Platform/chromium/public/Platform.h 2012-12-25 05:23:19 UTC (rev 138450)
@@ -212,6 +212,18 @@
// false on platform specific error conditions.
virtual bool processMemorySizesInBytes(size_t* privateBytes, size_t* sharedBytes) { return false; }
+ // A callback interface for requestProcessMemorySizes
+ class ProcessMemorySizesCallback {
+ public:
+ virtual ~ProcessMemorySizesCallback() { }
+ virtual void dataReceived(size_t privateBytes, size_t sharedBytes) = 0;
+ };
+
+ // Requests private and shared usage, in bytes. Private bytes is the amount of
+ // memory currently allocated to this process that cannot be shared.
+ // The callback ownership is passed to the callee.
+ virtual void requestProcessMemorySizes(ProcessMemorySizesCallback* requestCallback) { }
+
// Reports number of bytes used by memory allocator for internal needs.
// Returns true if the size has been reported, or false otherwise.
virtual bool memoryAllocatorWasteInBytes(size_t*) { return false; }
Modified: trunk/Source/WebCore/ChangeLog (138449 => 138450)
--- trunk/Source/WebCore/ChangeLog 2012-12-25 02:17:08 UTC (rev 138449)
+++ trunk/Source/WebCore/ChangeLog 2012-12-25 05:23:19 UTC (rev 138450)
@@ -1,3 +1,28 @@
+2012-12-24 Alexei Filippov <[email protected]>
+
+ Web Inspector: add async API for passing renderer process memory stats
+ https://bugs.webkit.org/show_bug.cgi?id=105278
+
+ Reviewed by Yury Semikhatsky.
+
+ On some platforms (e.g. Linux) it may take some time to collect
+ total process memory information as it involves an IPC out of a
+ sandboxed renderer process. So add an async way to collect the statistics.
+
+ * platform/MemoryUsageSupport.cpp:
+ (WebCore::MemoryUsageSupport::requestProcessMemorySizes):
+ (WebCore):
+ * platform/MemoryUsageSupport.h:
+ (MemoryUsageSupport):
+ (ProcessMemorySizesCallback):
+ (WebCore::MemoryUsageSupport::ProcessMemorySizesCallback::~ProcessMemorySizesCallback):
+ * platform/chromium/MemoryUsageSupportChromium.cpp:
+ (WebCore::MemoryUsageSupport::requestProcessMemorySizes):
+ (WebCore):
+ * platform/qt/MemoryUsageSupportQt.cpp:
+ (WebCore::MemoryUsageSupport::requestProcessMemorySizes):
+ (WebCore):
+
2012-12-24 Laszlo Gombos <[email protected]>
Remove wtf/Platform.h includes from {c|cpp} files
Modified: trunk/Source/WebCore/platform/MemoryUsageSupport.cpp (138449 => 138450)
--- trunk/Source/WebCore/platform/MemoryUsageSupport.cpp 2012-12-25 02:17:08 UTC (rev 138449)
+++ trunk/Source/WebCore/platform/MemoryUsageSupport.cpp 2012-12-25 05:23:19 UTC (rev 138450)
@@ -63,6 +63,10 @@
return false;
}
+void MemoryUsageSupport::requestProcessMemorySizes(PassOwnPtr<WebCore::MemoryUsageSupport::ProcessMemorySizesCallback>)
+{
+}
+
void MemoryUsageSupport::memoryUsageByComponents(Vector<ComponentInfo>&)
{
}
Modified: trunk/Source/WebCore/platform/MemoryUsageSupport.h (138449 => 138450)
--- trunk/Source/WebCore/platform/MemoryUsageSupport.h 2012-12-25 02:17:08 UTC (rev 138449)
+++ trunk/Source/WebCore/platform/MemoryUsageSupport.h 2012-12-25 05:23:19 UTC (rev 138450)
@@ -32,6 +32,7 @@
#define MemoryUsageSupport_h
#include <wtf/Forward.h>
+#include <wtf/PassOwnPtr.h>
#include <wtf/text/WTFString.h>
namespace WebCore {
@@ -61,6 +62,17 @@
// false on platform specific error conditions.
static bool processMemorySizesInBytes(size_t* privateBytes, size_t* sharedBytes);
+ // A callback for requestProcessMemorySizes
+ class ProcessMemorySizesCallback {
+ public:
+ virtual ~ProcessMemorySizesCallback() { }
+ virtual void dataReceived(size_t privateBytes, size_t sharedBytes) = 0;
+ };
+
+ // Requests private and shared usage, in bytes. Private bytes is the amount of
+ // memory currently allocated to this process that cannot be shared.
+ static void requestProcessMemorySizes(PassOwnPtr<ProcessMemorySizesCallback> requestCallback);
+
class ComponentInfo {
public:
ComponentInfo(const String& name, size_t size) : m_name(name), m_sizeInBytes(size) { }
Modified: trunk/Source/WebCore/platform/chromium/MemoryUsageSupportChromium.cpp (138449 => 138450)
--- trunk/Source/WebCore/platform/chromium/MemoryUsageSupportChromium.cpp 2012-12-25 02:17:08 UTC (rev 138449)
+++ trunk/Source/WebCore/platform/chromium/MemoryUsageSupportChromium.cpp 2012-12-25 05:23:19 UTC (rev 138450)
@@ -33,6 +33,7 @@
#include <SkGraphics.h>
#include <public/Platform.h>
+#include <wtf/OwnPtr.h>
namespace WebCore {
@@ -66,6 +67,23 @@
return WebKit::Platform::current()->processMemorySizesInBytes(privateBytes, sharedBytes);
}
+void MemoryUsageSupport::requestProcessMemorySizes(PassOwnPtr<WebCore::MemoryUsageSupport::ProcessMemorySizesCallback> requestCallback)
+{
+ class ProcessMemorySizesCallbackImpl : public WebKit::Platform::ProcessMemorySizesCallback {
+ public:
+ ProcessMemorySizesCallbackImpl(PassOwnPtr<WebCore::MemoryUsageSupport::ProcessMemorySizesCallback> callback) :
+ m_callback(callback) { }
+ virtual void dataReceived(size_t privateBytes, size_t sharedBytes)
+ {
+ m_callback->dataReceived(privateBytes, sharedBytes);
+ }
+ private:
+ OwnPtr<WebCore::MemoryUsageSupport::ProcessMemorySizesCallback> m_callback;
+ };
+ WebKit::Platform::ProcessMemorySizesCallback* callback = new ProcessMemorySizesCallbackImpl(requestCallback);
+ WebKit::Platform::current()->requestProcessMemorySizes(callback);
+}
+
void MemoryUsageSupport::memoryUsageByComponents(Vector<ComponentInfo>& components)
{
size_t size = SkGraphics::GetFontCacheUsed();
Modified: trunk/Source/WebCore/platform/qt/MemoryUsageSupportQt.cpp (138449 => 138450)
--- trunk/Source/WebCore/platform/qt/MemoryUsageSupportQt.cpp 2012-12-25 02:17:08 UTC (rev 138449)
+++ trunk/Source/WebCore/platform/qt/MemoryUsageSupportQt.cpp 2012-12-25 05:23:19 UTC (rev 138450)
@@ -111,6 +111,11 @@
return false;
}
+void MemoryUsageSupport::requestProcessMemorySizes(PassOwnPtr<WebCore::MemoryUsageSupport::ProcessMemorySizesCallback> requestCallback)
+{
+ // FIXME: Not implemented.
+}
+
void MemoryUsageSupport::memoryUsageByComponents(Vector<ComponentInfo>&)
{
}