summaryrefslogtreecommitdiffstats
path: root/components/component_updater
diff options
context:
space:
mode:
authorsorin <sorin@chromium.org>2015-11-11 11:35:35 -0800
committerCommit bot <commit-bot@chromium.org>2015-11-11 19:36:35 +0000
commit5081941b99d37952e1c60c9cb24257369d9c6416 (patch)
tree9a1a65bb4e12e3c40c46a8bc7f011e44246dcfb4 /components/component_updater
parent5001e48419392e97fce8ec2ab0872d7f80748ed1 (diff)
downloadchromium_src-5081941b99d37952e1c60c9cb24257369d9c6416.zip
chromium_src-5081941b99d37952e1c60c9cb24257369d9c6416.tar.gz
chromium_src-5081941b99d37952e1c60c9cb24257369d9c6416.tar.bz2
Change the update_client task runner behavior to continue on shutdown.
Historically, we've had issues with running the BITS COM client on threads and interfering with the browser shutdown. For reason not entirely understood, some out of process COM calls, and most common the call to enumerate BITS jobs appear to hang and consequently trigger the browser hang shutdown detector. At first, we had run this code on the FILE thread, then we had moved it on blocking pool threads. However, the net effect is that the hang moved as well. This change avoids blocking the shutdown by allowing the code to run after the browser shutdown until the OS terminates the thread as part of the process exit. While it is somehow difficult to reason about the correctness of the update_client code, this change is reasonably safe to make due to aspects of refcounting and containment of the update_client such as not accessing browser global state and refcounting the objects that are thread aware. BUG=552028 Review URL: https://codereview.chromium.org/1415933011 Cr-Commit-Position: refs/heads/master@{#359138}
Diffstat (limited to 'components/component_updater')
-rw-r--r--components/component_updater/component_updater_service.cc1
-rw-r--r--components/component_updater/component_updater_service_unittest.cc6
2 files changed, 7 insertions, 0 deletions
diff --git a/components/component_updater/component_updater_service.cc b/components/component_updater/component_updater_service.cc
index 29b120e..1c49d26 100644
--- a/components/component_updater/component_updater_service.cc
+++ b/components/component_updater/component_updater_service.cc
@@ -89,6 +89,7 @@ void CrxUpdateService::Stop() {
DCHECK(thread_checker_.CalledOnValidThread());
VLOG(1) << "CrxUpdateService stopping";
timer_.Stop();
+ update_client_->Stop();
}
// Adds a component to be checked for upgrades. If the component exists it
diff --git a/components/component_updater/component_updater_service_unittest.cc b/components/component_updater/component_updater_service_unittest.cc
index c44c63b..9d78eb8 100644
--- a/components/component_updater/component_updater_service_unittest.cc
+++ b/components/component_updater/component_updater_service_unittest.cc
@@ -71,6 +71,7 @@ class MockUpdateClient : public UpdateClient {
MOCK_CONST_METHOD2(GetCrxUpdateState,
bool(const std::string& id, CrxUpdateItem* update_item));
MOCK_CONST_METHOD1(IsUpdating, bool(const std::string& id));
+ MOCK_METHOD0(Stop, void());
private:
~MockUpdateClient() override;
@@ -190,12 +191,14 @@ void ComponentUpdaterTest::RunThreads() {
TEST_F(ComponentUpdaterTest, AddObserver) {
MockServiceObserver observer;
EXPECT_CALL(update_client(), AddObserver(&observer)).Times(1);
+ EXPECT_CALL(update_client(), Stop()).Times(1);
component_updater().AddObserver(&observer);
}
TEST_F(ComponentUpdaterTest, RemoveObserver) {
MockServiceObserver observer;
EXPECT_CALL(update_client(), RemoveObserver(&observer)).Times(1);
+ EXPECT_CALL(update_client(), Stop()).Times(1);
component_updater().RemoveObserver(&observer);
}
@@ -250,6 +253,7 @@ TEST_F(ComponentUpdaterTest, RegisterComponent) {
.WillRepeatedly(Invoke(&loop_handler, &LoopHandler::OnUpdate));
EXPECT_CALL(update_client(), IsUpdating(id1)).Times(1);
+ EXPECT_CALL(update_client(), Stop()).Times(1);
EXPECT_TRUE(component_updater().RegisterComponent(crx_component1));
EXPECT_TRUE(component_updater().RegisterComponent(crx_component2));
@@ -301,6 +305,7 @@ TEST_F(ComponentUpdaterTest, OnDemandUpdate) {
EXPECT_CALL(update_client(),
Install("jebgalgnebhfojomionfpkfelancnnkf", _, _))
.WillOnce(Invoke(&loop_handler, &LoopHandler::OnInstall));
+ EXPECT_CALL(update_client(), Stop()).Times(1);
EXPECT_TRUE(cus.RegisterComponent(crx_component));
EXPECT_TRUE(OnDemandTester::OnDemand(&cus, id));
@@ -345,6 +350,7 @@ TEST_F(ComponentUpdaterTest, MaybeThrottle) {
EXPECT_CALL(update_client(),
Install("jebgalgnebhfojomionfpkfelancnnkf", _, _))
.WillOnce(Invoke(&loop_handler, &LoopHandler::OnInstall));
+ EXPECT_CALL(update_client(), Stop()).Times(1);
EXPECT_TRUE(component_updater().RegisterComponent(crx_component));
component_updater().MaybeThrottle(