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

Side by Side Diff: chromeos/dbus/update_engine_client.cc

Issue 2238763002: chromeos: Update update_engine D-Bus availability code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 months 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chromeos/dbus/update_engine_client.h" 5 #include "chromeos/dbus/update_engine_client.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 update_engine::kUpdateEngineServiceName, 224 update_engine::kUpdateEngineServiceName,
225 dbus::ObjectPath(update_engine::kUpdateEngineServicePath)); 225 dbus::ObjectPath(update_engine::kUpdateEngineServicePath));
226 update_engine_proxy_->ConnectToSignal( 226 update_engine_proxy_->ConnectToSignal(
227 update_engine::kUpdateEngineInterface, 227 update_engine::kUpdateEngineInterface,
228 update_engine::kStatusUpdate, 228 update_engine::kStatusUpdate,
229 base::Bind(&UpdateEngineClientImpl::StatusUpdateReceived, 229 base::Bind(&UpdateEngineClientImpl::StatusUpdateReceived,
230 weak_ptr_factory_.GetWeakPtr()), 230 weak_ptr_factory_.GetWeakPtr()),
231 base::Bind(&UpdateEngineClientImpl::StatusUpdateConnected, 231 base::Bind(&UpdateEngineClientImpl::StatusUpdateConnected,
232 weak_ptr_factory_.GetWeakPtr())); 232 weak_ptr_factory_.GetWeakPtr()));
233 update_engine_proxy_->WaitForServiceToBeAvailable( 233 update_engine_proxy_->WaitForServiceToBeAvailable(
234 base::Bind(&UpdateEngineClientImpl::OnProxyAvailabilityChanged, 234 base::Bind(&UpdateEngineClientImpl::OnServiceInitiallyAvailable,
235 weak_ptr_factory_.GetWeakPtr())); 235 weak_ptr_factory_.GetWeakPtr()));
236 } 236 }
237 237
238 private: 238 private:
239 void OnProxyAvailabilityChanged(bool service_is_available) { 239 void OnServiceInitiallyAvailable(bool service_is_available) {
240 if (service_is_available) { 240 if (service_is_available) {
241 // Get update engine status for the initial status. Update engine won't 241 // Get update engine status for the initial status. Update engine won't
242 // send StatusUpdate signal unless there is a status change. If chrome 242 // send StatusUpdate signal unless there is a status change. If chrome
243 // crashes after UPDATE_STATUS_UPDATED_NEED_REBOOT status is set, 243 // crashes after UPDATE_STATUS_UPDATED_NEED_REBOOT status is set,
244 // restarted chrome would not get this status. See crbug.com/154104. 244 // restarted chrome would not get this status. See crbug.com/154104.
245 GetUpdateEngineStatus(); 245 GetUpdateEngineStatus();
246 } else {
247 LOG(ERROR) << "Failed to wait for D-Bus service to become available";
246 } 248 }
247 } 249 }
248 250
249 void GetUpdateEngineStatus() { 251 void GetUpdateEngineStatus() {
250 dbus::MethodCall method_call( 252 dbus::MethodCall method_call(
251 update_engine::kUpdateEngineInterface, 253 update_engine::kUpdateEngineInterface,
252 update_engine::kGetStatus); 254 update_engine::kGetStatus);
253 update_engine_proxy_->CallMethodWithErrorCallback( 255 update_engine_proxy_->CallMethodWithErrorCallback(
254 &method_call, 256 &method_call,
255 dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, 257 dbus::ObjectProxy::TIMEOUT_USE_DEFAULT,
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after
613 const char** cix = std::find( 615 const char** cix = std::find(
614 kReleaseChannelsList, 616 kReleaseChannelsList,
615 kReleaseChannelsList + arraysize(kReleaseChannelsList), current_channel); 617 kReleaseChannelsList + arraysize(kReleaseChannelsList), current_channel);
616 const char** tix = std::find( 618 const char** tix = std::find(
617 kReleaseChannelsList, 619 kReleaseChannelsList,
618 kReleaseChannelsList + arraysize(kReleaseChannelsList), target_channel); 620 kReleaseChannelsList + arraysize(kReleaseChannelsList), target_channel);
619 return tix > cix; 621 return tix > cix;
620 } 622 }
621 623
622 } // namespace chromeos 624 } // namespace chromeos
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