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

Side by Side Diff: chrome/browser/feedback/system_logs/system_logs_fetcher_base.cc

Issue 1530403003: Add anonymizer tool (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Moved location of scrubbing Created 4 years, 12 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/feedback/system_logs/system_logs_fetcher_base.h" 5 #include "chrome/browser/feedback/system_logs/system_logs_fetcher_base.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "content/public/browser/browser_thread.h" 9 #include "content/public/browser/browser_thread.h"
10 10
(...skipping 16 matching lines...) Expand all
27 SystemLogsFetcherBase::~SystemLogsFetcherBase() {} 27 SystemLogsFetcherBase::~SystemLogsFetcherBase() {}
28 28
29 void SystemLogsFetcherBase::Fetch(const SysLogsFetcherCallback& callback) { 29 void SystemLogsFetcherBase::Fetch(const SysLogsFetcherCallback& callback) {
30 DCHECK_CURRENTLY_ON(BrowserThread::UI); 30 DCHECK_CURRENTLY_ON(BrowserThread::UI);
31 DCHECK(callback_.is_null()); 31 DCHECK(callback_.is_null());
32 DCHECK(!callback.is_null()); 32 DCHECK(!callback.is_null());
33 33
34 callback_ = callback; 34 callback_ = callback;
35 for (size_t i = 0; i < data_sources_.size(); ++i) { 35 for (size_t i = 0; i < data_sources_.size(); ++i) {
36 VLOG(1) << "Fetching SystemLogSource: " << data_sources_[i]->source_name(); 36 VLOG(1) << "Fetching SystemLogSource: " << data_sources_[i]->source_name();
37 data_sources_[i]->Fetch(base::Bind(&SystemLogsFetcherBase::AddResponse, 37 data_sources_[i]->Fetch(base::Bind(&SystemLogsFetcherBase::OnFetched,
38 AsWeakPtr(), 38 AsWeakPtr(),
39 data_sources_[i]->source_name())); 39 data_sources_[i]->source_name()));
40 } 40 }
41 } 41 }
42 42
43 void SystemLogsFetcherBase::AddResponse(const std::string& source_name, 43 void SystemLogsFetcherBase::OnFetched(const std::string& source_name,
44 SystemLogsResponse* response) { 44 SystemLogsResponse* response) {
45 DCHECK_CURRENTLY_ON(BrowserThread::UI); 45 DCHECK_CURRENTLY_ON(BrowserThread::UI);
46 46
47 VLOG(1) << "Received SystemLogSource: " << source_name; 47 VLOG(1) << "Received SystemLogSource: " << source_name;
48 48
49 Rewrite(source_name, response);
50 AddResponse(source_name, response);
51 }
52
53 void SystemLogsFetcherBase::Rewrite(const std::string& source_name,
rkc 2016/01/06 18:43:28 Nit: /* source_name */ and /* response */
battre 2016/01/07 09:54:02 Done.
54 SystemLogsResponse* response) {
55 // This implementation in the base class is intentionally empty.
56 }
57
58 void SystemLogsFetcherBase::AddResponse(const std::string& source_name,
59 SystemLogsResponse* response) {
49 for (SystemLogsResponse::const_iterator it = response->begin(); 60 for (SystemLogsResponse::const_iterator it = response->begin();
50 it != response->end(); 61 it != response->end();
51 ++it) { 62 ++it) {
52 // It is an error to insert an element with a pre-existing key. 63 // It is an error to insert an element with a pre-existing key.
53 bool ok = response_->insert(*it).second; 64 bool ok = response_->insert(*it).second;
54 DCHECK(ok) << "Duplicate key found: " << it->first; 65 DCHECK(ok) << "Duplicate key found: " << it->first;
55 } 66 }
56 67
57 --num_pending_requests_; 68 --num_pending_requests_;
58 if (num_pending_requests_ > 0) 69 if (num_pending_requests_ > 0)
59 return; 70 return;
60 71
61 callback_.Run(response_.Pass()); 72 callback_.Run(response_.Pass());
62 BrowserThread::DeleteSoon(BrowserThread::UI, FROM_HERE, this); 73 BrowserThread::DeleteSoon(BrowserThread::UI, FROM_HERE, this);
63 } 74 }
64 75
65 } // namespace system_logs 76 } // namespace system_logs
OLDNEW
« no previous file with comments | « chrome/browser/feedback/system_logs/system_logs_fetcher_base.h ('k') | components/components_tests.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698