| Index: chrome/browser/profiles/profile_io_data.h
|
| diff --git a/chrome/browser/profiles/profile_io_data.h b/chrome/browser/profiles/profile_io_data.h
|
| index bb1e049bc83159c91f6742b00dc882099c4e3cba..24ec39b6b914cf295bdd5d7003ebb23f23c6ea14 100644
|
| --- a/chrome/browser/profiles/profile_io_data.h
|
| +++ b/chrome/browser/profiles/profile_io_data.h
|
| @@ -6,23 +6,25 @@
|
| #define CHROME_BROWSER_PROFILES_PROFILE_IO_DATA_H_
|
| #pragma once
|
|
|
| +#include <set>
|
| #include "base/basictypes.h"
|
| +#include "base/debug/stack_trace.h"
|
| #include "base/file_path.h"
|
| #include "base/memory/ref_counted.h"
|
| #include "base/memory/scoped_ptr.h"
|
| +#include "base/synchronization/lock.h"
|
| #include "chrome/browser/net/chrome_url_request_context.h"
|
| #include "chrome/browser/profiles/profile.h"
|
| +#include "content/browser/resource_context.h"
|
| #include "net/base/cookie_monster.h"
|
|
|
| class CommandLine;
|
| class ChromeAppCacheService;
|
| class ChromeBlobStorageContext;
|
| -class ChromeURLRequestContext;
|
| -class ChromeURLRequestContextGetter;
|
| class ExtensionInfoMap;
|
| namespace fileapi {
|
| class FileSystemContext;
|
| -}
|
| +} // namespace fileapi
|
| class HostContentSettingsMap;
|
| class HostZoomMap;
|
| class IOThread;
|
| @@ -66,6 +68,7 @@ class ProfileIOData : public base::RefCountedThreadSafe<ProfileIOData> {
|
| scoped_refptr<ChromeURLRequestContext> GetIsolatedAppRequestContext(
|
| scoped_refptr<ChromeURLRequestContext> main_context,
|
| const std::string& app_id) const;
|
| + const content::ResourceContext& GetResourceContext() const;
|
|
|
| protected:
|
| friend class base::RefCountedThreadSafe<ProfileIOData>;
|
| @@ -84,6 +87,26 @@ class ProfileIOData : public base::RefCountedThreadSafe<ProfileIOData> {
|
| scoped_refptr<const ProfileIOData> profile_io_data_;
|
| };
|
|
|
| + class ProfileResourceContextGetter : public content::ResourceContextGetter {
|
| + public:
|
| + explicit ProfileResourceContextGetter(ProfileIOData* profile_io_data);
|
| + virtual ~ProfileResourceContextGetter();
|
| +
|
| +#ifndef NDEBUG
|
| + void PrintStacktrace() const;
|
| +#endif
|
| +
|
| + private:
|
| + virtual const content::ResourceContext& GetImpl();
|
| + ProfileIOData* const profile_io_data_;
|
| +
|
| +#ifndef NDEBUG
|
| + base::debug::StackTrace stacktrace_;
|
| +#endif
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(ProfileResourceContextGetter);
|
| + };
|
| +
|
| // Created on the UI thread, read on the IO thread during ProfileIOData lazy
|
| // initialization.
|
| struct ProfileParams {
|
| @@ -119,6 +142,10 @@ class ProfileIOData : public base::RefCountedThreadSafe<ProfileIOData> {
|
| explicit ProfileIOData(bool is_incognito);
|
| virtual ~ProfileIOData();
|
|
|
| + protected:
|
| + void set_resource_context(
|
| + const content::ResourceContext* resource_context) const;
|
| +
|
| // Static helper functions to assist in common operations executed by
|
| // subtypes.
|
|
|
| @@ -126,6 +153,7 @@ class ProfileIOData : public base::RefCountedThreadSafe<ProfileIOData> {
|
| static void ApplyProfileParamsToContext(const ProfileParams& profile_params,
|
| ChromeURLRequestContext* context);
|
|
|
| + private:
|
| // Lazy initializes the ProfileIOData object the first time a request context
|
| // is requested. The lazy logic is implemented here. The actual initialization
|
| // is done in LazyInitializeInternal(), implemented by subtypes. Static helper
|
| @@ -161,6 +189,12 @@ class ProfileIOData : public base::RefCountedThreadSafe<ProfileIOData> {
|
|
|
| mutable bool initialized_;
|
|
|
| + mutable scoped_ptr<const content::ResourceContext> resource_context_;
|
| +
|
| + // These members are used purely for debugging leaks.
|
| + base::Lock lock_;
|
| + std::set<const ProfileResourceContextGetter*> resource_context_getters_;
|
| +
|
| DISALLOW_COPY_AND_ASSIGN(ProfileIOData);
|
| };
|
|
|
|
|