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 #ifndef CHROMEOS_DBUS_DEBUG_DAEMON_CLIENT_H_ | 5 #ifndef CHROMEOS_DBUS_DEBUG_DAEMON_CLIENT_H_ |
6 #define CHROMEOS_DBUS_DEBUG_DAEMON_CLIENT_H_ | 6 #define CHROMEOS_DBUS_DEBUG_DAEMON_CLIENT_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 #include <sys/types.h> |
9 | 10 |
10 #include <map> | 11 #include <map> |
| 12 #include <string> |
| 13 #include <vector> |
11 | 14 |
12 #include "base/callback.h" | 15 #include "base/callback.h" |
13 #include "base/files/file.h" | 16 #include "base/files/file.h" |
14 #include "base/macros.h" | 17 #include "base/macros.h" |
15 #include "base/memory/ref_counted_memory.h" | 18 #include "base/memory/ref_counted_memory.h" |
16 #include "base/task_runner.h" | 19 #include "base/task_runner.h" |
17 #include "base/trace_event/tracing_agent.h" | 20 #include "base/trace_event/tracing_agent.h" |
18 #include "chromeos/chromeos_export.h" | 21 #include "chromeos/chromeos_export.h" |
19 #include "chromeos/dbus/dbus_client.h" | 22 #include "chromeos/dbus/dbus_client.h" |
20 #include "third_party/cros_system_api/dbus/service_constants.h" | 23 #include "third_party/cros_system_api/dbus/service_constants.h" |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 virtual void UploadCrashes() = 0; | 190 virtual void UploadCrashes() = 0; |
188 | 191 |
189 // A callback for WaitForServiceToBeAvailable(). | 192 // A callback for WaitForServiceToBeAvailable(). |
190 typedef base::Callback<void(bool service_is_ready)> | 193 typedef base::Callback<void(bool service_is_ready)> |
191 WaitForServiceToBeAvailableCallback; | 194 WaitForServiceToBeAvailableCallback; |
192 | 195 |
193 // Runs the callback as soon as the service becomes available. | 196 // Runs the callback as soon as the service becomes available. |
194 virtual void WaitForServiceToBeAvailable( | 197 virtual void WaitForServiceToBeAvailable( |
195 const WaitForServiceToBeAvailableCallback& callback) = 0; | 198 const WaitForServiceToBeAvailableCallback& callback) = 0; |
196 | 199 |
| 200 // A callback for SetOomScoreAdj(). |
| 201 typedef base::Callback<void(bool success, const std::string& output)> |
| 202 SetOomScoreAdjCallback; |
| 203 |
| 204 // Set OOM score oom_score_adj for some process. |
| 205 // Note that the corresponding DBus configuration of the debugd method |
| 206 // "SetOomScoreAdj" only permits setting OOM score for processes running by |
| 207 // user chronos or Android apps. |
| 208 virtual void SetOomScoreAdj( |
| 209 const std::map<pid_t, int32_t>& pid_to_oom_score_adj, |
| 210 const SetOomScoreAdjCallback& callback) = 0; |
| 211 |
197 // Factory function, creates a new instance and returns ownership. | 212 // Factory function, creates a new instance and returns ownership. |
198 // For normal usage, access the singleton via DBusThreadManager::Get(). | 213 // For normal usage, access the singleton via DBusThreadManager::Get(). |
199 static DebugDaemonClient* Create(); | 214 static DebugDaemonClient* Create(); |
200 | 215 |
201 protected: | 216 protected: |
202 // Create() should be used instead. | 217 // Create() should be used instead. |
203 DebugDaemonClient(); | 218 DebugDaemonClient(); |
204 | 219 |
205 private: | 220 private: |
206 DISALLOW_COPY_AND_ASSIGN(DebugDaemonClient); | 221 DISALLOW_COPY_AND_ASSIGN(DebugDaemonClient); |
207 }; | 222 }; |
208 | 223 |
209 } // namespace chromeos | 224 } // namespace chromeos |
210 | 225 |
211 #endif // CHROMEOS_DBUS_DEBUG_DAEMON_CLIENT_H_ | 226 #endif // CHROMEOS_DBUS_DEBUG_DAEMON_CLIENT_H_ |
OLD | NEW |