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

Side by Side Diff: components/update_client/action_wait.cc

Issue 2453783002: Fix if statement condition in update_client/action_wait.cc (Closed)
Patch Set: 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "components/update_client/action_wait.h" 5 #include "components/update_client/action_wait.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/location.h" 9 #include "base/location.h"
10 #include "base/single_thread_task_runner.h" 10 #include "base/single_thread_task_runner.h"
(...skipping 19 matching lines...) Expand all
30 const bool result = base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( 30 const bool result = base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
31 FROM_HERE, base::Bind(&ActionWait::WaitComplete, base::Unretained(this)), 31 FROM_HERE, base::Bind(&ActionWait::WaitComplete, base::Unretained(this)),
32 time_delta_); 32 time_delta_);
33 33
34 if (!result) { 34 if (!result) {
35 // Move all items pending updates to the |kNoUpdate| state then return the 35 // Move all items pending updates to the |kNoUpdate| state then return the
36 // control flow to the update engine, as the updates in this context are 36 // control flow to the update engine, as the updates in this context are
37 // completed with an error. 37 // completed with an error.
38 while (!update_context->queue.empty()) { 38 while (!update_context->queue.empty()) {
39 auto* item = FindUpdateItemById(update_context->queue.front()); 39 auto* item = FindUpdateItemById(update_context->queue.front());
40 if (!item) { 40 DCHECK(item);
41 item->error_category = static_cast<int>(ErrorCategory::kServiceError); 41 item->error_category = static_cast<int>(ErrorCategory::kServiceError);
42 item->error_code = static_cast<int>(ServiceError::ERROR_WAIT); 42 item->error_code = static_cast<int>(ServiceError::ERROR_WAIT);
43 ChangeItemState(item, CrxUpdateItem::State::kNoUpdate); 43 ChangeItemState(item, CrxUpdateItem::State::kNoUpdate);
44 } else {
45 NOTREACHED();
46 }
47 update_context->queue.pop(); 44 update_context->queue.pop();
48 } 45 }
49 callback.Run(static_cast<int>(ServiceError::ERROR_WAIT)); 46 callback.Run(static_cast<int>(ServiceError::ERROR_WAIT));
50 } 47 }
51 48
52 NotifyObservers(UpdateClient::Observer::Events::COMPONENT_WAIT, 49 NotifyObservers(UpdateClient::Observer::Events::COMPONENT_WAIT,
53 update_context_->queue.front()); 50 update_context_->queue.front());
54 } 51 }
55 52
56 void ActionWait::WaitComplete() { 53 void ActionWait::WaitComplete() {
57 DCHECK(thread_checker_.CalledOnValidThread()); 54 DCHECK(thread_checker_.CalledOnValidThread());
58 UpdateCrx(); 55 UpdateCrx();
59 } 56 }
60 57
61 } // namespace update_client 58 } // namespace update_client
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698