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

Side by Side Diff: chrome/browser/chromeos/system_logs/debug_daemon_log_source.cc

Issue 12529024: Fix feedback log collection. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 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 | Annotate | Revision Log
OLDNEW
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/debug_daemon_log_source.h" 5 #include "chrome/browser/chromeos/system_logs/debug_daemon_log_source.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 "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "base/memory/weak_ptr.h" 12 #include "base/memory/weak_ptr.h"
13 #include "base/string_util.h" 13 #include "base/string_util.h"
14 #include "chrome/browser/chromeos/system_logs/system_logs_fetcher.h" 14 #include "chrome/browser/chromeos/system_logs/system_logs_fetcher.h"
15 #include "chrome/common/chrome_switches.h" 15 #include "chrome/common/chrome_switches.h"
16 #include "chromeos/dbus/dbus_thread_manager.h" 16 #include "chromeos/dbus/dbus_thread_manager.h"
17 #include "chromeos/dbus/debug_daemon_client.h" 17 #include "chromeos/dbus/debug_daemon_client.h"
18 #include "content/public/browser/browser_thread.h" 18 #include "content/public/browser/browser_thread.h"
19 19
20 namespace {
21
22 const char kNotAvailable[] = "<not available>"; 20 const char kNotAvailable[] = "<not available>";
23 const char kRoutesKeyName[] = "routes"; 21 const char kRoutesKeyName[] = "routes";
24 const char kNetworkStatusKeyName[] = "network-status"; 22 const char kNetworkStatusKeyName[] = "network-status";
25 const char kModemStatusKeyName[] = "modem-status"; 23 const char kModemStatusKeyName[] = "modem-status";
26 const char kUserLogFileKeyName[] = "user_log_files"; 24 const char kUserLogFileKeyName[] = "user_log_files";
27 } // namespace
28 25
29 namespace chromeos { 26 namespace chromeos {
30 27
31 // Fetches logs from the debug daemon over DBus. When all the logs have been
32 // fetched, forwards the results to the supplied Request. Used like:
33 // DebugDaemonLogSource* fetcher = new DebugDaemonLogSource(request);
34 // fetcher->Fetch();
35 // Note that you do not need to delete the fetcher; it will delete itself after
36 // Fetch() has forwarded the result to the request handler.
37
38
39 DebugDaemonLogSource::DebugDaemonLogSource() 28 DebugDaemonLogSource::DebugDaemonLogSource()
40 : response_(new SystemLogsResponse()), 29 : response_(new SystemLogsResponse()),
41 num_pending_requests_(0), 30 num_pending_requests_(0),
42 ALLOW_THIS_IN_INITIALIZER_LIST(weak_ptr_factory_(this)) {} 31 ALLOW_THIS_IN_INITIALIZER_LIST(weak_ptr_factory_(this)) {}
43 32
44 DebugDaemonLogSource::~DebugDaemonLogSource() {} 33 DebugDaemonLogSource::~DebugDaemonLogSource() {}
45 34
46 void DebugDaemonLogSource::Fetch(const SysLogsSourceCallback& callback) { 35 void DebugDaemonLogSource::Fetch(const SysLogsSourceCallback& callback) {
47 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); 36 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
48 DCHECK(!callback.is_null()); 37 DCHECK(!callback.is_null());
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); 140 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
152 DCHECK(!callback_.is_null()); 141 DCHECK(!callback_.is_null());
153 142
154 --num_pending_requests_; 143 --num_pending_requests_;
155 if (num_pending_requests_ > 0) 144 if (num_pending_requests_ > 0)
156 return; 145 return;
157 callback_.Run(response_.get()); 146 callback_.Run(response_.get());
158 } 147 }
159 148
160 } // namespace chromeos 149 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698