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/layout_test/leak_detector.h" | 5 #include "content/shell/renderer/layout_test/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 "content/shell/renderer/layout_test/blink_test_runner.h" | 10 #include "content/shell/renderer/layout_test/blink_test_runner.h" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 previous_result_.numberOfLiveScriptPromises = kInitialNumberOfScriptPromises; | 53 previous_result_.numberOfLiveScriptPromises = kInitialNumberOfScriptPromises; |
54 previous_result_.numberOfLiveFrames = kInitialNumberOfLiveFrames; | 54 previous_result_.numberOfLiveFrames = kInitialNumberOfLiveFrames; |
55 previous_result_.numberOfLiveV8PerContextData = | 55 previous_result_.numberOfLiveV8PerContextData = |
56 kInitialNumberOfV8PerContextData; | 56 kInitialNumberOfV8PerContextData; |
57 } | 57 } |
58 | 58 |
59 LeakDetector::~LeakDetector() { | 59 LeakDetector::~LeakDetector() { |
60 } | 60 } |
61 | 61 |
62 void LeakDetector::TryLeakDetection(blink::WebLocalFrame* frame) { | 62 void LeakDetector::TryLeakDetection(blink::WebLocalFrame* frame) { |
63 web_leak_detector_->collectGarbageAndGetDOMCounts(frame); | 63 web_leak_detector_->prepareForLeakDetection(frame); |
| 64 web_leak_detector_->collectGarbageAndReport(); |
64 } | 65 } |
65 | 66 |
66 void LeakDetector::onLeakDetectionComplete( | 67 void LeakDetector::onLeakDetectionComplete( |
67 const WebLeakDetectorClient::Result& result) { | 68 const WebLeakDetectorClient::Result& result) { |
68 LeakDetectionResult report; | 69 LeakDetectionResult report; |
69 report.leaked = false; | 70 report.leaked = false; |
70 base::DictionaryValue detail; | 71 base::DictionaryValue detail; |
71 | 72 |
72 if (previous_result_.numberOfLiveAudioNodes < result.numberOfLiveAudioNodes) { | 73 if (previous_result_.numberOfLiveAudioNodes < result.numberOfLiveAudioNodes) { |
73 base::ListValue* list = new base::ListValue(); | 74 base::ListValue* list = new base::ListValue(); |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 base::JSONWriter::Write(detail, &detail_str); | 134 base::JSONWriter::Write(detail, &detail_str); |
134 report.detail = detail_str; | 135 report.detail = detail_str; |
135 report.leaked = true; | 136 report.leaked = true; |
136 } | 137 } |
137 | 138 |
138 previous_result_ = result; | 139 previous_result_ = result; |
139 test_runner_->ReportLeakDetectionResult(report); | 140 test_runner_->ReportLeakDetectionResult(report); |
140 } | 141 } |
141 | 142 |
142 } // namespace content | 143 } // namespace content |
OLD | NEW |