| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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_OFFLINE_PAGES_CORE_PREFETCH_PREFETCH_DISPATCHER_IMPL_H_ | 5 #ifndef COMPONENTS_OFFLINE_PAGES_CORE_PREFETCH_PREFETCH_DISPATCHER_IMPL_H_ |
| 6 #define COMPONENTS_OFFLINE_PAGES_CORE_PREFETCH_PREFETCH_DISPATCHER_IMPL_H_ | 6 #define COMPONENTS_OFFLINE_PAGES_CORE_PREFETCH_PREFETCH_DISPATCHER_IMPL_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "components/offline_pages/core/prefetch/prefetch_dispatcher.h" | 11 #include "components/offline_pages/core/prefetch/prefetch_dispatcher.h" |
| 12 #include "components/offline_pages/core/task_queue.h" | 12 #include "components/offline_pages/core/task_queue.h" |
| 13 | 13 |
| 14 namespace offline_pages { | 14 namespace offline_pages { |
| 15 class PrefetchService; | 15 class PrefetchService; |
| 16 | 16 |
| 17 class PrefetchDispatcherImpl : public PrefetchDispatcher { | 17 class PrefetchDispatcherImpl : public PrefetchDispatcher { |
| 18 public: | 18 public: |
| 19 PrefetchDispatcherImpl(); | 19 PrefetchDispatcherImpl(); |
| 20 ~PrefetchDispatcherImpl() override; | 20 ~PrefetchDispatcherImpl() override; |
| 21 | 21 |
| 22 // PrefetchDispatcher implementation: | 22 // PrefetchDispatcher implementation: |
| 23 void SetService(PrefetchService* service) override; | 23 void SetService(PrefetchService* service) override; |
| 24 void AddCandidatePrefetchURLs( | 24 void AddCandidatePrefetchURLs( |
| 25 const std::vector<PrefetchURL>& prefetch_urls) override; | 25 const std::vector<PrefetchURL>& prefetch_urls) override; |
| 26 void RemoveAllUnprocessedPrefetchURLs(const std::string& name_space) override; | 26 void RemoveAllUnprocessedPrefetchURLs(const std::string& name_space) override; |
| 27 void RemovePrefetchURLsByClientId(const ClientId& client_id) override; | 27 void RemovePrefetchURLsByClientId(const ClientId& client_id) override; |
| 28 void BeginBackgroundTask(std::unique_ptr<ScopedBackgroundTask> task) override; | 28 void BeginBackgroundTask(std::unique_ptr<ScopedBackgroundTask> task) override; |
| 29 void StopBackgroundTask(ScopedBackgroundTask* task) override; | 29 void StopBackgroundTask() override; |
| 30 void RequestFinishBackgroundTaskForTest() override; |
| 30 | 31 |
| 31 private: | 32 private: |
| 32 friend class PrefetchDispatcherTest; | 33 friend class PrefetchDispatcherTest; |
| 33 | 34 |
| 35 void DisposeTask(); |
| 36 |
| 34 PrefetchService* service_; | 37 PrefetchService* service_; |
| 35 TaskQueue task_queue_; | 38 TaskQueue task_queue_; |
| 39 std::unique_ptr<ScopedBackgroundTask> task_; |
| 36 | 40 |
| 37 DISALLOW_COPY_AND_ASSIGN(PrefetchDispatcherImpl); | 41 DISALLOW_COPY_AND_ASSIGN(PrefetchDispatcherImpl); |
| 38 }; | 42 }; |
| 39 | 43 |
| 40 } // namespace offline_pages | 44 } // namespace offline_pages |
| 41 | 45 |
| 42 #endif // COMPONENTS_OFFLINE_PAGES_CORE_PREFETCH_PREFETCH_DISPATCHER_IMPL_H_ | 46 #endif // COMPONENTS_OFFLINE_PAGES_CORE_PREFETCH_PREFETCH_DISPATCHER_IMPL_H_ |
| OLD | NEW |