OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_JOB_EVENT_ROUTER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_JOB_EVENT_ROUTER_H_ |
6 #define CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_JOB_EVENT_ROUTER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_JOB_EVENT_ROUTER_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <map> | 10 #include <map> |
11 #include <memory> | 11 #include <memory> |
12 #include <set> | 12 #include <set> |
13 #include <string> | 13 #include <string> |
14 | 14 |
15 #include "base/macros.h" | 15 #include "base/macros.h" |
| 16 #include "base/memory/linked_ptr.h" |
16 #include "base/memory/weak_ptr.h" | 17 #include "base/memory/weak_ptr.h" |
17 #include "base/threading/thread_checker.h" | 18 #include "base/threading/thread_checker.h" |
18 #include "base/time/time.h" | 19 #include "base/time/time.h" |
19 #include "base/values.h" | 20 #include "base/values.h" |
20 #include "chrome/common/extensions/api/file_manager_private.h" | 21 #include "chrome/common/extensions/api/file_manager_private.h" |
21 #include "components/drive/job_list.h" | 22 #include "components/drive/job_list.h" |
22 #include "extensions/browser/extension_event_histogram_value.h" | 23 #include "extensions/browser/extension_event_histogram_value.h" |
23 #include "url/gurl.h" | 24 #include "url/gurl.h" |
24 | 25 |
25 namespace file_manager { | 26 namespace file_manager { |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 const drive::JobInfo& job_info, | 75 const drive::JobInfo& job_info, |
75 const extensions::api::file_manager_private::TransferState& state, | 76 const extensions::api::file_manager_private::TransferState& state, |
76 const int64_t num_total_jobs, | 77 const int64_t num_total_jobs, |
77 const int64_t num_completed_bytes, | 78 const int64_t num_completed_bytes, |
78 const int64_t num_total_bytes); | 79 const int64_t num_total_bytes); |
79 | 80 |
80 // Delay time before sending progress events. | 81 // Delay time before sending progress events. |
81 base::TimeDelta event_delay_; | 82 base::TimeDelta event_delay_; |
82 | 83 |
83 // Set of job that are in the job schedular. | 84 // Set of job that are in the job schedular. |
84 std::map<drive::JobID, std::unique_ptr<drive::JobInfo>> drive_jobs_; | 85 std::map<drive::JobID, linked_ptr<drive::JobInfo>> drive_jobs_; |
85 | 86 |
86 // Job info of pending event. |ScheduleDriveFileTransferEvent| registers | 87 // Job info of pending event. |ScheduleDriveFileTransferEvent| registers |
87 // timeout callback to dispatch this. | 88 // timeout callback to dispatch this. |
88 std::unique_ptr<drive::JobInfo> pending_job_info_; | 89 std::unique_ptr<drive::JobInfo> pending_job_info_; |
89 | 90 |
90 // Transfer state of pending event. | 91 // Transfer state of pending event. |
91 extensions::api::file_manager_private::TransferState pending_state_; | 92 extensions::api::file_manager_private::TransferState pending_state_; |
92 | 93 |
93 // Computed bytes of tasks that have been processed. Once it completes all | 94 // Computed bytes of tasks that have been processed. Once it completes all |
94 // tasks, it clears the variable. | 95 // tasks, it clears the variable. |
95 int64_t num_completed_bytes_; | 96 int64_t num_completed_bytes_; |
96 | 97 |
97 // Total bytes of tasks that have been processed. Once it completes all tasks, | 98 // Total bytes of tasks that have been processed. Once it completes all tasks, |
98 // it clears the variable. | 99 // it clears the variable. |
99 int64_t num_total_bytes_; | 100 int64_t num_total_bytes_; |
100 | 101 |
101 // Thread checker. | 102 // Thread checker. |
102 base::ThreadChecker thread_checker_; | 103 base::ThreadChecker thread_checker_; |
103 | 104 |
104 // Note: This should remain the last member so it'll be destroyed and | 105 // Note: This should remain the last member so it'll be destroyed and |
105 // invalidate the weak pointers before any other members are destroyed. | 106 // invalidate the weak pointers before any other members are destroyed. |
106 base::WeakPtrFactory<JobEventRouter> weak_factory_; | 107 base::WeakPtrFactory<JobEventRouter> weak_factory_; |
107 | 108 |
108 DISALLOW_COPY_AND_ASSIGN(JobEventRouter); | 109 DISALLOW_COPY_AND_ASSIGN(JobEventRouter); |
109 }; | 110 }; |
110 | 111 |
111 } // namespace file_manager | 112 } // namespace file_manager |
112 | 113 |
113 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_JOB_EVENT_ROUTER_H_ | 114 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_JOB_EVENT_ROUTER_H_ |
OLD | NEW |