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

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

Issue 1405373002: Fix WebRTC log list errors. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updated log uploader unit test. Created 5 years, 2 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 <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/files/file_path.h" 11 #include "base/files/file_path.h"
12 #include "base/gtest_prod_util.h" 12 #include "base/gtest_prod_util.h"
13 #include "base/memory/ref_counted.h" 13 #include "base/memory/ref_counted.h"
14 #include "base/threading/thread_checker.h" 14 #include "base/threading/thread_checker.h"
15 #include "base/time/time.h" 15 #include "base/time/time.h"
16 16
17 namespace base { 17 namespace base {
18 class SequencedTaskRunner; 18 class SequencedTaskRunner;
19 class SequencedWorkerPool; 19 class SequencedWorkerPool;
20 } 20 }
21 21
22 // Loads and parses an upload list text file of the format 22 // Loads and parses an upload list text file of the format
23 // time,id[,local_id] 23 // upload_time,upload_id[,local_id,capture_time]
24 // time,id[,local_id] 24 // upload_time,upload_id[,local_id,capture_time]
25 // etc. 25 // etc.
26 // where each line represents an upload and "time" is Unix time. Must be used 26 // where each line represents an upload. |upload_time| and |capture_time| are
27 // from the UI thread. The loading and parsing is done on a blocking pool task 27 // in Unix time. Must be used from the UI thread. The loading and parsing is
28 // runner. A line may or may not contain "local_id". 28 // done on a blocking pool task runner. A line may or may not contain
29 // |local_id| and |capture_time|.
29 class UploadList : public base::RefCountedThreadSafe<UploadList> { 30 class UploadList : public base::RefCountedThreadSafe<UploadList> {
30 public: 31 public:
31 struct UploadInfo { 32 struct UploadInfo {
32 UploadInfo(const std::string& id, 33 UploadInfo(const std::string& upload_id,
33 const base::Time& t, 34 const base::Time& upload_time,
34 const std::string& local_id); 35 const std::string& local_id,
35 UploadInfo(const std::string& id, const base::Time& t); 36 const base::Time& capture_time);
37 UploadInfo(const std::string& upload_id, const base::Time& upload_time);
36 ~UploadInfo(); 38 ~UploadInfo();
37 39
38 std::string id; 40 std::string upload_id;
39 base::Time time; 41 base::Time upload_time;
40 // ID for a locally stored object that may or may not be uploaded. 42
43 // ID for locally stored data that may or may not be uploaded.
41 std::string local_id; 44 std::string local_id;
45
46 // The time the data was captured. This is useful if the data is stored
47 // locally when captured and uploaded at a later time.
48 base::Time capture_time;
42 }; 49 };
43 50
44 class Delegate { 51 class Delegate {
45 public: 52 public:
46 // Invoked when the upload list has been loaded. Will be called on the 53 // Invoked when the upload list has been loaded. Will be called on the
47 // UI thread. 54 // UI thread.
48 virtual void OnUploadListAvailable() = 0; 55 virtual void OnUploadListAvailable() = 0;
49 56
50 protected: 57 protected:
51 virtual ~Delegate() {} 58 virtual ~Delegate() {}
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 Delegate* delegate_; 107 Delegate* delegate_;
101 const base::FilePath upload_log_path_; 108 const base::FilePath upload_log_path_;
102 109
103 base::ThreadChecker thread_checker_; 110 base::ThreadChecker thread_checker_;
104 scoped_refptr<base::SequencedWorkerPool> worker_pool_; 111 scoped_refptr<base::SequencedWorkerPool> worker_pool_;
105 112
106 DISALLOW_COPY_AND_ASSIGN(UploadList); 113 DISALLOW_COPY_AND_ASSIGN(UploadList);
107 }; 114 };
108 115
109 #endif // COMPONENTS_UPLOAD_LIST_UPLOAD_LIST_H_ 116 #endif // COMPONENTS_UPLOAD_LIST_UPLOAD_LIST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698