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

Side by Side Diff: components/upload_list/upload_list.h

Issue 2070993002: List all crashes in chrome://crashes, including those not uploaded (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: unittest Created 4 years, 6 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 COMPONENTS_UPLOAD_LIST_UPLOAD_LIST_H_ 5 #ifndef COMPONENTS_UPLOAD_LIST_UPLOAD_LIST_H_
6 #define COMPONENTS_UPLOAD_LIST_UPLOAD_LIST_H_ 6 #define COMPONENTS_UPLOAD_LIST_UPLOAD_LIST_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <string> 10 #include <string>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/files/file_path.h" 13 #include "base/files/file_path.h"
14 #include "base/macros.h" 14 #include "base/macros.h"
15 #include "base/memory/ref_counted.h" 15 #include "base/memory/ref_counted.h"
16 #include "base/threading/thread_checker.h" 16 #include "base/threading/thread_checker.h"
17 #include "base/time/time.h" 17 #include "base/time/time.h"
18 18
19 namespace base { 19 namespace base {
20 class SequencedTaskRunner; 20 class SequencedTaskRunner;
21 class SequencedWorkerPool; 21 class SequencedWorkerPool;
22 } 22 }
23 23
24 // Loads and parses an upload list text file of the format 24 // Loads and parses an upload list text file of the format
25 // upload_time,upload_id[,local_id[,capture_time]] 25 // upload_time,upload_id[,local_id[,capture_time[,state]]]
26 // upload_time,upload_id[,local_id[,capture_time]] 26 // upload_time,upload_id[,local_id[,capture_time[,state]]]
27 // etc. 27 // etc.
28 // where each line represents an upload. |upload_time| and |capture_time| are 28 // where each line represents an upload. |upload_time| and |capture_time| are in
29 // in Unix time. Must be used from the UI thread. The loading and parsing is 29 // Unix time. |state| is an int in the range of UploadInfo::State. Must be used
30 // done on a blocking pool task runner. A line may or may not contain 30 // from the UI thread. The loading and parsing is done on a blocking pool task
31 // |local_id| and |capture_time|. 31 // runner. A line may or may not contain |local_id|, |capture_time|, and
32 // |state|.
32 class UploadList : public base::RefCountedThreadSafe<UploadList> { 33 class UploadList : public base::RefCountedThreadSafe<UploadList> {
33 public: 34 public:
34 struct UploadInfo { 35 struct UploadInfo {
36 enum class State {
37 NotUploaded = 0,
38 Pending = 1,
39 Uploaded = 2,
40 };
41
35 UploadInfo(const std::string& upload_id, 42 UploadInfo(const std::string& upload_id,
36 const base::Time& upload_time, 43 const base::Time& upload_time,
37 const std::string& local_id, 44 const std::string& local_id,
38 const base::Time& capture_time); 45 const base::Time& capture_time,
46 State state);
39 UploadInfo(const std::string& upload_id, const base::Time& upload_time); 47 UploadInfo(const std::string& upload_id, const base::Time& upload_time);
40 ~UploadInfo(); 48 ~UploadInfo();
41 49
42 std::string upload_id; 50 std::string upload_id;
Mark Mentovai 2016/06/20 17:55:21 Comment that these fields are only valid in the Up
scottmg 2016/06/20 21:08:55 Done.
43 base::Time upload_time; 51 base::Time upload_time;
44 52
45 // ID for locally stored data that may or may not be uploaded. 53 // ID for locally stored data that may or may not be uploaded.
46 std::string local_id; 54 std::string local_id;
47 55
48 // The time the data was captured. This is useful if the data is stored 56 // The time the data was captured. This is useful if the data is stored
49 // locally when captured and uploaded at a later time. 57 // locally when captured and uploaded at a later time.
50 base::Time capture_time; 58 base::Time capture_time;
59
60 State state;
51 }; 61 };
52 62
53 class Delegate { 63 class Delegate {
54 public: 64 public:
55 // Invoked when the upload list has been loaded. Will be called on the 65 // Invoked when the upload list has been loaded. Will be called on the
56 // UI thread. 66 // UI thread.
57 virtual void OnUploadListAvailable() = 0; 67 virtual void OnUploadListAvailable() = 0;
58 68
59 protected: 69 protected:
60 virtual ~Delegate() {} 70 virtual ~Delegate() {}
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 Delegate* delegate_; 116 Delegate* delegate_;
107 117
108 const base::FilePath upload_log_path_; 118 const base::FilePath upload_log_path_;
109 119
110 scoped_refptr<base::SequencedWorkerPool> worker_pool_; 120 scoped_refptr<base::SequencedWorkerPool> worker_pool_;
111 121
112 DISALLOW_COPY_AND_ASSIGN(UploadList); 122 DISALLOW_COPY_AND_ASSIGN(UploadList);
113 }; 123 };
114 124
115 #endif // COMPONENTS_UPLOAD_LIST_UPLOAD_LIST_H_ 125 #endif // COMPONENTS_UPLOAD_LIST_UPLOAD_LIST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698