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

Side by Side Diff: chrome/browser/extensions/api/runtime/chrome_runtime_api_delegate.cc

Issue 2733283002: Require explicit selection of traits for LazyInstance (Closed)
Patch Set: l10n again Created 3 years, 9 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
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 "chrome/browser/extensions/api/runtime/chrome_runtime_api_delegate.h" 5 #include "chrome/browser/extensions/api/runtime/chrome_runtime_api_delegate.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 // Returns the actual policy to use. 71 // Returns the actual policy to use.
72 static const net::BackoffEntry::Policy* Get(); 72 static const net::BackoffEntry::Policy* Get();
73 73
74 private: 74 private:
75 net::BackoffEntry::Policy policy_; 75 net::BackoffEntry::Policy policy_;
76 }; 76 };
77 77
78 // We use a LazyInstance since one of the the policy values references an 78 // We use a LazyInstance since one of the the policy values references an
79 // extern symbol, which would cause a static initializer to be generated if we 79 // extern symbol, which would cause a static initializer to be generated if we
80 // just declared the policy struct as a static variable. 80 // just declared the policy struct as a static variable.
81 base::LazyInstance<BackoffPolicy> g_backoff_policy = LAZY_INSTANCE_INITIALIZER; 81 base::LazyInstance<BackoffPolicy>::DestructorAtExit g_backoff_policy =
82 LAZY_INSTANCE_INITIALIZER;
82 83
83 BackoffPolicy::BackoffPolicy() { 84 BackoffPolicy::BackoffPolicy() {
84 policy_ = { 85 policy_ = {
85 // num_errors_to_ignore 86 // num_errors_to_ignore
86 0, 87 0,
87 88
88 // initial_delay_ms (note that we set 'always_use_initial_delay' to false 89 // initial_delay_ms (note that we set 'always_use_initial_delay' to false
89 // below) 90 // below)
90 1000 * extensions::kDefaultUpdateFrequencySeconds, 91 1000 * extensions::kDefaultUpdateFrequencySeconds,
91 92
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 const UpdateCheckResult& result) { 387 const UpdateCheckResult& result) {
387 auto it = update_check_info_.find(extension_id); 388 auto it = update_check_info_.find(extension_id);
388 if (it == update_check_info_.end()) 389 if (it == update_check_info_.end())
389 return; 390 return;
390 std::vector<UpdateCheckCallback> callbacks; 391 std::vector<UpdateCheckCallback> callbacks;
391 it->second.callbacks.swap(callbacks); 392 it->second.callbacks.swap(callbacks);
392 for (const auto& callback : callbacks) { 393 for (const auto& callback : callbacks) {
393 callback.Run(result); 394 callback.Run(result);
394 } 395 }
395 } 396 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698