Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1074)

Side by Side Diff: content/shell/renderer/layout_test/leak_detector.cc

Issue 1472943004: Split up leak detector into two stages for better leak reporting. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: call clearScriptRegexpContext() in prepareForLeakDetection() Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « content/public/test/render_view_test.cc ('k') | third_party/WebKit/Source/web/WebLeakDetector.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698