OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/chromeos/system_logs/system_logs_fetcher.h" | 5 #include "chrome/browser/chromeos/system_logs/system_logs_fetcher.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 "chrome/browser/chromeos/system_logs/command_line_log_source.h" | 9 #include "chrome/browser/chromeos/system_logs/command_line_log_source.h" |
10 #include "chrome/browser/chromeos/system_logs/debug_daemon_log_source.h" | 10 #include "chrome/browser/chromeos/system_logs/debug_daemon_log_source.h" |
11 #include "chrome/browser/chromeos/system_logs/lsb_release_log_source.h" | 11 #include "chrome/browser/chromeos/system_logs/lsb_release_log_source.h" |
12 #include "chrome/browser/chromeos/system_logs/memory_details_log_source.h" | 12 #include "chrome/browser/chromeos/system_logs/memory_details_log_source.h" |
13 #include "content/public/browser/browser_thread.h" | 13 #include "content/public/browser/browser_thread.h" |
14 | 14 |
15 using content::BrowserThread; | 15 using content::BrowserThread; |
16 | 16 |
17 namespace chromeos { | 17 namespace chromeos { |
18 | 18 |
19 SystemLogsFetcher::SystemLogsFetcher() | 19 SystemLogsFetcher::SystemLogsFetcher() |
20 : response_(new SystemLogsResponse), | 20 : response_(new SystemLogsResponse), |
21 num_pending_requests_(0), | 21 num_pending_requests_(0), |
22 ALLOW_THIS_IN_INITIALIZER_LIST(weak_ptr_factory_(this)) { | 22 ALLOW_THIS_IN_INITIALIZER_LIST(weak_ptr_factory_(this)) { |
23 // Debug Daemon data source. | 23 // Debug Daemon data source. |
24 data_sources_.push_back(new DebugDaemonLogSource()); | 24 data_sources_.push_back(new DebugDaemonLogSource()); |
25 | 25 |
26 // Chrome data sources. | 26 // Chrome data sources. |
27 data_sources_.push_back(new CommandLineLogSource()); | 27 data_sources_.push_back(new CommandLineLogSource()); |
28 data_sources_.push_back(new LsbReleaseLogSource()); | 28 data_sources_.push_back(new LsbReleaseLogSource()); |
29 data_sources_.push_back(new MemoryDetailsLogSource()); | 29 data_sources_.push_back(new MemoryDetailsLogSource()); |
| 30 |
30 num_pending_requests_ = data_sources_.size(); | 31 num_pending_requests_ = data_sources_.size(); |
31 } | 32 } |
32 | 33 |
33 SystemLogsFetcher::~SystemLogsFetcher() {} | 34 SystemLogsFetcher::~SystemLogsFetcher() {} |
34 | 35 |
35 void SystemLogsFetcher::Fetch(const SysLogsFetcherCallback& callback) { | 36 void SystemLogsFetcher::Fetch(const SysLogsFetcherCallback& callback) { |
36 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 37 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
37 DCHECK(callback_.is_null()); | 38 DCHECK(callback_.is_null()); |
38 DCHECK(!callback.is_null()); | 39 DCHECK(!callback.is_null()); |
39 | 40 |
(...skipping 20 matching lines...) Expand all Loading... |
60 --num_pending_requests_; | 61 --num_pending_requests_; |
61 if (num_pending_requests_ > 0) | 62 if (num_pending_requests_ > 0) |
62 return; | 63 return; |
63 | 64 |
64 callback_.Run(response_.Pass()); | 65 callback_.Run(response_.Pass()); |
65 BrowserThread::DeleteSoon(BrowserThread::UI, FROM_HERE, this); | 66 BrowserThread::DeleteSoon(BrowserThread::UI, FROM_HERE, this); |
66 } | 67 } |
67 | 68 |
68 } // namespace chromeos | 69 } // namespace chromeos |
69 | 70 |
OLD | NEW |