Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / public / web / WebLeakDetector.h
index 35990af..187b86c 100644 (file)
 
 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