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

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

Issue 1419473005: Fix task concurrency in components/update_client (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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 void OnTaskComplete(const CompletionCallback& completion_callback, 58 void OnTaskComplete(const CompletionCallback& completion_callback,
59 Task* task, 59 Task* task,
60 int error); 60 int error);
61 61
62 void NotifyObservers(Observer::Events event, const std::string& id); 62 void NotifyObservers(Observer::Events event, const std::string& id);
63 63
64 base::ThreadChecker thread_checker_; 64 base::ThreadChecker thread_checker_;
65 65
66 scoped_refptr<Configurator> config_; 66 scoped_refptr<Configurator> config_;
67 67
68 // Contains the tasks that are queued up. 68 // Contains the tasks that are pending. In the current implementation,
69 // only update tasks (background tasks) are queued up. These tasks are
70 // pending while they are in this queue. They are not being handled for
71 // the moment.
69 std::queue<Task*> task_queue_; 72 std::queue<Task*> task_queue_;
70 73
71 // Contains all tasks in progress. 74 // Contains all tasks in progress. These are the tasks that the update engine
75 // is executing at one moment. Install tasks are run concurrently, update
76 // tasks are always serialized, and update tasks are queued up if install
77 // tasks are running. In addition, concurrent install tasks for the same id
78 // are not allowed.
72 std::set<Task*> tasks_; 79 std::set<Task*> tasks_;
73 80
74 // TODO(sorin): try to make the ping manager an observer of the service. 81 // TODO(sorin): try to make the ping manager an observer of the service.
75 scoped_ptr<PingManager> ping_manager_; 82 scoped_ptr<PingManager> ping_manager_;
76 scoped_ptr<UpdateEngine> update_engine_; 83 scoped_ptr<UpdateEngine> update_engine_;
77 84
78 base::ObserverList<Observer> observer_list_; 85 base::ObserverList<Observer> observer_list_;
79 86
80 // Used to post responses back to the main thread. 87 // Used to post responses back to the main thread.
81 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_; 88 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_;
82 89
83 // Used to execute blocking tasks. 90 // Used to execute blocking tasks.
84 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; 91 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_;
85 92
86 DISALLOW_COPY_AND_ASSIGN(UpdateClientImpl); 93 DISALLOW_COPY_AND_ASSIGN(UpdateClientImpl);
87 }; 94 };
88 95
89 } // namespace update_client 96 } // namespace update_client
90 97
91 #endif // COMPONENTS_UPDATE_CLIENT_UPDATE_CLIENT_INTERNAL_H_ 98 #endif // COMPONENTS_UPDATE_CLIENT_UPDATE_CLIENT_INTERNAL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698