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

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

Issue 1049873005: [chrome/browser/chromeos/] favor DCHECK_CURRENTLY_ON for better logs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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 (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/files/file_util.h" 9 #include "base/files/file_util.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 21 matching lines...) Expand all
32 DebugDaemonLogSource::DebugDaemonLogSource(bool scrub) 32 DebugDaemonLogSource::DebugDaemonLogSource(bool scrub)
33 : SystemLogsSource("DebugDemon"), 33 : SystemLogsSource("DebugDemon"),
34 response_(new SystemLogsResponse()), 34 response_(new SystemLogsResponse()),
35 num_pending_requests_(0), 35 num_pending_requests_(0),
36 scrub_(scrub), 36 scrub_(scrub),
37 weak_ptr_factory_(this) {} 37 weak_ptr_factory_(this) {}
38 38
39 DebugDaemonLogSource::~DebugDaemonLogSource() {} 39 DebugDaemonLogSource::~DebugDaemonLogSource() {}
40 40
41 void DebugDaemonLogSource::Fetch(const SysLogsSourceCallback& callback) { 41 void DebugDaemonLogSource::Fetch(const SysLogsSourceCallback& callback) {
42 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); 42 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
43 DCHECK(!callback.is_null()); 43 DCHECK(!callback.is_null());
44 DCHECK(callback_.is_null()); 44 DCHECK(callback_.is_null());
45 45
46 callback_ = callback; 46 callback_ = callback;
47 chromeos::DebugDaemonClient* client = 47 chromeos::DebugDaemonClient* client =
48 chromeos::DBusThreadManager::Get()->GetDebugDaemonClient(); 48 chromeos::DBusThreadManager::Get()->GetDebugDaemonClient();
49 49
50 client->GetRoutes(true, // Numeric 50 client->GetRoutes(true, // Numeric
51 false, // No IPv6 51 false, // No IPv6
52 base::Bind(&DebugDaemonLogSource::OnGetRoutes, 52 base::Bind(&DebugDaemonLogSource::OnGetRoutes,
(...skipping 17 matching lines...) Expand all
70 weak_ptr_factory_.GetWeakPtr())); 70 weak_ptr_factory_.GetWeakPtr()));
71 } else { 71 } else {
72 client->GetAllLogs(base::Bind(&DebugDaemonLogSource::OnGetLogs, 72 client->GetAllLogs(base::Bind(&DebugDaemonLogSource::OnGetLogs,
73 weak_ptr_factory_.GetWeakPtr())); 73 weak_ptr_factory_.GetWeakPtr()));
74 } 74 }
75 ++num_pending_requests_; 75 ++num_pending_requests_;
76 } 76 }
77 77
78 void DebugDaemonLogSource::OnGetRoutes(bool succeeded, 78 void DebugDaemonLogSource::OnGetRoutes(bool succeeded,
79 const std::vector<std::string>& routes) { 79 const std::vector<std::string>& routes) {
80 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); 80 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
81 81
82 if (succeeded) 82 if (succeeded)
83 (*response_)[kRoutesKeyName] = JoinString(routes, '\n'); 83 (*response_)[kRoutesKeyName] = JoinString(routes, '\n');
84 else 84 else
85 (*response_)[kRoutesKeyName] = kNotAvailable; 85 (*response_)[kRoutesKeyName] = kNotAvailable;
86 RequestCompleted(); 86 RequestCompleted();
87 } 87 }
88 88
89 void DebugDaemonLogSource::OnGetNetworkStatus(bool succeeded, 89 void DebugDaemonLogSource::OnGetNetworkStatus(bool succeeded,
90 const std::string& status) { 90 const std::string& status) {
91 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); 91 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
92 92
93 if (succeeded) 93 if (succeeded)
94 (*response_)[kNetworkStatusKeyName] = status; 94 (*response_)[kNetworkStatusKeyName] = status;
95 else 95 else
96 (*response_)[kNetworkStatusKeyName] = kNotAvailable; 96 (*response_)[kNetworkStatusKeyName] = kNotAvailable;
97 RequestCompleted(); 97 RequestCompleted();
98 } 98 }
99 99
100 void DebugDaemonLogSource::OnGetModemStatus(bool succeeded, 100 void DebugDaemonLogSource::OnGetModemStatus(bool succeeded,
101 const std::string& status) { 101 const std::string& status) {
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); 198 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
199 DCHECK(!callback_.is_null()); 199 DCHECK(!callback_.is_null());
200 200
201 --num_pending_requests_; 201 --num_pending_requests_;
202 if (num_pending_requests_ > 0) 202 if (num_pending_requests_ > 0)
203 return; 203 return;
204 callback_.Run(response_.get()); 204 callback_.Run(response_.get());
205 } 205 }
206 206
207 } // namespace system_logs 207 } // namespace system_logs
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/system_logs/dbus_log_source.cc ('k') | chrome/browser/chromeos/system_logs/device_event_log_source.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698