namespace blink {
+class WebLeakDetectorClient {
+public:
+ struct Result {
+ unsigned numberOfLiveNodes;
+ unsigned numberOfLiveDocuments;
+ };
+
+ virtual void onLeakDetectionComplete(const Result&) = 0;
+};
+
class WebLeakDetector {
public:
- // Cleans up the DOM objects and counts them. This is supposed to be used for detecting DOM-object leaks.
- BLINK_EXPORT static void collectGarbargeAndGetDOMCounts(WebLocalFrame*, unsigned* numberOfLiveDocuments, unsigned* numberOfLiveNodes);
+ virtual ~WebLeakDetector() { }
+
+ BLINK_EXPORT static WebLeakDetector* create(WebLeakDetectorClient*);
+
+ // Cleans up the DOM objects and counts them. |WebLeakDetectorClient::onLeakDetectionComplete()| is called when done.
+ // This is supposed to be used for detecting DOM-object leaks.
+ virtual void collectGarbageAndGetDOMCounts(WebLocalFrame*) = 0;
+
+ // FIXME: old API to be removed.
+ static void collectGarbargeAndGetDOMCounts(WebLocalFrame*, unsigned*, unsigned*) { }
};
} // namespace blink