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

Side by Side Diff: components/update_client/update_client_internal.h

Issue 1440393002: Reland of Change the update_client task runner behavior to continue on shutdown. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 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 COMPONENTS_UPDATE_CLIENT_UPDATE_CLIENT_INTERNAL_H_ 5 #ifndef COMPONENTS_UPDATE_CLIENT_UPDATE_CLIENT_INTERNAL_H_
6 #define COMPONENTS_UPDATE_CLIENT_UPDATE_CLIENT_INTERNAL_H_ 6 #define COMPONENTS_UPDATE_CLIENT_UPDATE_CLIENT_INTERNAL_H_
7 7
8 #include "components/update_client/update_client.h" 8 #include "components/update_client/update_client.h"
9 9
10 #include <queue> 10 #include <queue>
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 void RemoveObserver(Observer* observer) override; 45 void RemoveObserver(Observer* observer) override;
46 void Install(const std::string& id, 46 void Install(const std::string& id,
47 const CrxDataCallback& crx_data_callback, 47 const CrxDataCallback& crx_data_callback,
48 const CompletionCallback& completion_callback) override; 48 const CompletionCallback& completion_callback) override;
49 void Update(const std::vector<std::string>& ids, 49 void Update(const std::vector<std::string>& ids,
50 const CrxDataCallback& crx_data_callback, 50 const CrxDataCallback& crx_data_callback,
51 const CompletionCallback& completion_callback) override; 51 const CompletionCallback& completion_callback) override;
52 bool GetCrxUpdateState(const std::string& id, 52 bool GetCrxUpdateState(const std::string& id,
53 CrxUpdateItem* update_item) const override; 53 CrxUpdateItem* update_item) const override;
54 bool IsUpdating(const std::string& id) const override; 54 bool IsUpdating(const std::string& id) const override;
55 void Stop() override;
55 56
56 private: 57 private:
57 ~UpdateClientImpl() override; 58 ~UpdateClientImpl() override;
58 59
59 void RunTask(scoped_ptr<Task> task); 60 void RunTask(scoped_ptr<Task> task);
60 void OnTaskComplete(const CompletionCallback& completion_callback, 61 void OnTaskComplete(const CompletionCallback& completion_callback,
61 Task* task, 62 Task* task,
62 int error); 63 int error);
63 64
64 void NotifyObservers(Observer::Events event, const std::string& id); 65 void NotifyObservers(Observer::Events event, const std::string& id);
65 66
66 base::ThreadChecker thread_checker_; 67 base::ThreadChecker thread_checker_;
67 68
69 // True is Stop method has been called.
70 bool is_stopped_;
71
68 scoped_refptr<Configurator> config_; 72 scoped_refptr<Configurator> config_;
69 73
70 // Contains the tasks that are pending. In the current implementation, 74 // Contains the tasks that are pending. In the current implementation,
71 // only update tasks (background tasks) are queued up. These tasks are 75 // only update tasks (background tasks) are queued up. These tasks are
72 // pending while they are in this queue. They are not being handled for 76 // pending while they are in this queue. They have not been picked up yet
73 // the moment. 77 // by the update engine.
74 std::queue<Task*> task_queue_; 78 std::queue<Task*> task_queue_;
75 79
76 // Contains all tasks in progress. These are the tasks that the update engine 80 // Contains all tasks in progress. These are the tasks that the update engine
77 // is executing at one moment. Install tasks are run concurrently, update 81 // is executing at one moment. Install tasks are run concurrently, update
78 // tasks are always serialized, and update tasks are queued up if install 82 // tasks are always serialized, and update tasks are queued up if install
79 // tasks are running. In addition, concurrent install tasks for the same id 83 // tasks are running. In addition, concurrent install tasks for the same id
80 // are not allowed. 84 // are not allowed.
81 std::set<Task*> tasks_; 85 std::set<Task*> tasks_;
82 86
83 // TODO(sorin): try to make the ping manager an observer of the service. 87 // TODO(sorin): try to make the ping manager an observer of the service.
84 scoped_ptr<PingManager> ping_manager_; 88 scoped_ptr<PingManager> ping_manager_;
85 scoped_ptr<UpdateEngine> update_engine_; 89 scoped_ptr<UpdateEngine> update_engine_;
86 90
87 base::ObserverList<Observer> observer_list_; 91 base::ObserverList<Observer> observer_list_;
88 92
89 // Used to post responses back to the main thread.
90 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_;
91
92 // Used to execute blocking tasks.
93 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_;
94
95 DISALLOW_COPY_AND_ASSIGN(UpdateClientImpl); 93 DISALLOW_COPY_AND_ASSIGN(UpdateClientImpl);
96 }; 94 };
97 95
98 } // namespace update_client 96 } // namespace update_client
99 97
100 #endif // COMPONENTS_UPDATE_CLIENT_UPDATE_CLIENT_INTERNAL_H_ 98 #endif // COMPONENTS_UPDATE_CLIENT_UPDATE_CLIENT_INTERNAL_H_
OLDNEW
« no previous file with comments | « components/update_client/update_client.cc ('k') | extensions/browser/updater/update_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698