Index: content/public/browser/resource_context.h |
diff --git a/content/public/browser/resource_context.h b/content/public/browser/resource_context.h |
index 1308d7657b9136d3c4a36a73ffb22ba4afd2dda5..58eb298987bce1cfb5251d125b6a50a2ebda56a3 100644 |
--- a/content/public/browser/resource_context.h |
+++ b/content/public/browser/resource_context.h |
@@ -68,11 +68,29 @@ class CONTENT_EXPORT ResourceContext : public base::SupportsUserData { |
// resource metadata. |
virtual bool AllowCameraAccess(const GURL& origin) = 0; |
- // Returns a random salt string that is used for creating media device IDs. |
- // The salt should be stored in the current user profile and should be reset |
- // if cookies are cleared. Returns an empty string per default. |
- // TODO(perkj): Make this method pure virtual when crbug/315022 is fixed. |
- virtual std::string GetMediaDeviceIDSalt(); |
+ // Returns a callback that can be invoked to get a random salt |
+ // string that is used for creating media device IDs. The salt |
+ // should be stored in the current user profile and should be reset |
+ // if cookies are cleared. The default is an empty string. |
+ // |
+ // It is safe to hold on to the callback returned and use it without |
+ // regard to the lifetime of ResourceContext, although in general |
+ // you should not use it long after the profile has been destroyed. |
+ // |
+ // TODO(joi): We don't think it should be unnecessary to use this |
+ // after ResourceContext goes away. There is likely an underying bug |
+ // in the lifetime of ProfileIOData vs. ResourceProcessHost, where |
+ // sometimes ProfileIOData has gone away before RPH has finished |
+ // being torn down (on the IO thread). The current interface that |
+ // allows using the salt object after ResourceContext has gone away |
+ // was put in place to fix http://crbug.com/341211 but I intend to |
+ // try to figure out how the lifetime should be fixed properly. The |
+ // original interface was just a method that returns a string. |
+ // |
+ // TODO(perkj): Make this method pure virtual when crbug/315022 is |
+ // fixed. |
+ typedef base::Callback<std::string()> SaltCallback; |
+ virtual SaltCallback GetMediaDeviceIDSalt(); |
}; |
} // namespace content |