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

Side by Side Diff: components/gcm_driver/gcm_channel_status_syncer.cc

Issue 774933004: Prefix CommandLine usage with base namespace (Part 9: components) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/gcm_driver/gcm_channel_status_syncer.h" 5 #include "components/gcm_driver/gcm_channel_status_syncer.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/location.h" 9 #include "base/location.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 custom_poll_interval_use_count_(0), 101 custom_poll_interval_use_count_(0),
102 delay_removed_for_testing_(false), 102 delay_removed_for_testing_(false),
103 weak_ptr_factory_(this) { 103 weak_ptr_factory_(this) {
104 gcm_enabled_ = prefs_->GetBoolean(kGCMChannelStatus); 104 gcm_enabled_ = prefs_->GetBoolean(kGCMChannelStatus);
105 poll_interval_seconds_ = prefs_->GetInteger(kGCMChannelPollIntervalSeconds); 105 poll_interval_seconds_ = prefs_->GetInteger(kGCMChannelPollIntervalSeconds);
106 if (poll_interval_seconds_ < 106 if (poll_interval_seconds_ <
107 GCMChannelStatusRequest::min_poll_interval_seconds()) { 107 GCMChannelStatusRequest::min_poll_interval_seconds()) {
108 poll_interval_seconds_ = 108 poll_interval_seconds_ =
109 GCMChannelStatusRequest::min_poll_interval_seconds(); 109 GCMChannelStatusRequest::min_poll_interval_seconds();
110 } 110 }
111 if (CommandLine::ForCurrentProcess()->HasSwitch( 111 const base::CommandLine& command_line =
112 switches::kCustomPollIntervalMinutes)) { 112 *base::CommandLine::ForCurrentProcess();
113 std::string value(CommandLine::ForCurrentProcess()->GetSwitchValueASCII( 113 if (command_line.HasSwitch(switches::kCustomPollIntervalMinutes)) {
114 std::string value(command_line.GetSwitchValueASCII(
114 switches::kCustomPollIntervalMinutes)); 115 switches::kCustomPollIntervalMinutes));
115 int minutes = 0; 116 int minutes = 0;
116 if (base::StringToInt(value, &minutes)) { 117 if (base::StringToInt(value, &minutes)) {
117 DCHECK_GE(minutes, kMinCustomPollIntervalMinutes); 118 DCHECK_GE(minutes, kMinCustomPollIntervalMinutes);
118 if (minutes >= kMinCustomPollIntervalMinutes) { 119 if (minutes >= kMinCustomPollIntervalMinutes) {
119 poll_interval_seconds_ = minutes * 60; 120 poll_interval_seconds_ = minutes * 60;
120 custom_poll_interval_use_count_ = kMaxNumberToUseCustomPollInterval; 121 custom_poll_interval_use_count_ = kMaxNumberToUseCustomPollInterval;
121 } 122 }
122 } 123 }
123 } 124 }
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 // Otherwise, add a fuzzing variation to the delay. 227 // Otherwise, add a fuzzing variation to the delay.
227 // The fuzzing variation is off when the custom interval is used. 228 // The fuzzing variation is off when the custom interval is used.
228 if (!custom_poll_interval_use_count_) 229 if (!custom_poll_interval_use_count_)
229 delay_seconds += base::RandInt(0, kGCMChannelRequestTimeJitterSeconds); 230 delay_seconds += base::RandInt(0, kGCMChannelRequestTimeJitterSeconds);
230 } 231 }
231 232
232 return base::TimeDelta::FromSeconds(delay_seconds); 233 return base::TimeDelta::FromSeconds(delay_seconds);
233 } 234 }
234 235
235 } // namespace gcm 236 } // namespace gcm
OLDNEW
« no previous file with comments | « components/feedback/feedback_uploader_chrome.cc ('k') | components/google/core/browser/google_url_tracker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698