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

Unified Diff: components/keyed_service/core/keyed_service_factory.h

Issue 1165913002: [Cleanup] Used scoped pointers in KeyedServiceFactory's SetTestingFactory functions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Finish renaming profile -> context Created 5 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: components/keyed_service/core/keyed_service_factory.h
diff --git a/components/keyed_service/core/keyed_service_factory.h b/components/keyed_service/core/keyed_service_factory.h
index 9cc965bd1f24b461a20fc0b3495e9397a5f4ddc0..e2ef4b8b84b3980fe0c5efc7e487422aa8787cef 100644
--- a/components/keyed_service/core/keyed_service_factory.h
+++ b/components/keyed_service/core/keyed_service_factory.h
@@ -10,6 +10,7 @@
#include "base/basictypes.h"
#include "base/callback_forward.h"
#include "base/compiler_specific.h"
+#include "base/memory/scoped_ptr.h"
#include "components/keyed_service/core/keyed_service_base_factory.h"
#include "components/keyed_service/core/keyed_service_export.h"
@@ -32,7 +33,7 @@ class KEYED_SERVICE_EXPORT KeyedServiceFactory
// A function that supplies the instance of a KeyedService for a given
// |context|. This is used primarily for testing, where we want to feed
// a specific mock into the KeyedServiceFactory system.
- typedef KeyedService* (*TestingFactoryFunction)(
+ typedef scoped_ptr<KeyedService>(*TestingFactoryFunction)(
base::SupportsUserData* context);
// Associates |factory| with |context| so that |factory| is used to create
@@ -56,13 +57,14 @@ class KEYED_SERVICE_EXPORT KeyedServiceFactory
bool create);
// Maps |context| to |service| with debug checks to prevent duplication.
- void Associate(base::SupportsUserData* context, KeyedService* service);
+ void Associate(base::SupportsUserData* context,
+ scoped_ptr<KeyedService> service);
// Removes the mapping from |context| to a service.
void Disassociate(base::SupportsUserData* context);
// Returns a new KeyedService that will be associated with |context|.
- virtual KeyedService* BuildServiceInstanceFor(
+ virtual scoped_ptr<KeyedService> BuildServiceInstanceFor(
base::SupportsUserData* context) const = 0;
// Returns whether the |context| is off-the-record or not.

Powered by Google App Engine
This is Rietveld 408576698