1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CONTENT_SHELL_RENDERER_LEAK_DETECTOR_H_
6 #define CONTENT_SHELL_RENDERER_LEAK_DETECTOR_H_
8 #include "base/basictypes.h"
9 #include "content/shell/common/leak_detection_result.h"
10 #include "third_party/WebKit/public/web/WebLeakDetector.h"
18 class WebKitTestRunner
;
20 // LeakDetector counts DOM objects and compare them between two pages.
21 class LeakDetector
: public blink::WebLeakDetectorClient
{
23 explicit LeakDetector(WebKitTestRunner
* test_runner
);
24 virtual ~LeakDetector();
26 // Counts DOM objects, compare the previous status and returns the result of
27 // leak detection. It is assumed that this method is always called when a
28 // specific page, like about:blank is loaded to compare the previous
29 // circumstance of DOM objects. If the number of objects increses, there
31 void TryLeakDetection(blink::WebLocalFrame
* frame
);
33 // WebLeakDetectorClient:
34 virtual void onLeakDetectionComplete(const Result
& result
) OVERRIDE
;
37 WebKitTestRunner
* test_runner_
;
38 scoped_ptr
<blink::WebLeakDetector
> web_leak_detector_
;
39 blink::WebLeakDetectorClient::Result previous_result_
;
41 DISALLOW_COPY_AND_ASSIGN(LeakDetector
);
44 } // namespace content
46 #endif // CONTENT_SHELL_RENDERER_LEAK_DETECTOR_H_