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

Side by Side Diff: components/offline_pages/background/update_request_task.h

Issue 2473553004: Request Picker task (Closed)
Patch Set: CR fixes per DougArnett Created 4 years, 1 month 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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_BACKGROUND_UPDATE_REQUEST_TASK_H_ 5 #ifndef COMPONENTS_OFFLINE_PAGES_BACKGROUND_UPDATE_REQUEST_TASK_H_
6 #define COMPONENTS_OFFLINE_PAGES_BACKGROUND_UPDATE_REQUEST_TASK_H_ 6 #define COMPONENTS_OFFLINE_PAGES_BACKGROUND_UPDATE_REQUEST_TASK_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 15 matching lines...) Expand all
26 ~UpdateRequestTask() override; 26 ~UpdateRequestTask() override;
27 27
28 // TaskQueue::Task implementation. 28 // TaskQueue::Task implementation.
29 void Run() override; 29 void Run() override;
30 30
31 protected: 31 protected:
32 // Step 1. Reading the requests. 32 // Step 1. Reading the requests.
33 void ReadRequest(); 33 void ReadRequest();
34 // Step 2. Work is done in the implementation step. 34 // Step 2. Work is done in the implementation step.
35 virtual void UpdateRequestImpl( 35 virtual void UpdateRequestImpl(
36 std::unique_ptr<UpdateRequestsResult> result) = 0; 36 std::unique_ptr<QueueResults::UpdateRequestsResult> result) = 0;
37 // Step 3. Completes once update is done. 37 // Step 3. Completes once update is done.
38 void CompleteWithResult(std::unique_ptr<UpdateRequestsResult> result); 38 void CompleteWithResult(
39 std::unique_ptr<QueueResults::UpdateRequestsResult> result);
39 40
40 // Function to uniformly validate read request call for store errors and 41 // Function to uniformly validate read request call for store errors and
41 // presence of the request. 42 // presence of the request.
42 bool ValidateReadResult(UpdateRequestsResult* result); 43 bool ValidateReadResult(QueueResults::UpdateRequestsResult* result);
43 44
44 RequestQueueStore* store() const { return store_; } 45 RequestQueueStore* store() const { return store_; }
45 46
46 int64_t request_id() const { return request_id_; } 47 int64_t request_id() const { return request_id_; }
47 48
48 base::WeakPtr<UpdateRequestTask> GetWeakPtr() { 49 base::WeakPtr<UpdateRequestTask> GetWeakPtr() {
49 return weak_ptr_factory_.GetWeakPtr(); 50 return weak_ptr_factory_.GetWeakPtr();
50 } 51 }
51 52
52 private: 53 private:
53 // Store that this task updates. Not owned. 54 // Store that this task updates. Not owned.
54 RequestQueueStore* store_; 55 RequestQueueStore* store_;
55 // Request ID of the request to be started. 56 // Request ID of the request to be started.
56 int64_t request_id_; 57 int64_t request_id_;
57 // Callback to complete the task. 58 // Callback to complete the task.
58 RequestQueueStore::UpdateCallback callback_; 59 RequestQueueStore::UpdateCallback callback_;
59 60
60 base::WeakPtrFactory<UpdateRequestTask> weak_ptr_factory_; 61 base::WeakPtrFactory<UpdateRequestTask> weak_ptr_factory_;
61 DISALLOW_COPY_AND_ASSIGN(UpdateRequestTask); 62 DISALLOW_COPY_AND_ASSIGN(UpdateRequestTask);
62 }; 63 };
63 64
64 } // namespace offline_pages 65 } // namespace offline_pages
65 66
66 #endif // COMPONENTS_OFFLINE_PAGES_BACKGROUND_UPDATE_REQUEST_TASK_H_ 67 #endif // COMPONENTS_OFFLINE_PAGES_BACKGROUND_UPDATE_REQUEST_TASK_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698