| 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_LEAK_DETECTOR_H_ | 5 #ifndef CONTENT_SHELL_RENDERER_LEAK_DETECTOR_H_ |
| 6 #define CONTENT_SHELL_RENDERER_LEAK_DETECTOR_H_ | 6 #define CONTENT_SHELL_RENDERER_LEAK_DETECTOR_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "content/shell/common/leak_detection_result.h" | 9 #include "content/shell/common/leak_detection_result.h" |
| 10 | 10 // TODO(dcheng): Temporary. Convert back to a forward declare. |
| 11 namespace blink { | 11 #include "third_party/WebKit/public/web/WebLocalFrame.h" |
| 12 class WebFrame; | |
| 13 } | |
| 14 | 12 |
| 15 namespace content { | 13 namespace content { |
| 16 | 14 |
| 17 // LeakDetector counts DOM objects and compare them between two pages. | 15 // LeakDetector counts DOM objects and compare them between two pages. |
| 18 class LeakDetector { | 16 class LeakDetector { |
| 19 public: | 17 public: |
| 20 LeakDetector(); | 18 LeakDetector(); |
| 21 | 19 |
| 22 // Counts DOM objects, compare the previous status and returns the result of | 20 // Counts DOM objects, compare the previous status and returns the result of |
| 23 // leak detection. It is assumed that this method is always called when a | 21 // leak detection. It is assumed that this method is always called when a |
| 24 // specific page, like about:blank is loaded to compare the previous | 22 // specific page, like about:blank is loaded to compare the previous |
| 25 // circumstance of DOM objects. If the number of objects increses, there | 23 // circumstance of DOM objects. If the number of objects increses, there |
| 26 // should be a leak. | 24 // should be a leak. |
| 27 LeakDetectionResult TryLeakDetection(blink::WebFrame* frame); | 25 LeakDetectionResult TryLeakDetection(blink::WebLocalFrame* frame); |
| 28 | 26 |
| 29 private: | 27 private: |
| 30 // The number of the live documents last time. | 28 // The number of the live documents last time. |
| 31 unsigned previous_number_of_live_documents_; | 29 unsigned previous_number_of_live_documents_; |
| 32 | 30 |
| 33 // The number of the live nodes last time. | 31 // The number of the live nodes last time. |
| 34 unsigned previous_number_of_live_nodes_; | 32 unsigned previous_number_of_live_nodes_; |
| 35 | 33 |
| 36 DISALLOW_COPY_AND_ASSIGN(LeakDetector); | 34 DISALLOW_COPY_AND_ASSIGN(LeakDetector); |
| 37 }; | 35 }; |
| 38 | 36 |
| 39 } // namespace content | 37 } // namespace content |
| 40 | 38 |
| 41 #endif // CONTENT_SHELL_RENDERER_LEAK_DETECTOR_H_ | 39 #endif // CONTENT_SHELL_RENDERER_LEAK_DETECTOR_H_ |
| OLD | NEW |