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

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

Issue 2319783002: mash: Allow a subset of D-Bus clients to be created in DBusThreadManager (Closed)
Patch Set: WIP, add DBusThreadManagerAsh and DBusThreadManagerChrome 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
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 <stddef.h> 7 #include <stddef.h>
8 8
9 #include <memory> 9 #include <memory>
10 10
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "base/bind_helpers.h" 12 #include "base/bind_helpers.h"
13 #include "base/files/file_util.h" 13 #include "base/files/file_util.h"
14 #include "base/logging.h" 14 #include "base/logging.h"
15 #include "base/memory/weak_ptr.h" 15 #include "base/memory/weak_ptr.h"
16 #include "base/strings/string_number_conversions.h" 16 #include "base/strings/string_number_conversions.h"
17 #include "base/strings/string_util.h" 17 #include "base/strings/string_util.h"
18 #include "chrome/browser/chromeos/dbus_thread_manager_chrome.h"
18 #include "chrome/browser/chromeos/profiles/profile_helper.h" 19 #include "chrome/browser/chromeos/profiles/profile_helper.h"
19 #include "chrome/common/chrome_switches.h" 20 #include "chrome/common/chrome_switches.h"
20 #include "chromeos/dbus/dbus_thread_manager.h" 21 // #include "chromeos/dbus/dbus_thread_manager.h"
21 #include "chromeos/dbus/debug_daemon_client.h" 22 #include "chromeos/dbus/debug_daemon_client.h"
22 #include "components/user_manager/user.h" 23 #include "components/user_manager/user.h"
23 #include "components/user_manager/user_manager.h" 24 #include "components/user_manager/user_manager.h"
24 #include "content/public/browser/browser_thread.h" 25 #include "content/public/browser/browser_thread.h"
25 26
26 const char kNotAvailable[] = "<not available>"; 27 const char kNotAvailable[] = "<not available>";
27 const char kRoutesKeyName[] = "routes"; 28 const char kRoutesKeyName[] = "routes";
28 const char kNetworkStatusKeyName[] = "network-status"; 29 const char kNetworkStatusKeyName[] = "network-status";
29 const char kModemStatusKeyName[] = "modem-status"; 30 const char kModemStatusKeyName[] = "modem-status";
30 const char kWiMaxStatusKeyName[] = "wimax-status"; 31 const char kWiMaxStatusKeyName[] = "wimax-status";
(...skipping 10 matching lines...) Expand all
41 42
42 DebugDaemonLogSource::~DebugDaemonLogSource() {} 43 DebugDaemonLogSource::~DebugDaemonLogSource() {}
43 44
44 void DebugDaemonLogSource::Fetch(const SysLogsSourceCallback& callback) { 45 void DebugDaemonLogSource::Fetch(const SysLogsSourceCallback& callback) {
45 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 46 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
46 DCHECK(!callback.is_null()); 47 DCHECK(!callback.is_null());
47 DCHECK(callback_.is_null()); 48 DCHECK(callback_.is_null());
48 49
49 callback_ = callback; 50 callback_ = callback;
50 chromeos::DebugDaemonClient* client = 51 chromeos::DebugDaemonClient* client =
51 chromeos::DBusThreadManager::Get()->GetDebugDaemonClient(); 52 DBusThreadManagerChrome::Get()->GetDebugDaemonClient();
52 53
53 client->GetRoutes(true, // Numeric 54 client->GetRoutes(true, // Numeric
54 false, // No IPv6 55 false, // No IPv6
55 base::Bind(&DebugDaemonLogSource::OnGetRoutes, 56 base::Bind(&DebugDaemonLogSource::OnGetRoutes,
56 weak_ptr_factory_.GetWeakPtr())); 57 weak_ptr_factory_.GetWeakPtr()));
57 ++num_pending_requests_; 58 ++num_pending_requests_;
58 client->GetNetworkStatus(base::Bind(&DebugDaemonLogSource::OnGetNetworkStatus, 59 client->GetNetworkStatus(base::Bind(&DebugDaemonLogSource::OnGetNetworkStatus,
59 weak_ptr_factory_.GetWeakPtr())); 60 weak_ptr_factory_.GetWeakPtr()));
60 ++num_pending_requests_; 61 ++num_pending_requests_;
61 client->GetModemStatus(base::Bind(&DebugDaemonLogSource::OnGetModemStatus, 62 client->GetModemStatus(base::Bind(&DebugDaemonLogSource::OnGetModemStatus,
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 199 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
199 DCHECK(!callback_.is_null()); 200 DCHECK(!callback_.is_null());
200 201
201 --num_pending_requests_; 202 --num_pending_requests_;
202 if (num_pending_requests_ > 0) 203 if (num_pending_requests_ > 0)
203 return; 204 return;
204 callback_.Run(response_.get()); 205 callback_.Run(response_.get());
205 } 206 }
206 207
207 } // namespace system_logs 208 } // namespace system_logs
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/system_logs/DEPS ('k') | chrome/browser/chromeos/system_logs/debug_log_writer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698