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

Side by Side Diff: chrome/browser/extensions/activity_log/activity_log.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 (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/activity_log/activity_log.h" 5 #include "chrome/browser/extensions/activity_log/activity_log.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <set> 8 #include <set>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 } 380 }
381 381
382 private: 382 private:
383 std::set<const content::BrowserContext*> contexts_; 383 std::set<const content::BrowserContext*> contexts_;
384 std::set<std::string> whitelisted_ids_; 384 std::set<std::string> whitelisted_ids_;
385 base::Lock lock_; 385 base::Lock lock_;
386 386
387 DISALLOW_COPY_AND_ASSIGN(ActivityLogState); 387 DISALLOW_COPY_AND_ASSIGN(ActivityLogState);
388 }; 388 };
389 389
390 base::LazyInstance<ActivityLogState> g_activity_log_state = 390 base::LazyInstance<ActivityLogState>::DestructorAtExit g_activity_log_state =
391 LAZY_INSTANCE_INITIALIZER; 391 LAZY_INSTANCE_INITIALIZER;
392 392
393 // Returns the ActivityLog associated with the given |browser_context| after 393 // Returns the ActivityLog associated with the given |browser_context| after
394 // checking that |browser_context| is valid. 394 // checking that |browser_context| is valid.
395 ActivityLog* SafeGetActivityLog(content::BrowserContext* browser_context) { 395 ActivityLog* SafeGetActivityLog(content::BrowserContext* browser_context) {
396 DCHECK_CURRENTLY_ON(BrowserThread::UI); 396 DCHECK_CURRENTLY_ON(BrowserThread::UI);
397 // There's a chance that the |browser_context| was deleted some time during 397 // There's a chance that the |browser_context| was deleted some time during
398 // the thread hops. 398 // the thread hops.
399 // TODO(devlin): We should probably be doing this more extensively throughout 399 // TODO(devlin): We should probably be doing this more extensively throughout
400 // extensions code. 400 // extensions code.
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
526 DCHECK(!current_web_request_monitor || 526 DCHECK(!current_web_request_monitor ||
527 current_web_request_monitor == &LogWebRequestActivity); 527 current_web_request_monitor == &LogWebRequestActivity);
528 if (!current_web_request_monitor) 528 if (!current_web_request_monitor)
529 activity_monitor::SetWebRequestMonitor(&LogWebRequestActivity); 529 activity_monitor::SetWebRequestMonitor(&LogWebRequestActivity);
530 } 530 }
531 531
532 } // namespace 532 } // namespace
533 533
534 // SET THINGS UP. -------------------------------------------------------------- 534 // SET THINGS UP. --------------------------------------------------------------
535 535
536 static base::LazyInstance<BrowserContextKeyedAPIFactory<ActivityLog> > 536 static base::LazyInstance<
537 g_factory = LAZY_INSTANCE_INITIALIZER; 537 BrowserContextKeyedAPIFactory<ActivityLog>>::DestructorAtExit g_factory =
538 LAZY_INSTANCE_INITIALIZER;
538 539
539 BrowserContextKeyedAPIFactory<ActivityLog>* ActivityLog::GetFactoryInstance() { 540 BrowserContextKeyedAPIFactory<ActivityLog>* ActivityLog::GetFactoryInstance() {
540 return g_factory.Pointer(); 541 return g_factory.Pointer();
541 } 542 }
542 543
543 // static 544 // static
544 ActivityLog* ActivityLog::GetInstance(content::BrowserContext* context) { 545 ActivityLog* ActivityLog::GetInstance(content::BrowserContext* context) {
545 return ActivityLog::GetFactoryInstance()->Get( 546 return ActivityLog::GetFactoryInstance()->Get(
546 Profile::FromBrowserContext(context)); 547 Profile::FromBrowserContext(context));
547 } 548 }
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after
933 } 934 }
934 } 935 }
935 936
936 template <> 937 template <>
937 void BrowserContextKeyedAPIFactory<ActivityLog>::DeclareFactoryDependencies() { 938 void BrowserContextKeyedAPIFactory<ActivityLog>::DeclareFactoryDependencies() {
938 DependsOn(ExtensionsBrowserClient::Get()->GetExtensionSystemFactory()); 939 DependsOn(ExtensionsBrowserClient::Get()->GetExtensionSystemFactory());
939 DependsOn(ExtensionRegistryFactory::GetInstance()); 940 DependsOn(ExtensionRegistryFactory::GetInstance());
940 } 941 }
941 942
942 } // namespace extensions 943 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698