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

Side by Side Diff: chrome/browser/metrics/leak_detector/leak_detector_controller.cc

Issue 2295413002: Detach LeakDetectorController from remote controller on shutdown (Closed)
Patch Set: Fix for unit testing Created 4 years, 3 months 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
« no previous file with comments | « no previous file | chrome/browser/metrics/leak_detector/leak_detector_controller_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "chrome/browser/metrics/leak_detector/leak_detector_controller.h" 5 #include "chrome/browser/metrics/leak_detector/leak_detector_controller.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/rand_util.h" 10 #include "base/rand_util.h"
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 170
171 // Leak detector parameters are stored in |params_|. 171 // Leak detector parameters are stored in |params_|.
172 detector->Init(params_, content::BrowserThread::GetTaskRunnerForThread( 172 detector->Init(params_, content::BrowserThread::GetTaskRunnerForThread(
173 content::BrowserThread::UI)); 173 content::BrowserThread::UI));
174 } 174 }
175 } 175 }
176 176
177 LeakDetectorController::~LeakDetectorController() { 177 LeakDetectorController::~LeakDetectorController() {
178 DCHECK(thread_checker_.CalledOnValidThread()); 178 DCHECK(thread_checker_.CalledOnValidThread());
179 LeakDetector::GetInstance()->RemoveObserver(this); 179 LeakDetector::GetInstance()->RemoveObserver(this);
180 LeakDetectorRemoteController::SetLocalControllerInstance(nullptr);
180 } 181 }
181 182
182 void LeakDetectorController::GetLeakReports( 183 void LeakDetectorController::GetLeakReports(
183 std::vector<MemoryLeakReportProto>* reports) { 184 std::vector<MemoryLeakReportProto>* reports) {
184 DCHECK(thread_checker_.CalledOnValidThread()); 185 DCHECK(thread_checker_.CalledOnValidThread());
185 reports->swap(stored_reports_); 186 reports->swap(stored_reports_);
186 stored_reports_.clear(); 187 stored_reports_.clear();
187 } 188 }
188 189
189 void LeakDetectorController::OnLeaksFound( 190 void LeakDetectorController::OnLeaksFound(
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 // Store the report and insert stored parameters. 230 // Store the report and insert stored parameters.
230 stored_reports_.push_back(report); 231 stored_reports_.push_back(report);
231 stored_reports_.back().mutable_params()->CopyFrom(params_); 232 stored_reports_.back().mutable_params()->CopyFrom(params_);
232 stored_reports_.back().set_source_process(process_type); 233 stored_reports_.back().set_source_process(process_type);
233 stored_reports_.back().mutable_build_id()->assign(build_id_.begin(), 234 stored_reports_.back().mutable_build_id()->assign(build_id_.begin(),
234 build_id_.end()); 235 build_id_.end());
235 } 236 }
236 } 237 }
237 238
238 } // namespace metrics 239 } // namespace metrics
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/metrics/leak_detector/leak_detector_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698