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

Side by Side Diff: chrome/browser/extensions/api/mdns/mdns_api.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/mdns/mdns_api.h" 5 #include "chrome/browser/extensions/api/mdns/mdns_api.h"
6 6
7 #include <utility> 7 #include <utility>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 if (dns_sd_registry_.get()) { 47 if (dns_sd_registry_.get()) {
48 dns_sd_registry_->RemoveObserver(this); 48 dns_sd_registry_->RemoveObserver(this);
49 } 49 }
50 } 50 }
51 51
52 // static 52 // static
53 MDnsAPI* MDnsAPI::Get(content::BrowserContext* context) { 53 MDnsAPI* MDnsAPI::Get(content::BrowserContext* context) {
54 return BrowserContextKeyedAPIFactory<MDnsAPI>::Get(context); 54 return BrowserContextKeyedAPIFactory<MDnsAPI>::Get(context);
55 } 55 }
56 56
57 static base::LazyInstance<BrowserContextKeyedAPIFactory<MDnsAPI> > g_factory = 57 static base::LazyInstance<
58 BrowserContextKeyedAPIFactory<MDnsAPI>>::DestructorAtExit g_factory =
58 LAZY_INSTANCE_INITIALIZER; 59 LAZY_INSTANCE_INITIALIZER;
59 60
60 // static 61 // static
61 BrowserContextKeyedAPIFactory<MDnsAPI>* MDnsAPI::GetFactoryInstance() { 62 BrowserContextKeyedAPIFactory<MDnsAPI>* MDnsAPI::GetFactoryInstance() {
62 return g_factory.Pointer(); 63 return g_factory.Pointer();
63 } 64 }
64 65
65 void MDnsAPI::SetDnsSdRegistryForTesting( 66 void MDnsAPI::SetDnsSdRegistryForTesting(
66 std::unique_ptr<DnsSdRegistry> dns_sd_registry) { 67 std::unique_ptr<DnsSdRegistry> dns_sd_registry) {
67 dns_sd_registry_ = std::move(dns_sd_registry); 68 dns_sd_registry_ = std::move(dns_sd_registry);
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 AsyncApiFunction::ResponseAction MdnsForceDiscoveryFunction::Run() { 267 AsyncApiFunction::ResponseAction MdnsForceDiscoveryFunction::Run() {
267 MDnsAPI* api = MDnsAPI::Get(browser_context()); 268 MDnsAPI* api = MDnsAPI::Get(browser_context());
268 if (!api) { 269 if (!api) {
269 return RespondNow(Error("Unknown error.")); 270 return RespondNow(Error("Unknown error."));
270 } 271 }
271 api->ForceDiscovery(); 272 api->ForceDiscovery();
272 return RespondNow(NoArguments()); 273 return RespondNow(NoArguments());
273 } 274 }
274 275
275 } // namespace extensions 276 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698