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

Side by Side Diff: src/service.cc

Issue 3764005: cashew: Service: set "in progress" flag before requesting usage update (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/cashew.git
Patch Set: Created 10 years, 2 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 | Annotate | Revision Log
« 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) 2010 The Chromium OS Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium OS 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 "src/service.h" 5 #include "src/service.h"
6 6
7 #include <glog/logging.h> 7 #include <glog/logging.h>
8 8
9 #include "src/data_plan_provider.h" 9 #include "src/data_plan_provider.h"
10 #include "src/device.h" 10 #include "src/device.h"
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after
489 device_->GetCarrier().compare(Device::kCarrierUnknown)); 489 device_->GetCarrier().compare(Device::kCarrierUnknown));
490 490
491 if (request_in_progress_) { 491 if (request_in_progress_) {
492 return; 492 return;
493 } 493 }
494 494
495 // TODO(vlaviano): apply policy to determine if current connectivity state 495 // TODO(vlaviano): apply policy to determine if current connectivity state
496 // allows this request (e.g., if we can only make API requests over the 496 // allows this request (e.g., if we can only make API requests over the
497 // cellular service itself, is this service the default route?) 497 // cellular service itself, is this service the default route?)
498 498
499 request_in_progress_ = true;
499 if (!provider_->RequestUsageUpdate()) { 500 if (!provider_->RequestUsageUpdate()) {
500 DLOG(WARNING) << path_ << ": RequestUsageUpdate: request failed"; 501 DLOG(WARNING) << path_ << ": RequestUsageUpdate: request failed";
502 request_in_progress_ = false;
501 } else { 503 } else {
502 DLOG(INFO) << path_ << ": RequestUsageUpdate: request succeeded"; 504 DLOG(INFO) << path_ << ": RequestUsageUpdate: request succeeded";
503 request_in_progress_ = true;
504 } 505 }
505 } 506 }
506 507
507 void Service::CancelPendingRequests() { 508 void Service::CancelPendingRequests() {
508 if (provider_ != NULL && request_in_progress_) { 509 if (provider_ != NULL && request_in_progress_) {
509 provider_->CancelPendingRequests(); 510 provider_->CancelPendingRequests();
510 request_in_progress_ = false; 511 request_in_progress_ = false;
511 } 512 }
512 } 513 }
513 514
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
562 DestroyUpdateTimer(); 563 DestroyUpdateTimer();
563 CancelPendingRequests(); 564 CancelPendingRequests();
564 if (provider_ != NULL) { 565 if (provider_ != NULL) {
565 DLOG(INFO) << path_ << ": DeleteCarrierState: deleting data plan provider"; 566 DLOG(INFO) << path_ << ": DeleteCarrierState: deleting data plan provider";
566 delete provider_; 567 delete provider_;
567 provider_ = NULL; 568 provider_ = NULL;
568 } 569 }
569 } 570 }
570 571
571 } // namespace cashew 572 } // namespace cashew
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