OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CONTENT_SHELL_RENDERER_LAYOUT_TEST_LEAK_DETECTOR_H_ | 5 #ifndef CONTENT_SHELL_RENDERER_LAYOUT_TEST_LEAK_DETECTOR_H_ |
6 #define CONTENT_SHELL_RENDERER_LAYOUT_TEST_LEAK_DETECTOR_H_ | 6 #define CONTENT_SHELL_RENDERER_LAYOUT_TEST_LEAK_DETECTOR_H_ |
7 | 7 |
| 8 #include <memory> |
| 9 |
8 #include "base/macros.h" | 10 #include "base/macros.h" |
9 #include "base/memory/scoped_ptr.h" | |
10 #include "content/shell/common/leak_detection_result.h" | 11 #include "content/shell/common/leak_detection_result.h" |
11 #include "third_party/WebKit/public/web/WebLeakDetector.h" | 12 #include "third_party/WebKit/public/web/WebLeakDetector.h" |
12 | 13 |
13 namespace blink { | 14 namespace blink { |
14 class WebFrame; | 15 class WebFrame; |
15 } // namespace blink | 16 } // namespace blink |
16 | 17 |
17 namespace content { | 18 namespace content { |
18 | 19 |
19 class BlinkTestRunner; | 20 class BlinkTestRunner; |
20 | 21 |
21 // LeakDetector counts DOM objects and compare them between two pages. | 22 // LeakDetector counts DOM objects and compare them between two pages. |
22 class LeakDetector : public blink::WebLeakDetectorClient { | 23 class LeakDetector : public blink::WebLeakDetectorClient { |
23 public: | 24 public: |
24 explicit LeakDetector(BlinkTestRunner* test_runner); | 25 explicit LeakDetector(BlinkTestRunner* test_runner); |
25 virtual ~LeakDetector(); | 26 virtual ~LeakDetector(); |
26 | 27 |
27 // Counts DOM objects, compare the previous status and returns the result of | 28 // Counts DOM objects, compare the previous status and returns the result of |
28 // leak detection. It is assumed that this method is always called when a | 29 // leak detection. It is assumed that this method is always called when a |
29 // specific page, like about:blank is loaded to compare the previous | 30 // specific page, like about:blank is loaded to compare the previous |
30 // circumstance of DOM objects. If the number of objects increses, there | 31 // circumstance of DOM objects. If the number of objects increses, there |
31 // should be a leak. | 32 // should be a leak. |
32 void TryLeakDetection(blink::WebFrame* frame); | 33 void TryLeakDetection(blink::WebFrame* frame); |
33 | 34 |
34 // WebLeakDetectorClient: | 35 // WebLeakDetectorClient: |
35 void onLeakDetectionComplete(const Result& result) override; | 36 void onLeakDetectionComplete(const Result& result) override; |
36 | 37 |
37 private: | 38 private: |
38 BlinkTestRunner* test_runner_; | 39 BlinkTestRunner* test_runner_; |
39 scoped_ptr<blink::WebLeakDetector> web_leak_detector_; | 40 std::unique_ptr<blink::WebLeakDetector> web_leak_detector_; |
40 blink::WebLeakDetectorClient::Result previous_result_; | 41 blink::WebLeakDetectorClient::Result previous_result_; |
41 | 42 |
42 DISALLOW_COPY_AND_ASSIGN(LeakDetector); | 43 DISALLOW_COPY_AND_ASSIGN(LeakDetector); |
43 }; | 44 }; |
44 | 45 |
45 } // namespace content | 46 } // namespace content |
46 | 47 |
47 #endif // CONTENT_SHELL_RENDERER_LAYOUT_TEST_LEAK_DETECTOR_H_ | 48 #endif // CONTENT_SHELL_RENDERER_LAYOUT_TEST_LEAK_DETECTOR_H_ |
OLD | NEW |