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 #include "content/shell/renderer/leak_detector.h" | 5 #include "content/shell/renderer/leak_detector.h" |
6 | 6 |
7 #include "base/json/json_writer.h" | 7 #include "base/json/json_writer.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/values.h" | 9 #include "base/values.h" |
10 #include "third_party/WebKit/public/web/WebLeakDetector.h" | 10 #include "third_party/WebKit/public/web/WebLeakDetector.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 // hard-coded values. Instead, we need to load about:blank ahead of the layout | 21 // hard-coded values. Instead, we need to load about:blank ahead of the layout |
22 // tests actually and initialize LeakDetector by the got values. | 22 // tests actually and initialize LeakDetector by the got values. |
23 const int kInitialNumberOfLiveDocuments = 1; | 23 const int kInitialNumberOfLiveDocuments = 1; |
24 const int kInitialNumberOfLiveNodes = 4; | 24 const int kInitialNumberOfLiveNodes = 4; |
25 | 25 |
26 LeakDetector::LeakDetector() | 26 LeakDetector::LeakDetector() |
27 : previous_number_of_live_documents_(kInitialNumberOfLiveDocuments), | 27 : previous_number_of_live_documents_(kInitialNumberOfLiveDocuments), |
28 previous_number_of_live_nodes_(kInitialNumberOfLiveNodes) { | 28 previous_number_of_live_nodes_(kInitialNumberOfLiveNodes) { |
29 } | 29 } |
30 | 30 |
31 LeakDetectionResult LeakDetector::TryLeakDetection(blink::WebFrame* frame) { | 31 LeakDetectionResult LeakDetector::TryLeakDetection( |
| 32 blink::WebLocalFrame* frame) { |
32 LeakDetectionResult result; | 33 LeakDetectionResult result; |
33 unsigned number_of_live_documents = 0; | 34 unsigned number_of_live_documents = 0; |
34 unsigned number_of_live_nodes = 0; | 35 unsigned number_of_live_nodes = 0; |
35 | 36 |
36 WebLeakDetector::collectGarbargeAndGetDOMCounts( | 37 WebLeakDetector::collectGarbargeAndGetDOMCounts( |
37 frame, &number_of_live_documents, &number_of_live_nodes); | 38 frame, &number_of_live_documents, &number_of_live_nodes); |
38 | 39 |
39 result.leaked = | 40 result.leaked = |
40 (previous_number_of_live_documents_ < number_of_live_documents || | 41 (previous_number_of_live_documents_ < number_of_live_documents || |
41 previous_number_of_live_nodes_ < number_of_live_nodes); | 42 previous_number_of_live_nodes_ < number_of_live_nodes); |
(...skipping 15 matching lines...) Expand all Loading... |
57 result.detail = detail_str; | 58 result.detail = detail_str; |
58 } | 59 } |
59 | 60 |
60 previous_number_of_live_documents_ = number_of_live_documents; | 61 previous_number_of_live_documents_ = number_of_live_documents; |
61 previous_number_of_live_nodes_ = number_of_live_nodes; | 62 previous_number_of_live_nodes_ = number_of_live_nodes; |
62 | 63 |
63 return result; | 64 return result; |
64 } | 65 } |
65 | 66 |
66 } // namespace content | 67 } // namespace content |
OLD | NEW |