| OLD | NEW |
| 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 CHROME_BROWSER_FEEDBACK_SYSTEM_LOGS_SYSTEM_LOGS_FETCHER_BASE_H_ | 5 #ifndef CHROME_BROWSER_FEEDBACK_SYSTEM_LOGS_SYSTEM_LOGS_FETCHER_BASE_H_ |
| 6 #define CHROME_BROWSER_FEEDBACK_SYSTEM_LOGS_SYSTEM_LOGS_FETCHER_BASE_H_ | 6 #define CHROME_BROWSER_FEEDBACK_SYSTEM_LOGS_SYSTEM_LOGS_FETCHER_BASE_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| 11 #include <memory> | 11 #include <memory> |
| 12 #include <string> | 12 #include <string> |
| 13 #include <vector> |
| 13 | 14 |
| 14 #include "base/callback.h" | 15 #include "base/callback.h" |
| 15 #include "base/macros.h" | 16 #include "base/macros.h" |
| 16 #include "base/memory/scoped_vector.h" | |
| 17 #include "base/memory/weak_ptr.h" | 17 #include "base/memory/weak_ptr.h" |
| 18 #include "components/feedback/feedback_common.h" | 18 #include "components/feedback/feedback_common.h" |
| 19 | 19 |
| 20 namespace system_logs { | 20 namespace system_logs { |
| 21 | 21 |
| 22 using SystemLogsResponse = FeedbackCommon::SystemLogsMap; | 22 using SystemLogsResponse = FeedbackCommon::SystemLogsMap; |
| 23 | 23 |
| 24 // Callback that the data sources use to return data. | 24 // Callback that the data sources use to return data. |
| 25 using SysLogsSourceCallback = base::Callback<void(SystemLogsResponse*)>; | 25 using SysLogsSourceCallback = base::Callback<void(SystemLogsResponse*)>; |
| 26 | 26 |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 // it gets added to the output. | 76 // it gets added to the output. |
| 77 virtual void Rewrite(const std::string& source_name, | 77 virtual void Rewrite(const std::string& source_name, |
| 78 SystemLogsResponse* response); | 78 SystemLogsResponse* response); |
| 79 | 79 |
| 80 // Merges the |data| it receives into response_. When all the data sources | 80 // Merges the |data| it receives into response_. When all the data sources |
| 81 // have responded, it deletes their objects and returns the response to the | 81 // have responded, it deletes their objects and returns the response to the |
| 82 // callback_. After this it deletes this instance of the object. | 82 // callback_. After this it deletes this instance of the object. |
| 83 void AddResponse(const std::string& source_name, | 83 void AddResponse(const std::string& source_name, |
| 84 SystemLogsResponse* response); | 84 SystemLogsResponse* response); |
| 85 | 85 |
| 86 ScopedVector<SystemLogsSource> data_sources_; | 86 std::vector<std::unique_ptr<SystemLogsSource>> data_sources_; |
| 87 SysLogsFetcherCallback callback_; | 87 SysLogsFetcherCallback callback_; |
| 88 | 88 |
| 89 std::unique_ptr<SystemLogsResponse> response_; // The actual response data. | 89 std::unique_ptr<SystemLogsResponse> response_; // The actual response data. |
| 90 size_t num_pending_requests_; // The number of callbacks it should get. | 90 size_t num_pending_requests_; // The number of callbacks it should get. |
| 91 | 91 |
| 92 private: | 92 private: |
| 93 | 93 |
| 94 DISALLOW_COPY_AND_ASSIGN(SystemLogsFetcherBase); | 94 DISALLOW_COPY_AND_ASSIGN(SystemLogsFetcherBase); |
| 95 }; | 95 }; |
| 96 | 96 |
| 97 } // namespace system_logs | 97 } // namespace system_logs |
| 98 | 98 |
| 99 #endif // CHROME_BROWSER_FEEDBACK_SYSTEM_LOGS_SYSTEM_LOGS_FETCHER_BASE_H_ | 99 #endif // CHROME_BROWSER_FEEDBACK_SYSTEM_LOGS_SYSTEM_LOGS_FETCHER_BASE_H_ |
| OLD | NEW |