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