Adding instrumentation to locate the source of jankiness
[chromium-blink-merge.git] / chrome / browser / chromeos / system / syslogs_provider.h
blob8fa187716cf6d9cf749e69cdf39e827686ebfde7
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_CHROMEOS_SYSTEM_SYSLOGS_PROVIDER_H_
6 #define CHROME_BROWSER_CHROMEOS_SYSTEM_SYSLOGS_PROVIDER_H_
8 #include <map>
9 #include <string>
11 #include "base/callback.h"
12 #include "base/task/cancelable_task_tracker.h"
14 namespace chromeos {
15 namespace system {
17 // Maximum number of bytes in system info log chunk to be still included
18 // in product specific data.
19 extern const size_t kFeedbackMaxLength;
21 // Maximum number of lines in system info log chunk to be still included
22 // in product specific data.
23 extern const size_t kFeedbackMaxLineCount;
25 typedef std::map<std::string, std::string> LogDictionaryType;
27 // This interface provides access to Chrome OS syslogs.
28 class SyslogsProvider {
29 public:
30 static SyslogsProvider* GetInstance();
32 // The callback type used with RequestSyslogs().
33 typedef base::Callback<void(LogDictionaryType*,
34 std::string*)> ReadCompleteCallback;
36 // Used to specify the syslogs context with RequestSyslogs().
37 enum SyslogsContext {
38 SYSLOGS_FEEDBACK,
39 SYSLOGS_SYSINFO,
40 SYSLOGS_NETWORK,
41 SYSLOGS_DEFAULT
44 // Request system logs. Read happens on the FILE thread and callback is
45 // called on the thread this is called from. Logs are owned by callback
46 // function (use delete when done with them).
47 // Call base::CancelableTaskTracker::TryCancel() with the returned
48 // task ID to cancel
49 // task and callback.
50 virtual base::CancelableTaskTracker::TaskId RequestSyslogs(
51 bool compress_logs,
52 SyslogsContext context,
53 const ReadCompleteCallback& callback,
54 base::CancelableTaskTracker* tracker) = 0;
56 protected:
57 virtual ~SyslogsProvider() {}
60 } // namespace system
61 } // namespace chromeos
63 #endif // CHROME_BROWSER_CHROMEOS_SYSTEM_SYSLOGS_PROVIDER_H_