diff --git a/CHROMIUM_UPDATE.txt b/CHROMIUM_UPDATE.txt index 746f8fe99..d1eb19622 100644 --- a/CHROMIUM_UPDATE.txt +++ b/CHROMIUM_UPDATE.txt @@ -61,15 +61,5 @@ ], # Patterns that should not be found in the chromium/src directory after # applying patch files. - 'patterns': [ - { - # New instances of this static_cast are added to the Chromium sources with - # some regularity. If unfixed they will result in runtime crashes. - 'pattern': 'static_cast(', - 'exclude_matches': '^(.+?)test(.+?):', - 'message': 'New instances in non-test files should be converted to ' +\ - 'call StoragePartition methods.' +\ - '\nSee storage_partition_1973.patch.', - }, - ], + 'patterns': [], } diff --git a/libcef/browser/browser_host_impl.cc b/libcef/browser/browser_host_impl.cc index 1a260a0d5..795c90a78 100644 --- a/libcef/browser/browser_host_impl.cc +++ b/libcef/browser/browser_host_impl.cc @@ -316,11 +316,6 @@ CefRefPtr CefBrowserHostImpl::Create( request_context_impl->GetBrowserContext(); DCHECK(browser_context); - // A StoragePartitionImplMap must already exist for the BrowserContext. See - // additional comments in CefBrowserContext::Initialize(). - DCHECK(browser_context->GetUserData( - content::BrowserContext::GetStoragePartitionMapUserDataKey())); - if (!create_params.request_context) { // Using the global request context. create_params.request_context = request_context_impl.get(); diff --git a/libcef/browser/chrome_browser_process_stub.cc b/libcef/browser/chrome_browser_process_stub.cc index d186455ad..fafaa7c1c 100644 --- a/libcef/browser/chrome_browser_process_stub.cc +++ b/libcef/browser/chrome_browser_process_stub.cc @@ -27,14 +27,11 @@ ChromeBrowserProcessStub::ChromeBrowserProcessStub() : initialized_(false), context_initialized_(false), shutdown_(false), - locale_("en-US") { - chrome::SetBrowserContextIncognitoHelper(this); -} + locale_("en-US") {} ChromeBrowserProcessStub::~ChromeBrowserProcessStub() { DCHECK((!initialized_ && !context_initialized_) || shutdown_); g_browser_process = NULL; - chrome::SetBrowserContextIncognitoHelper(nullptr); } void ChromeBrowserProcessStub::Initialize() { @@ -385,15 +382,3 @@ ChromeBrowserProcessStub::pref_service_factory() const { NOTREACHED(); return NULL; } - -content::BrowserContext* -ChromeBrowserProcessStub::GetBrowserContextRedirectedInIncognito( - content::BrowserContext* context) { - return CefBrowserContext::GetForContext(context); -} - -content::BrowserContext* -ChromeBrowserProcessStub::GetBrowserContextOwnInstanceInIncognito( - content::BrowserContext* context) { - return GetBrowserContextRedirectedInIncognito(context); -} diff --git a/libcef/browser/chrome_browser_process_stub.h b/libcef/browser/chrome_browser_process_stub.h index 9e9d9c646..bd80637e9 100644 --- a/libcef/browser/chrome_browser_process_stub.h +++ b/libcef/browser/chrome_browser_process_stub.h @@ -15,7 +15,6 @@ #include "base/compiler_specific.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/extensions/event_router_forwarder.h" -#include "chrome/browser/profiles/incognito_helpers.h" #include "media/media_buildflags.h" class ChromeProfileManagerStub; @@ -29,8 +28,7 @@ class BackgroundModeManager { DISALLOW_COPY_AND_ASSIGN(BackgroundModeManager); }; -class ChromeBrowserProcessStub : public BrowserProcess, - public chrome::BrowserContextIncognitoHelper { +class ChromeBrowserProcessStub : public BrowserProcess { public: ChromeBrowserProcessStub(); ~ChromeBrowserProcessStub() override; @@ -109,12 +107,6 @@ class ChromeBrowserProcessStub : public BrowserProcess, override; prefs::InProcessPrefServiceFactory* pref_service_factory() const override; - // BrowserContextIncognitoHelper implementation. - content::BrowserContext* GetBrowserContextRedirectedInIncognito( - content::BrowserContext* context) override; - content::BrowserContext* GetBrowserContextOwnInstanceInIncognito( - content::BrowserContext* context) override; - private: bool initialized_; bool context_initialized_; diff --git a/libcef/browser/content_browser_client.cc b/libcef/browser/content_browser_client.cc index 0d7b9a4fd..fb23da1e1 100644 --- a/libcef/browser/content_browser_client.cc +++ b/libcef/browser/content_browser_client.cc @@ -696,13 +696,6 @@ CefContentBrowserClient::GetExtraServiceManifests() { return std::vector{GetCefRendererManifest()}; } -bool CefContentBrowserClient::IsSameBrowserContext( - content::BrowserContext* context1, - content::BrowserContext* context2) { - return CefBrowserContext::GetForContext(context1) == - CefBrowserContext::GetForContext(context2); -} - void CefContentBrowserClient::AppendExtraCommandLineSwitches( base::CommandLine* command_line, int child_process_id) { diff --git a/libcef/browser/content_browser_client.h b/libcef/browser/content_browser_client.h index c39f02f4c..7688b261f 100644 --- a/libcef/browser/content_browser_client.h +++ b/libcef/browser/content_browser_client.h @@ -59,8 +59,6 @@ class CefContentBrowserClient : public content::ContentBrowserClient { base::Optional GetServiceManifestOverlay( base::StringPiece name) override; std::vector GetExtraServiceManifests() override; - bool IsSameBrowserContext(content::BrowserContext* context1, - content::BrowserContext* context2) override; void AppendExtraCommandLineSwitches(base::CommandLine* command_line, int child_process_id) override; void AdjustUtilityServiceProcessCommandLine( diff --git a/libcef/browser/extensions/extensions_browser_client.cc b/libcef/browser/extensions/extensions_browser_client.cc index 756eb146c..ccee71b1b 100644 --- a/libcef/browser/extensions/extensions_browser_client.cc +++ b/libcef/browser/extensions/extensions_browser_client.cc @@ -65,14 +65,14 @@ bool CefExtensionsBrowserClient::AreExtensionsDisabled( } bool CefExtensionsBrowserClient::IsValidContext(BrowserContext* context) { - return CefBrowserContext::GetForContext(context) != NULL; + return GetOriginalContext(context) != NULL; } bool CefExtensionsBrowserClient::IsSameContext(BrowserContext* first, BrowserContext* second) { // Returns true if |first| and |second| share the same underlying // CefBrowserContext. - return GetCefImplContext(first) == GetCefImplContext(second); + return GetOriginalContext(first) == GetOriginalContext(second); } bool CefExtensionsBrowserClient::HasOffTheRecordContext( @@ -88,11 +88,6 @@ BrowserContext* CefExtensionsBrowserClient::GetOffTheRecordContext( BrowserContext* CefExtensionsBrowserClient::GetOriginalContext( BrowserContext* context) { - return GetCefImplContext(context); -} - -BrowserContext* CefExtensionsBrowserClient::GetCefImplContext( - BrowserContext* context) { return CefBrowserContext::GetForContext(context); } diff --git a/libcef/browser/extensions/extensions_browser_client.h b/libcef/browser/extensions/extensions_browser_client.h index e38126ab7..fe0513242 100644 --- a/libcef/browser/extensions/extensions_browser_client.h +++ b/libcef/browser/extensions/extensions_browser_client.h @@ -36,8 +36,6 @@ class CefExtensionsBrowserClient : public ExtensionsBrowserClient { content::BrowserContext* context) override; content::BrowserContext* GetOriginalContext( content::BrowserContext* context) override; - content::BrowserContext* GetCefImplContext( - content::BrowserContext* context) override; bool IsGuestSession(content::BrowserContext* context) const override; bool IsExtensionIncognitoEnabled( const std::string& extension_id, diff --git a/patch/patch.cfg b/patch/patch.cfg index 7b215dc02..cc5437ce2 100644 --- a/patch/patch.cfg +++ b/patch/patch.cfg @@ -165,11 +165,6 @@ patches = [ # https://bitbucket.org/chromiumembedded/cef/issue/1639 'name': 'service_manager_654986', }, - { - # Fix loading of the PDF extension with proxy BrowserContext. - # https://bitbucket.org/chromiumembedded/cef/issues/1710 - 'name': 'supports_user_data_1710', - }, { # Fix missing check for defined(ENABLE_THEMES) in # renderer_preferences_util.cc on Linux. @@ -237,7 +232,6 @@ patches = [ }, { # Make some methods of ProfileManager virtual. - # Allow CEF to intercept GetBrowserContext*InIncognito functions. 'name': 'chrome_browser_profiles', }, { @@ -255,16 +249,10 @@ patches = [ 'name': 'chrome_plugins', }, { - # Support StoragePartition proxy by: - # (a) Exposing UserData keys for objects owned by BrowserContext; - # (b) Adding BrowserContext::GetStoragePartitionProxy(); - # (c) Removing static_cast<> of StoragePartition to StoragePartitionImpl. - # https://bitbucket.org/chromiumembedded/cef/issues/1973 - # # Don't create databases, blob_storage or VideoDecodeStats directories when # cache_path is empty. # https://bitbucket.org/chromiumembedded/cef/issues/2289 - 'name': 'storage_partition_1973', + 'name': 'storage_incognito_2289', }, { # Fix plugin placeholder blocked message. @@ -272,9 +260,7 @@ patches = [ 'name': 'webview_plugin_2020', }, { - # Support WebUI by: - # (a) Exposing required UserData keys; - # (b) Removing dependency on non-NULL IOThread* object. + # Support WebUI by removing dependency on non-NULL IOThread* object. # https://bitbucket.org/chromiumembedded/cef/issues/2037 'name': 'webui_2037', }, @@ -349,10 +335,8 @@ patches = [ 'name': 'linux_gtk_2014', }, { - # Changes necessary to support for chrome extensions: - # (a) Add a new ExtensionHost constructor that allows CEF to create the - # WebContents. - # (b) Always create ProcessManager using CEF's BrowserContextImpl. + # Changes necessary to support for chrome extensions. Add a new + # ExtensionHost constructor that allows CEF to create the WebContents. # https://bitbucket.org/chromiumembedded/cef/issues/1947 # # Don't initialize PrerenderContents object in StreamsPrivateAPI. diff --git a/patch/patches/chrome_browser_profiles.patch b/patch/patches/chrome_browser_profiles.patch index 302a650f1..300072ad5 100644 --- a/patch/patches/chrome_browser_profiles.patch +++ b/patch/patches/chrome_browser_profiles.patch @@ -1,75 +1,3 @@ -diff --git chrome/browser/profiles/incognito_helpers.cc chrome/browser/profiles/incognito_helpers.cc -index a319237928b8..82945e3d625d 100644 ---- chrome/browser/profiles/incognito_helpers.cc -+++ chrome/browser/profiles/incognito_helpers.cc -@@ -8,20 +8,41 @@ - - namespace chrome { - -+namespace { -+BrowserContextIncognitoHelper* g_helper = nullptr; -+} // namespace -+ -+void SetBrowserContextIncognitoHelper(BrowserContextIncognitoHelper* helper) { -+ g_helper = helper; -+} -+ - content::BrowserContext* GetBrowserContextRedirectedInIncognito( - content::BrowserContext* context) { -+ if (g_helper) { -+ content::BrowserContext* new_context = -+ g_helper->GetBrowserContextRedirectedInIncognito(context); -+ if (new_context) -+ return new_context; -+ } -+ - return Profile::FromBrowserContext(context)->GetOriginalProfile(); - } - - const content::BrowserContext* GetBrowserContextRedirectedInIncognito( - const content::BrowserContext* context) { -- const Profile* profile = Profile::FromBrowserContext( -+ return GetBrowserContextRedirectedInIncognito( - const_cast(context)); -- return profile->GetOriginalProfile(); - } - - content::BrowserContext* GetBrowserContextOwnInstanceInIncognito( - content::BrowserContext* context) { -+ if (g_helper) { -+ content::BrowserContext* new_context = -+ g_helper->GetBrowserContextOwnInstanceInIncognito(context); -+ if (new_context) -+ return new_context; -+ } -+ - return context; - } - -diff --git chrome/browser/profiles/incognito_helpers.h chrome/browser/profiles/incognito_helpers.h -index e8e76ce5b954..1dd338dd0142 100644 ---- chrome/browser/profiles/incognito_helpers.h -+++ chrome/browser/profiles/incognito_helpers.h -@@ -11,6 +11,19 @@ class BrowserContext; - - namespace chrome { - -+class BrowserContextIncognitoHelper { -+ public: -+ virtual content::BrowserContext* GetBrowserContextRedirectedInIncognito( -+ content::BrowserContext* context) = 0; -+ virtual content::BrowserContext* GetBrowserContextOwnInstanceInIncognito( -+ content::BrowserContext* context) = 0; -+ protected: -+ virtual ~BrowserContextIncognitoHelper() {} -+}; -+ -+// Allow CEF to hook the below methods. -+void SetBrowserContextIncognitoHelper(BrowserContextIncognitoHelper* helper); -+ - // Returns the original browser context even for Incognito contexts. - content::BrowserContext* GetBrowserContextRedirectedInIncognito( - content::BrowserContext* context); diff --git chrome/browser/profiles/profile_manager.cc chrome/browser/profiles/profile_manager.cc index d66a0216832f..25c5ea80cb07 100644 --- chrome/browser/profiles/profile_manager.cc diff --git a/patch/patches/content_2015.patch b/patch/patches/content_2015.patch index 0bc821c12..ee9cf5819 100644 --- a/patch/patches/content_2015.patch +++ b/patch/patches/content_2015.patch @@ -82,22 +82,6 @@ index 1e912186c32c..38d03aafc8b0 100644 static_assert(WILL_FAIL_REQUEST < WILL_PROCESS_RESPONSE, "WillFailRequest state should come before WillProcessResponse"); return navigation_request_->render_frame_host(); -diff --git content/browser/frame_host/render_frame_host_impl.cc content/browser/frame_host/render_frame_host_impl.cc -index 21f84cc3f922..020017584cd9 100644 ---- content/browser/frame_host/render_frame_host_impl.cc -+++ content/browser/frame_host/render_frame_host_impl.cc -@@ -4777,9 +4777,9 @@ void RenderFrameHostImpl::CommitNavigation( - // factories. TODO(kinuko): Consider setting this up only when prefetch - // is used. Currently we have this here to make sure we have non-racy - // situation (https://crbug.com/849929). -- auto* storage_partition = static_cast( -+ auto* storage_partition = - BrowserContext::GetStoragePartition( -- GetSiteInstance()->GetBrowserContext(), GetSiteInstance())); -+ GetSiteInstance()->GetBrowserContext(), GetSiteInstance()); - base::PostTaskWithTraits( - FROM_HERE, {BrowserThread::IO}, - base::BindOnce(&PrefetchURLLoaderService::GetFactory, diff --git content/browser/frame_host/render_frame_message_filter.cc content/browser/frame_host/render_frame_message_filter.cc index 09095ba2dc8e..2fb0becabf88 100644 --- content/browser/frame_host/render_frame_message_filter.cc @@ -148,6 +132,19 @@ index 31aa4bc38442..0314343499d3 100644 if (stale) { // Refresh the plugins asynchronously. +diff --git content/browser/loader/navigation_url_loader_impl.cc content/browser/loader/navigation_url_loader_impl.cc +index 161ab06fa1dd..fddb3557b3c7 100644 +--- content/browser/loader/navigation_url_loader_impl.cc ++++ content/browser/loader/navigation_url_loader_impl.cc +@@ -1141,7 +1141,7 @@ class NavigationURLLoaderImpl::URLLoaderRequestController + // path does as well for navigations. + bool has_plugin = PluginService::GetInstance()->GetPluginInfo( + -1 /* render_process_id */, -1 /* render_frame_id */, resource_context_, +- resource_request_->url, url::Origin(), head.mime_type, ++ resource_request_->url, true, url::Origin(), head.mime_type, + false /* allow_wildcard */, &stale, &plugin, nullptr); + + if (stale) { diff --git content/browser/plugin_service_impl.cc content/browser/plugin_service_impl.cc index a599f989065f..115867edec92 100644 --- content/browser/plugin_service_impl.cc diff --git a/patch/patches/extensions_1947.patch b/patch/patches/extensions_1947.patch index 4072330a1..c9f1b6252 100644 --- a/patch/patches/extensions_1947.patch +++ b/patch/patches/extensions_1947.patch @@ -26,55 +26,11 @@ index 9e81f0a33ede..b796e79ae7ef 100644 auto* browser_context = web_contents->GetBrowserContext(); -diff --git content/browser/frame_host/render_frame_host_manager.cc content/browser/frame_host/render_frame_host_manager.cc -index cc7c7b4ffab5..24cab4f980a5 100644 ---- content/browser/frame_host/render_frame_host_manager.cc -+++ content/browser/frame_host/render_frame_host_manager.cc -@@ -967,10 +967,11 @@ bool RenderFrameHostManager::ShouldSwapBrowsingInstancesForNavigation( - // TODO(alexmos): This check should've been enforced earlier in the - // navigation, in chrome::Navigate(). Verify this, and then convert this to - // a CHECK and remove the fallback. -- DCHECK_EQ(browser_context, -- render_frame_host_->GetSiteInstance()->GetBrowserContext()); -- if (browser_context != -- render_frame_host_->GetSiteInstance()->GetBrowserContext()) { -+ const bool is_same = GetContentClient()->browser()->IsSameBrowserContext( -+ browser_context, -+ render_frame_host_->GetSiteInstance()->GetBrowserContext()); -+ DCHECK(is_same); -+ if (!is_same) { - return true; - } - -@@ -1109,7 +1110,8 @@ RenderFrameHostManager::GetSiteInstanceForNavigation( - - // Double-check that the new SiteInstance is associated with the right - // BrowserContext. -- DCHECK_EQ(new_instance->GetBrowserContext(), browser_context); -+ DCHECK(GetContentClient()->browser()->IsSameBrowserContext( -+ new_instance->GetBrowserContext(), browser_context)); - - // If |new_instance| is a new SiteInstance for a subframe that requires a - // dedicated process, set its process reuse policy so that such subframes are diff --git content/public/browser/content_browser_client.h content/public/browser/content_browser_client.h -index 7fc0a70f4e79..96a887d5e8e5 100644 +index 7fc0a70f4e79..7d9a334c06d4 100644 --- content/public/browser/content_browser_client.h +++ content/public/browser/content_browser_client.h -@@ -460,6 +460,13 @@ class CONTENT_EXPORT ContentBrowserClient { - // Returns true if error page should be isolated in its own process. - virtual bool ShouldIsolateErrorPage(bool in_main_frame); - -+ // Returns true if two browser contexts should be considered the same. CEF -+ // uses this to treat *Impl and *Proxy contexts as the same. -+ virtual bool IsSameBrowserContext(BrowserContext* context1, -+ BrowserContext* context2) { -+ return context1 == context2; -+ } -+ - // Returns true if the passed in URL should be assigned as the site of the - // current SiteInstance, if it does not yet have a site. - virtual bool ShouldAssignSiteForURL(const GURL& url); -@@ -1491,6 +1498,10 @@ class CONTENT_EXPORT ContentBrowserClient { +@@ -1491,6 +1491,10 @@ class CONTENT_EXPORT ContentBrowserClient { // Used as part of the user agent string. virtual std::string GetProduct() const; @@ -191,7 +147,7 @@ index 4027505469b8..de8258562bb2 100644 // A weak pointer to the current or pending RenderViewHost. We don't access // this through the host_contents because we want to deal with the pending diff --git extensions/browser/extensions_browser_client.h extensions/browser/extensions_browser_client.h -index 93dce1cad08c..fdb7ad2193d7 100644 +index 93dce1cad08c..1eef00b03063 100644 --- extensions/browser/extensions_browser_client.h +++ extensions/browser/extensions_browser_client.h @@ -62,6 +62,7 @@ class ComponentExtensionResourceManager; @@ -202,19 +158,7 @@ index 93dce1cad08c..fdb7ad2193d7 100644 class ExtensionHostDelegate; class ExtensionPrefsObserver; class ExtensionApiFrameIdMap; -@@ -134,6 +135,11 @@ class ExtensionsBrowserClient { - virtual content::BrowserContext* GetOriginalContext( - content::BrowserContext* context) = 0; - -+ // Returns the CEF *Impl context. Used in cases where we want special CEF -+ // handling without interfering with the side-by-side Chrome build. -+ virtual content::BrowserContext* GetCefImplContext( -+ content::BrowserContext* context) { return nullptr; } -+ - #if defined(OS_CHROMEOS) - // Returns a user id hash from |context| or an empty string if no hash could - // be extracted. -@@ -216,6 +222,14 @@ class ExtensionsBrowserClient { +@@ -216,6 +217,14 @@ class ExtensionsBrowserClient { virtual std::unique_ptr CreateExtensionHostDelegate() = 0; @@ -253,28 +197,3 @@ index 14fa00f41564..9487425a5627 100644 host->CreateRenderViewSoon(); OnBackgroundHostCreated(host); return true; -diff --git extensions/browser/process_manager_factory.cc extensions/browser/process_manager_factory.cc -index e8929c5da255..5ae43b4361a4 100644 ---- extensions/browser/process_manager_factory.cc -+++ extensions/browser/process_manager_factory.cc -@@ -5,6 +5,7 @@ - #include "extensions/browser/process_manager_factory.h" - - #include "components/keyed_service/content/browser_context_dependency_manager.h" -+#include "extensions/browser/extensions_browser_client.h" - #include "extensions/browser/extension_registry_factory.h" - #include "extensions/browser/lazy_background_task_queue_factory.h" - #include "extensions/browser/process_manager.h" -@@ -50,6 +51,12 @@ KeyedService* ProcessManagerFactory::BuildServiceInstanceFor( - - BrowserContext* ProcessManagerFactory::GetBrowserContextToUse( - BrowserContext* context) const { -+ // CEF wants all extension state routed to the *Impl context. -+ content::BrowserContext* cef_context = -+ ExtensionsBrowserClient::Get()->GetCefImplContext(context); -+ if (cef_context) -+ return cef_context; -+ - // ProcessManager::Create handles guest and incognito profiles, returning an - // IncognitoProcessManager in incognito mode. - return context; diff --git a/patch/patches/storage_incognito_2289.patch b/patch/patches/storage_incognito_2289.patch new file mode 100644 index 000000000..6a6fd1ec5 --- /dev/null +++ b/patch/patches/storage_incognito_2289.patch @@ -0,0 +1,80 @@ +diff --git content/browser/blob_storage/chrome_blob_storage_context.cc content/browser/blob_storage/chrome_blob_storage_context.cc +index 5610c0df1c7d..0f2ed42e6451 100644 +--- content/browser/blob_storage/chrome_blob_storage_context.cc ++++ content/browser/blob_storage/chrome_blob_storage_context.cc +@@ -117,7 +117,8 @@ ChromeBlobStorageContext* ChromeBlobStorageContext::GetFor( + + // If we're not incognito mode, schedule all of our file tasks to enable + // disk on the storage context. +- if (!context->IsOffTheRecord() && io_thread_valid) { ++ if (!context->GetPath().empty() && !context->IsOffTheRecord() && ++ io_thread_valid) { + file_task_runner = base::CreateTaskRunnerWithTraits( + {base::MayBlock(), base::TaskPriority::BEST_EFFORT, + base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN}); +diff --git content/browser/browser_context.cc content/browser/browser_context.cc +index b2b3920da3b0..686afc464b42 100644 +--- content/browser/browser_context.cc ++++ content/browser/browser_context.cc +@@ -56,6 +56,7 @@ + #include "content/public/common/content_switches.h" + #include "content/public/common/service_manager_connection.h" + #include "content/public/common/service_names.mojom.h" ++#include "media/capabilities/in_memory_video_decode_stats_db_impl.h" + #include "media/capabilities/video_decode_stats_db_impl.h" + #include "media/mojo/services/video_decode_perf_history.h" + #include "net/cookies/cookie_store.h" +@@ -211,7 +212,7 @@ StoragePartition* GetStoragePartitionFromConfig( + StoragePartitionImplMap* partition_map = + GetStoragePartitionMap(browser_context); + +- if (browser_context->IsOffTheRecord()) ++ if (browser_context->IsOffTheRecord() || browser_context->GetPath().empty()) + in_memory = true; + + return partition_map->Get(partition_domain, partition_name, in_memory, +@@ -790,9 +791,14 @@ media::VideoDecodePerfHistory* BrowserContext::GetVideoDecodePerfHistory() { + // occurs later upon first VideoDecodePerfHistory API request that requires DB + // access. DB operations will not block the UI thread. + if (!decode_history) { +- std::unique_ptr stats_db = +- media::VideoDecodeStatsDBImpl::Create( +- GetPath().Append(FILE_PATH_LITERAL("VideoDecodeStats"))); ++ std::unique_ptr stats_db; ++ if (GetPath().empty()) { ++ stats_db = ++ std::make_unique(nullptr); ++ } else { ++ stats_db = media::VideoDecodeStatsDBImpl::Create( ++ GetPath().Append(FILE_PATH_LITERAL("VideoDecodeStats"))); ++ } + auto new_decode_history = std::make_unique( + std::move(stats_db), BrowserFeatureProvider::GetFactoryCB()); + decode_history = new_decode_history.get(); +diff --git content/browser/renderer_host/render_process_host_impl.cc content/browser/renderer_host/render_process_host_impl.cc +index 221dc8424f85..0366d1682ca7 100644 +--- content/browser/renderer_host/render_process_host_impl.cc ++++ content/browser/renderer_host/render_process_host_impl.cc +@@ -2222,6 +2222,9 @@ void RenderProcessHostImpl::RegisterMojoInterfaces() { + plugin_registry_.reset( + new PluginRegistryImpl(GetBrowserContext()->GetResourceContext())); + } ++ // Needed for proper routing of IsPluginAvailable callbacks. ++ DCHECK_GE(GetID(), 0); ++ plugin_registry_->set_render_process_id(GetID()); + registry->AddInterface(base::BindRepeating( + &PluginRegistryImpl::Bind, base::Unretained(plugin_registry_.get()))); + #endif +diff --git storage/browser/database/database_tracker.cc storage/browser/database/database_tracker.cc +index 18f8b0a11438..a10ab23aaceb 100644 +--- storage/browser/database/database_tracker.cc ++++ storage/browser/database/database_tracker.cc +@@ -509,7 +509,7 @@ bool DatabaseTracker::LazyInit() { + meta_table_.reset(new sql::MetaTable()); + + is_initialized_ = +- base::CreateDirectory(db_dir_) && ++ (is_incognito_ ? true : base::CreateDirectory(db_dir_)) && + (db_->is_open() || + (is_incognito_ ? db_->OpenInMemory() : + db_->Open(kTrackerDatabaseFullPath))) && diff --git a/patch/patches/storage_partition_1973.patch b/patch/patches/storage_partition_1973.patch deleted file mode 100644 index 53cc8d41f..000000000 --- a/patch/patches/storage_partition_1973.patch +++ /dev/null @@ -1,1065 +0,0 @@ -diff --git content/browser/appcache/appcache_internals_ui.cc content/browser/appcache/appcache_internals_ui.cc -index d63844fe8e67..57c990dbb994 100644 ---- content/browser/appcache/appcache_internals_ui.cc -+++ content/browser/appcache/appcache_internals_ui.cc -@@ -386,8 +386,8 @@ void AppCacheInternalsUI::CreateProxyForPartition( - StoragePartition* storage_partition) { - scoped_refptr proxy = - new Proxy(weak_ptr_factory_.GetWeakPtr(), storage_partition->GetPath()); -- proxy->Initialize(static_cast(storage_partition) -- ->GetAppCacheService()); -+ proxy->Initialize(static_cast( -+ storage_partition->GetAppCacheService())); - appcache_proxies_.push_back(proxy); - } - -diff --git content/browser/background_fetch/background_fetch_service_impl.cc content/browser/background_fetch/background_fetch_service_impl.cc -index a19d29165970..aaf918cd4b71 100644 ---- content/browser/background_fetch/background_fetch_service_impl.cc -+++ content/browser/background_fetch/background_fetch_service_impl.cc -@@ -49,8 +49,7 @@ void BackgroundFetchServiceImpl::CreateForWorker( - FROM_HERE, {BrowserThread::IO}, - base::BindOnce( - BackgroundFetchServiceImpl::CreateOnIoThread, -- WrapRefCounted(static_cast( -- render_process_host->GetStoragePartition()) -+ WrapRefCounted(render_process_host->GetStoragePartition() - ->GetBackgroundFetchContext()), - origin, /* render_frame_tree_node_id= */ 0, - /* wc_getter= */ base::NullCallback(), std::move(request))); -@@ -81,8 +80,7 @@ void BackgroundFetchServiceImpl::CreateForFrame( - FROM_HERE, {BrowserThread::IO}, - base::BindOnce( - BackgroundFetchServiceImpl::CreateOnIoThread, -- WrapRefCounted(static_cast( -- render_process_host->GetStoragePartition()) -+ WrapRefCounted(render_process_host->GetStoragePartition() - ->GetBackgroundFetchContext()), - render_frame_host->GetLastCommittedOrigin(), - render_frame_host->GetFrameTreeNodeId(), std::move(wc_getter), -diff --git content/browser/blob_storage/chrome_blob_storage_context.cc content/browser/blob_storage/chrome_blob_storage_context.cc -index 5610c0df1c7d..6e039a0dc018 100644 ---- content/browser/blob_storage/chrome_blob_storage_context.cc -+++ content/browser/blob_storage/chrome_blob_storage_context.cc -@@ -88,6 +88,11 @@ class BlobHandleImpl : public BlobHandle { - - ChromeBlobStorageContext::ChromeBlobStorageContext() {} - -+// static -+const void* ChromeBlobStorageContext::GetUserDataKey() { -+ return kBlobStorageContextKeyName; -+} -+ - // static - ChromeBlobStorageContext* ChromeBlobStorageContext::GetFor( - BrowserContext* context) { -@@ -117,7 +122,8 @@ ChromeBlobStorageContext* ChromeBlobStorageContext::GetFor( - - // If we're not incognito mode, schedule all of our file tasks to enable - // disk on the storage context. -- if (!context->IsOffTheRecord() && io_thread_valid) { -+ if (!context->GetPath().empty() && !context->IsOffTheRecord() && -+ io_thread_valid) { - file_task_runner = base::CreateTaskRunnerWithTraits( - {base::MayBlock(), base::TaskPriority::BEST_EFFORT, - base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN}); -diff --git content/browser/blob_storage/chrome_blob_storage_context.h content/browser/blob_storage/chrome_blob_storage_context.h -index afd21be63a9a..8ac63336f6e7 100644 ---- content/browser/blob_storage/chrome_blob_storage_context.h -+++ content/browser/blob_storage/chrome_blob_storage_context.h -@@ -50,6 +50,8 @@ class CONTENT_EXPORT ChromeBlobStorageContext - public: - ChromeBlobStorageContext(); - -+ static const void* GetUserDataKey(); -+ - // Must be called on the UI thread. - static ChromeBlobStorageContext* GetFor( - BrowserContext* browser_context); -diff --git content/browser/bluetooth/web_bluetooth_service_impl.cc content/browser/bluetooth/web_bluetooth_service_impl.cc -index 6952610f8c88..fd8babeb99fd 100644 ---- content/browser/bluetooth/web_bluetooth_service_impl.cc -+++ content/browser/bluetooth/web_bluetooth_service_impl.cc -@@ -1554,9 +1554,9 @@ url::Origin WebBluetoothServiceImpl::GetOrigin() { - } - - BluetoothAllowedDevices& WebBluetoothServiceImpl::allowed_devices() { -- StoragePartitionImpl* partition = static_cast( -+ StoragePartition* partition = - BrowserContext::GetDefaultStoragePartition( -- web_contents()->GetBrowserContext())); -+ web_contents()->GetBrowserContext()); - scoped_refptr allowed_devices_map = - partition->GetBluetoothAllowedDevicesMap(); - return allowed_devices_map->GetOrCreateAllowedDevices(GetOrigin()); -diff --git content/browser/browser_context.cc content/browser/browser_context.cc -index b2b3920da3b0..134f8b20d9b7 100644 ---- content/browser/browser_context.cc -+++ content/browser/browser_context.cc -@@ -56,6 +56,7 @@ - #include "content/public/common/content_switches.h" - #include "content/public/common/service_manager_connection.h" - #include "content/public/common/service_names.mojom.h" -+#include "media/capabilities/in_memory_video_decode_stats_db_impl.h" - #include "media/capabilities/video_decode_stats_db_impl.h" - #include "media/mojo/services/video_decode_perf_history.h" - #include "net/cookies/cookie_store.h" -@@ -211,11 +212,18 @@ StoragePartition* GetStoragePartitionFromConfig( - StoragePartitionImplMap* partition_map = - GetStoragePartitionMap(browser_context); - -- if (browser_context->IsOffTheRecord()) -+ if (browser_context->IsOffTheRecord() || browser_context->GetPath().empty()) - in_memory = true; - -- return partition_map->Get(partition_domain, partition_name, in_memory, -- can_create); -+ StoragePartitionImpl* partition_impl = -+ partition_map->Get(partition_domain, partition_name, in_memory, -+ can_create); -+ if (partition_impl->browser_context() == browser_context) -+ return partition_impl; -+ -+ // |browser_context| is a CefBrowserContextProxy object. -+ return partition_impl->browser_context()-> -+ GetStoragePartitionProxy(browser_context, partition_impl); - } - - void SaveSessionStateOnIOThread( -@@ -741,6 +749,11 @@ ServiceManagerConnection* BrowserContext::GetServiceManagerConnectionFor( - BrowserContext::BrowserContext() - : unique_id_(base::UnguessableToken::Create().ToString()) {} - -+// static -+const void* BrowserContext::GetStoragePartitionMapUserDataKey() { -+ return kStoragePartitionMapKeyName; -+} -+ - BrowserContext::~BrowserContext() { - CHECK(GetUserData(kServiceInstanceGroup)) - << "Attempting to destroy a BrowserContext that never called " -@@ -790,9 +803,14 @@ media::VideoDecodePerfHistory* BrowserContext::GetVideoDecodePerfHistory() { - // occurs later upon first VideoDecodePerfHistory API request that requires DB - // access. DB operations will not block the UI thread. - if (!decode_history) { -- std::unique_ptr stats_db = -- media::VideoDecodeStatsDBImpl::Create( -- GetPath().Append(FILE_PATH_LITERAL("VideoDecodeStats"))); -+ std::unique_ptr stats_db; -+ if (GetPath().empty()) { -+ stats_db = -+ std::make_unique(nullptr); -+ } else { -+ stats_db = media::VideoDecodeStatsDBImpl::Create( -+ GetPath().Append(FILE_PATH_LITERAL("VideoDecodeStats"))); -+ } - auto new_decode_history = std::make_unique( - std::move(stats_db), BrowserFeatureProvider::GetFactoryCB()); - decode_history = new_decode_history.get(); -diff --git content/browser/devtools/protocol/background_service_handler.cc content/browser/devtools/protocol/background_service_handler.cc -index af047913e230..849eeddcfcc5 100644 ---- content/browser/devtools/protocol/background_service_handler.cc -+++ content/browser/devtools/protocol/background_service_handler.cc -@@ -49,8 +49,7 @@ void BackgroundServiceHandler::SetRenderer(int process_host_id, - return; - } - -- auto* storage_partition = -- static_cast(process_host->GetStoragePartition()); -+ auto* storage_partition = process_host->GetStoragePartition(); - devtools_context_ = storage_partition->GetDevToolsBackgroundServicesContext(); - DCHECK(devtools_context_); - } -diff --git content/browser/devtools/protocol/network_handler.cc content/browser/devtools/protocol/network_handler.cc -index 4fa2f08b626c..84c3be6138c0 100644 ---- content/browser/devtools/protocol/network_handler.cc -+++ content/browser/devtools/protocol/network_handler.cc -@@ -816,8 +816,8 @@ class BackgroundSyncRestorer { - scoped_refptr service_worker_host = - static_cast(host.get()); - scoped_refptr sync_context = -- static_cast(storage_partition_) -- ->GetBackgroundSyncContext(); -+ static_cast( -+ storage_partition_->GetBackgroundSyncContext()); - base::PostTaskWithTraits( - FROM_HERE, {BrowserThread::IO}, - base::BindOnce( -diff --git content/browser/devtools/protocol/service_worker_handler.cc content/browser/devtools/protocol/service_worker_handler.cc -index 34381dc45e10..960ba73c1ea8 100644 ---- content/browser/devtools/protocol/service_worker_handler.cc -+++ content/browser/devtools/protocol/service_worker_handler.cc -@@ -174,8 +174,7 @@ void ServiceWorkerHandler::SetRenderer(int process_host_id, - return; - } - -- storage_partition_ = -- static_cast(process_host->GetStoragePartition()); -+ storage_partition_ = process_host->GetStoragePartition(); - DCHECK(storage_partition_); - browser_context_ = process_host->GetBrowserContext(); - context_ = static_cast( -@@ -338,7 +337,8 @@ Response ServiceWorkerHandler::DispatchSyncEvent( - return CreateInvalidVersionIdErrorResponse(); - - BackgroundSyncContextImpl* sync_context = -- storage_partition_->GetBackgroundSyncContext(); -+ static_cast( -+ storage_partition_->GetBackgroundSyncContext()); - - base::PostTaskWithTraits(FROM_HERE, {BrowserThread::IO}, - base::BindOnce(&DispatchSyncEventOnIO, context_, -diff --git content/browser/devtools/protocol/service_worker_handler.h content/browser/devtools/protocol/service_worker_handler.h -index ec9ab86d0ca6..0fe5219f1e84 100644 ---- content/browser/devtools/protocol/service_worker_handler.h -+++ content/browser/devtools/protocol/service_worker_handler.h -@@ -24,7 +24,7 @@ class BrowserContext; - class RenderFrameHostImpl; - class ServiceWorkerContextWatcher; - class ServiceWorkerContextWrapper; --class StoragePartitionImpl; -+class StoragePartition; - - namespace protocol { - -@@ -74,7 +74,7 @@ class ServiceWorkerHandler : public DevToolsDomainHandler, - bool enabled_; - scoped_refptr context_watcher_; - BrowserContext* browser_context_; -- StoragePartitionImpl* storage_partition_; -+ StoragePartition* storage_partition_; - - base::WeakPtrFactory weak_factory_; - -diff --git content/browser/download/download_manager_impl.cc content/browser/download/download_manager_impl.cc -index 5ed0f15fe47b..5452066f9e73 100644 ---- content/browser/download/download_manager_impl.cc -+++ content/browser/download/download_manager_impl.cc -@@ -102,9 +102,9 @@ void DeleteDownloadedFileOnUIThread(const base::FilePath& file_path) { - } - #endif - --StoragePartitionImpl* GetStoragePartition(BrowserContext* context, -- int render_process_id, -- int render_frame_id) { -+StoragePartition* GetStoragePartition(BrowserContext* context, -+ int render_process_id, -+ int render_frame_id) { - DCHECK_CURRENTLY_ON(BrowserThread::UI); - - SiteInstance* site_instance = nullptr; -@@ -114,8 +114,7 @@ StoragePartitionImpl* GetStoragePartition(BrowserContext* context, - if (render_frame_host_) - site_instance = render_frame_host_->GetSiteInstance(); - } -- return static_cast( -- BrowserContext::GetStoragePartition(context, site_instance)); -+ return BrowserContext::GetStoragePartition(context, site_instance); - } - - void OnDownloadStarted( -@@ -273,7 +272,7 @@ base::FilePath GetTemporaryDownloadDirectory() { - #endif - - scoped_refptr --CreateDownloadURLLoaderFactoryGetter(StoragePartitionImpl* storage_partition, -+CreateDownloadURLLoaderFactoryGetter(StoragePartition* storage_partition, - RenderFrameHost* rfh, - bool is_download) { - network::mojom::URLLoaderFactoryPtrInfo proxy_factory_ptr_info; -@@ -308,7 +307,7 @@ CreateDownloadURLLoaderFactoryGetter(StoragePartitionImpl* storage_partition, - } - - return base::MakeRefCounted( -- storage_partition->url_loader_factory_getter(), -+ base::WrapRefCounted(storage_partition->url_loader_factory_getter()), - std::move(proxy_factory_ptr_info), std::move(proxy_factory_request)); - } - -@@ -1252,7 +1251,7 @@ void DownloadManagerImpl::InterceptNavigationOnChecksComplete( - tab_referrer_url = entry->GetReferrer().url; - } - } -- StoragePartitionImpl* storage_partition = -+ StoragePartition* storage_partition = - GetStoragePartition(browser_context_, render_process_id, render_frame_id); - in_progress_manager_->InterceptDownloadFromNavigation( - std::move(resource_request), render_process_id, render_frame_id, site_url, -@@ -1303,10 +1302,8 @@ void DownloadManagerImpl::BeginResourceDownloadOnChecksComplete( - base::MakeRefCounted( - rfh, params->url()); - } else if (rfh && params->url().SchemeIsFileSystem()) { -- StoragePartitionImpl* storage_partition = -- static_cast( -- BrowserContext::GetStoragePartitionForSite(browser_context_, -- site_url)); -+ StoragePartition* storage_partition = -+ BrowserContext::GetStoragePartitionForSite(browser_context_, site_url); - std::string storage_domain; - auto* site_instance = rfh->GetSiteInstance(); - if (site_instance) { -@@ -1350,10 +1347,8 @@ void DownloadManagerImpl::BeginResourceDownloadOnChecksComplete( - std::move(wrapper_factory)); - } - } else { -- StoragePartitionImpl* storage_partition = -- static_cast( -- BrowserContext::GetStoragePartitionForSite(browser_context_, -- site_url)); -+ StoragePartition* storage_partition = -+ BrowserContext::GetStoragePartitionForSite(browser_context_, site_url); - url_loader_factory_getter = - CreateDownloadURLLoaderFactoryGetter(storage_partition, rfh, true); - } -diff --git content/browser/loader/navigation_url_loader_impl.cc content/browser/loader/navigation_url_loader_impl.cc -index 161ab06fa1dd..f76c1a63362e 100644 ---- content/browser/loader/navigation_url_loader_impl.cc -+++ content/browser/loader/navigation_url_loader_impl.cc -@@ -1141,7 +1141,7 @@ class NavigationURLLoaderImpl::URLLoaderRequestController - // path does as well for navigations. - bool has_plugin = PluginService::GetInstance()->GetPluginInfo( - -1 /* render_process_id */, -1 /* render_frame_id */, resource_context_, -- resource_request_->url, url::Origin(), head.mime_type, -+ resource_request_->url, true, url::Origin(), head.mime_type, - false /* allow_wildcard */, &stale, &plugin, nullptr); - - if (stale) { -@@ -1505,7 +1505,7 @@ NavigationURLLoaderImpl::NavigationURLLoaderImpl( - CreateResourceRequest(request_info.get(), frame_tree_node_id, - IsNavigationDownloadAllowed(download_policy_)); - -- auto* partition = static_cast(storage_partition); -+ auto* partition = storage_partition; - scoped_refptr - signed_exchange_prefetch_metric_recorder = - partition->GetPrefetchURLLoaderService() -@@ -1753,7 +1753,7 @@ void NavigationURLLoaderImpl::SetURLLoaderFactoryInterceptorForTesting( - void NavigationURLLoaderImpl::CreateURLLoaderFactoryWithHeaderClient( - network::mojom::TrustedURLLoaderHeaderClientPtrInfo header_client, - network::mojom::URLLoaderFactoryRequest factory_request, -- StoragePartitionImpl* partition) { -+ StoragePartition* partition) { - DCHECK_CURRENTLY_ON(BrowserThread::UI); - network::mojom::URLLoaderFactoryParamsPtr params = - network::mojom::URLLoaderFactoryParams::New(); -diff --git content/browser/loader/navigation_url_loader_impl.h content/browser/loader/navigation_url_loader_impl.h -index b99335361248..72a281c12fc3 100644 ---- content/browser/loader/navigation_url_loader_impl.h -+++ content/browser/loader/navigation_url_loader_impl.h -@@ -97,7 +97,7 @@ class CONTENT_EXPORT NavigationURLLoaderImpl : public NavigationURLLoader { - static void CreateURLLoaderFactoryWithHeaderClient( - network::mojom::TrustedURLLoaderHeaderClientPtrInfo header_client, - network::mojom::URLLoaderFactoryRequest factory_request, -- StoragePartitionImpl* partition); -+ StoragePartition* partition); - - // Returns a Request ID for browser-initiated navigation requests. Called on - // the IO thread. -diff --git content/browser/payments/payment_app_installer.cc content/browser/payments/payment_app_installer.cc -index c2ee504cd0c7..422dc641d0a0 100644 ---- content/browser/payments/payment_app_installer.cc -+++ content/browser/payments/payment_app_installer.cc -@@ -132,9 +132,9 @@ class SelfDeleteInstaller - void SetPaymentAppIntoDatabase() { - DCHECK_CURRENTLY_ON(BrowserThread::UI); - -- StoragePartitionImpl* partition = static_cast( -+ StoragePartition* partition = - BrowserContext::GetDefaultStoragePartition( -- web_contents()->GetBrowserContext())); -+ web_contents()->GetBrowserContext()); - scoped_refptr payment_app_context = - partition->GetPaymentAppContext(); - -diff --git content/browser/payments/payment_app_provider_impl.cc content/browser/payments/payment_app_provider_impl.cc -index 9d3bee713440..38cc82d730a5 100644 ---- content/browser/payments/payment_app_provider_impl.cc -+++ content/browser/payments/payment_app_provider_impl.cc -@@ -367,10 +367,11 @@ void StartServiceWorkerForDispatch(BrowserContext* browser_context, - ServiceWorkerStartCallback callback) { - DCHECK_CURRENTLY_ON(BrowserThread::UI); - -- StoragePartitionImpl* partition = static_cast( -- BrowserContext::GetDefaultStoragePartition(browser_context)); -+ StoragePartition* partition = -+ BrowserContext::GetDefaultStoragePartition(browser_context); - scoped_refptr service_worker_context = -- partition->GetServiceWorkerContext(); -+ static_cast( -+ partition->GetServiceWorkerContext()); - - base::PostTaskWithTraits( - FROM_HERE, {BrowserThread::IO}, -@@ -444,8 +445,8 @@ void PaymentAppProviderImpl::GetAllPaymentApps( - GetAllPaymentAppsCallback callback) { - DCHECK_CURRENTLY_ON(BrowserThread::UI); - -- StoragePartitionImpl* partition = static_cast( -- BrowserContext::GetDefaultStoragePartition(browser_context)); -+ StoragePartition* partition = -+ BrowserContext::GetDefaultStoragePartition(browser_context); - scoped_refptr payment_app_context = - partition->GetPaymentAppContext(); - -diff --git content/browser/renderer_host/render_process_host_impl.cc content/browser/renderer_host/render_process_host_impl.cc -index 221dc8424f85..840a5533db90 100644 ---- content/browser/renderer_host/render_process_host_impl.cc -+++ content/browser/renderer_host/render_process_host_impl.cc -@@ -700,11 +700,10 @@ class DefaultSubframeProcessHostHolder : public base::SupportsUserData::Data, - // Gets the correct render process to use for this SiteInstance. - RenderProcessHost* GetProcessHost(SiteInstance* site_instance, - bool is_for_guests_only) { -- StoragePartitionImpl* default_partition = -- static_cast( -- BrowserContext::GetDefaultStoragePartition(browser_context_)); -- StoragePartitionImpl* partition = static_cast( -- BrowserContext::GetStoragePartition(browser_context_, site_instance)); -+ StoragePartition* default_partition = -+ BrowserContext::GetDefaultStoragePartition(browser_context_); -+ StoragePartition* partition = -+ BrowserContext::GetStoragePartition(browser_context_, site_instance); - - // Is this the default storage partition? If it isn't, then just give it its - // own non-shared process. -@@ -1433,7 +1432,7 @@ int RenderProcessHost::GetCurrentRenderProcessCountForTesting() { - // static - RenderProcessHost* RenderProcessHostImpl::CreateRenderProcessHost( - BrowserContext* browser_context, -- StoragePartitionImpl* storage_partition_impl, -+ StoragePartition* storage_partition_impl, - SiteInstance* site_instance, - bool is_for_guests_only) { - if (g_render_process_host_factory_) { -@@ -1442,8 +1441,8 @@ RenderProcessHost* RenderProcessHostImpl::CreateRenderProcessHost( - } - - if (!storage_partition_impl) { -- storage_partition_impl = static_cast( -- BrowserContext::GetStoragePartition(browser_context, site_instance)); -+ storage_partition_impl = -+ BrowserContext::GetStoragePartition(browser_context, site_instance); - } - // If we've made a StoragePartition for guests (e.g., for the tag), - // stash the Site URL on it. This way, when we start a service worker inside -@@ -1468,7 +1467,7 @@ const unsigned int RenderProcessHostImpl::kMaxFrameDepthForPriority = - - RenderProcessHostImpl::RenderProcessHostImpl( - BrowserContext* browser_context, -- StoragePartitionImpl* storage_partition_impl, -+ StoragePartition* storage_partition_impl, - bool is_for_guests_only) - : fast_shutdown_started_(false), - deleting_soon_(false), -@@ -1504,12 +1503,14 @@ RenderProcessHostImpl::RenderProcessHostImpl( - indexed_db_factory_( - new IndexedDBDispatcherHost( - id_, -- storage_partition_impl_->GetIndexedDBContext(), -+ static_cast( -+ storage_partition_impl_->GetIndexedDBContext()), - ChromeBlobStorageContext::GetFor(browser_context_)), - base::OnTaskRunnerDeleter( - storage_partition_impl_->GetIndexedDBContext()->TaskRunner())), - service_worker_dispatcher_host_(new ServiceWorkerDispatcherHost( -- storage_partition_impl_->GetServiceWorkerContext(), -+ static_cast( -+ storage_partition_impl_->GetServiceWorkerContext()), - id_)), - channel_connected_(false), - sent_render_process_ready_(false), -@@ -1542,7 +1543,8 @@ RenderProcessHostImpl::RenderProcessHostImpl( - } - - push_messaging_manager_.reset(new PushMessagingManager( -- GetID(), storage_partition_impl_->GetServiceWorkerContext())); -+ GetID(), static_cast( -+ storage_partition_impl_->GetServiceWorkerContext()))); - - AddObserver(indexed_db_factory_.get()); - AddObserver(service_worker_dispatcher_host_.get()); -@@ -1868,6 +1870,15 @@ void RenderProcessHostImpl::ResetChannelProxy() { - - void RenderProcessHostImpl::CreateMessageFilters() { - DCHECK_CURRENTLY_ON(BrowserThread::UI); -+ -+ // Cast to the derived type from StoragePartitionImpl. -+ auto app_cache_service = static_cast( -+ storage_partition_impl_->GetAppCacheService()); -+ auto dom_storage_context = static_cast( -+ storage_partition_impl_->GetDOMStorageContext()); -+ auto service_worker_context = static_cast( -+ storage_partition_impl_->GetServiceWorkerContext()); -+ - MediaInternals* media_internals = MediaInternals::GetInstance(); - // Add BrowserPluginMessageFilter to ensure it gets the first stab at messages - // from guests. -@@ -1907,10 +1918,10 @@ void RenderProcessHostImpl::CreateMessageFilters() { - media_request_context)); - - resource_message_filter_ = new ResourceMessageFilter( -- GetID(), storage_partition_impl_->GetAppCacheService(), -+ GetID(), app_cache_service, - blob_storage_context.get(), - storage_partition_impl_->GetFileSystemContext(), -- storage_partition_impl_->GetServiceWorkerContext(), -+ service_worker_context, - storage_partition_impl_->GetPrefetchURLLoaderService(), - browser_context->GetSharedCorsOriginAccessList(), - std::move(get_contexts_callback), -@@ -1919,8 +1930,7 @@ void RenderProcessHostImpl::CreateMessageFilters() { - AddFilter(resource_message_filter_.get()); - } - -- AddFilter(new DOMStorageMessageFilter( -- storage_partition_impl_->GetDOMStorageContext())); -+ AddFilter(new DOMStorageMessageFilter(dom_storage_context)); - - peer_connection_tracker_host_ = new PeerConnectionTrackerHost(GetID()); - AddFilter(peer_connection_tracker_host_.get()); -@@ -1937,10 +1947,6 @@ void RenderProcessHostImpl::CreateMessageFilters() { - - AddFilter(new TraceMessageFilter(GetID())); - AddFilter(new ResolveProxyMsgHelper(GetID())); -- -- scoped_refptr service_worker_context( -- static_cast( -- storage_partition_impl_->GetServiceWorkerContext())); - } - - void RenderProcessHostImpl::BindCacheStorage( -@@ -1952,7 +1958,8 @@ void RenderProcessHostImpl::BindCacheStorage( - cache_storage_dispatcher_host_ = - base::MakeRefCounted(); - cache_storage_dispatcher_host_->Init( -- storage_partition_impl_->GetCacheStorageContext()); -+ static_cast( -+ storage_partition_impl_->GetCacheStorageContext())); - } - // Send the binding to IO thread, because Cache Storage handles Mojo IPC on IO - // thread entirely. -@@ -2068,7 +2075,8 @@ void RenderProcessHostImpl::RegisterMojoInterfaces() { - base::BindRepeating( - &BackgroundSyncContextImpl::CreateService, - base::Unretained( -- storage_partition_impl_->GetBackgroundSyncContext()))); -+ static_cast( -+ storage_partition_impl_->GetBackgroundSyncContext())))); - AddUIThreadInterface( - registry.get(), - base::BindRepeating(&RenderProcessHostImpl::CreateStoragePartitionService, -@@ -2164,7 +2172,8 @@ void RenderProcessHostImpl::RegisterMojoInterfaces() { - - registry->AddInterface(base::BindRepeating( - &CodeCacheHostImpl::Create, GetID(), -- base::RetainedRef(storage_partition_impl_->GetCacheStorageContext()), -+ base::RetainedRef(static_cast( -+ storage_partition_impl_->GetCacheStorageContext())), - base::RetainedRef( - storage_partition_impl_->GetGeneratedCodeCacheContext()))); - -@@ -2176,7 +2185,8 @@ void RenderProcessHostImpl::RegisterMojoInterfaces() { - - registry->AddInterface(base::BindRepeating( - &ChromeAppCacheService::CreateBackend, -- base::Unretained(storage_partition_impl_->GetAppCacheService()), -+ base::Unretained(static_cast( -+ storage_partition_impl_->GetAppCacheService())), - GetID())); - - AddUIThreadInterface( -@@ -2222,6 +2232,9 @@ void RenderProcessHostImpl::RegisterMojoInterfaces() { - plugin_registry_.reset( - new PluginRegistryImpl(GetBrowserContext()->GetResourceContext())); - } -+ // Needed for proper routing of IsPluginAvailable callbacks. -+ DCHECK_GE(GetID(), 0); -+ plugin_registry_->set_render_process_id(GetID()); - registry->AddInterface(base::BindRepeating( - &PluginRegistryImpl::Bind, base::Unretained(plugin_registry_.get()))); - #endif -diff --git content/browser/renderer_host/render_process_host_impl.h content/browser/renderer_host/render_process_host_impl.h -index a746e1dae051..59e4316ab2ae 100644 ---- content/browser/renderer_host/render_process_host_impl.h -+++ content/browser/renderer_host/render_process_host_impl.h -@@ -101,7 +101,6 @@ class ServiceWorkerDispatcherHost; - class SiteInstance; - class SiteInstanceImpl; - class StoragePartition; --class StoragePartitionImpl; - struct ChildProcessTerminationInfo; - - typedef base::Thread* (*RendererMainThreadFactoryFunction)( -@@ -143,7 +142,7 @@ class CONTENT_EXPORT RenderProcessHostImpl - // null. - static RenderProcessHost* CreateRenderProcessHost( - BrowserContext* browser_context, -- StoragePartitionImpl* storage_partition_impl, -+ StoragePartition* storage_partition_impl, - SiteInstance* site_instance, - bool is_for_guests_only); - -@@ -518,7 +517,7 @@ class CONTENT_EXPORT RenderProcessHostImpl - // Use CreateRenderProcessHost() instead of calling this constructor - // directly. - RenderProcessHostImpl(BrowserContext* browser_context, -- StoragePartitionImpl* storage_partition_impl, -+ StoragePartition* storage_partition_impl, - bool is_for_guests_only); - - // Initializes a new IPC::ChannelProxy in |channel_|, which will be connected -@@ -787,10 +786,10 @@ class CONTENT_EXPORT RenderProcessHostImpl - // The globally-unique identifier for this RPH. - const int id_; - -- BrowserContext* const browser_context_; -+ BrowserContext* browser_context_; - - // Owned by |browser_context_|. -- StoragePartitionImpl* storage_partition_impl_; -+ StoragePartition* storage_partition_impl_; - - // Keeps track of the BindingIds returned by storage_partition_impl_->Bind() - // calls so we can Unbind() them on cleanup. -diff --git content/browser/renderer_interface_binders.cc content/browser/renderer_interface_binders.cc -index 8e4df0b15aeb..02bcdca69af9 100644 ---- content/browser/renderer_interface_binders.cc -+++ content/browser/renderer_interface_binders.cc -@@ -140,7 +140,7 @@ void RendererInterfaceBinders::InitializeParameterizedBinderRegistry() { - parameterized_binder_registry_.AddInterface( - base::Bind([](payments::mojom::PaymentManagerRequest request, - RenderProcessHost* host, const url::Origin& origin) { -- static_cast(host->GetStoragePartition()) -+ host->GetStoragePartition() - ->GetPaymentAppContext() - ->CreatePaymentManager(std::move(request)); - })); -@@ -173,23 +173,23 @@ void RendererInterfaceBinders::InitializeParameterizedBinderRegistry() { - parameterized_binder_registry_.AddInterface(base::BindRepeating( - [](blink::mojom::LockManagerRequest request, RenderProcessHost* host, - const url::Origin& origin) { -- static_cast(host->GetStoragePartition()) -+ host->GetStoragePartition() - ->GetLockManager() - ->CreateService(std::move(request), origin); - })); - parameterized_binder_registry_.AddInterface(base::BindRepeating( - [](blink::mojom::IdleManagerRequest request, RenderProcessHost* host, - const url::Origin& origin) { -- static_cast(host->GetStoragePartition()) -+ host->GetStoragePartition() - ->GetIdleManager() - ->CreateService(std::move(request), origin); - })); - parameterized_binder_registry_.AddInterface( - base::Bind([](blink::mojom::NotificationServiceRequest request, - RenderProcessHost* host, const url::Origin& origin) { -- static_cast(host->GetStoragePartition()) -- ->GetPlatformNotificationContext() -- ->CreateService(origin, std::move(request)); -+ static_cast( -+ host->GetStoragePartition()->GetPlatformNotificationContext()) -+ ->CreateService(origin, std::move(request)); - })); - parameterized_binder_registry_.AddInterface( - base::BindRepeating(&BackgroundFetchServiceImpl::CreateForWorker)); -@@ -200,7 +200,7 @@ void RendererInterfaceBinders::InitializeParameterizedBinderRegistry() { - parameterized_binder_registry_.AddInterface(base::BindRepeating( - [](blink::mojom::CookieStoreRequest request, RenderProcessHost* host, - const url::Origin& origin) { -- static_cast(host->GetStoragePartition()) -+ host->GetStoragePartition() - ->GetCookieStoreContext() - ->CreateService(std::move(request), origin); - })); -diff --git content/browser/storage_partition_impl.h content/browser/storage_partition_impl.h -index 84aa3aa2091f..86a3e1ff3206 100644 ---- content/browser/storage_partition_impl.h -+++ content/browser/storage_partition_impl.h -@@ -99,8 +99,8 @@ class CONTENT_EXPORT StoragePartitionImpl - storage::FileSystemContext* GetFileSystemContext() override; - storage::DatabaseTracker* GetDatabaseTracker() override; - DOMStorageContextWrapper* GetDOMStorageContext() override; -- IdleManager* GetIdleManager(); -- LockManager* GetLockManager(); // override; TODO: Add to interface -+ IdleManager* GetIdleManager() override; -+ LockManager* GetLockManager() override; - IndexedDBContextImpl* GetIndexedDBContext() override; - CacheStorageContextImpl* GetCacheStorageContext() override; - ServiceWorkerContextWrapper* GetServiceWorkerContext() override; -@@ -145,14 +145,15 @@ class CONTENT_EXPORT StoragePartitionImpl - void FlushNetworkInterfaceForTesting() override; - void WaitForDeletionTasksForTesting() override; - -- BackgroundFetchContext* GetBackgroundFetchContext(); -- PaymentAppContextImpl* GetPaymentAppContext(); -- BroadcastChannelProvider* GetBroadcastChannelProvider(); -- BluetoothAllowedDevicesMap* GetBluetoothAllowedDevicesMap(); -- BlobRegistryWrapper* GetBlobRegistry(); -- PrefetchURLLoaderService* GetPrefetchURLLoaderService(); -- CookieStoreContext* GetCookieStoreContext(); -- DevToolsBackgroundServicesContext* GetDevToolsBackgroundServicesContext(); -+ BackgroundFetchContext* GetBackgroundFetchContext() override; -+ PaymentAppContextImpl* GetPaymentAppContext() override; -+ BroadcastChannelProvider* GetBroadcastChannelProvider() override; -+ BluetoothAllowedDevicesMap* GetBluetoothAllowedDevicesMap() override; -+ BlobRegistryWrapper* GetBlobRegistry() override; -+ PrefetchURLLoaderService* GetPrefetchURLLoaderService() override; -+ CookieStoreContext* GetCookieStoreContext() override; -+ DevToolsBackgroundServicesContext* GetDevToolsBackgroundServicesContext() -+ override; - - // blink::mojom::StoragePartitionService interface. - void OpenLocalStorage(const url::Origin& origin, -@@ -169,21 +170,22 @@ class CONTENT_EXPORT StoragePartitionImpl - const GURL& origin, - OnCanSendDomainReliabilityUploadCallback callback) override; - -- scoped_refptr url_loader_factory_getter() { -- return url_loader_factory_getter_; -+ URLLoaderFactoryGetter* url_loader_factory_getter() override { -+ return url_loader_factory_getter_.get(); - } - - // Can return nullptr while |this| is being destroyed. -- BrowserContext* browser_context() const; -+ BrowserContext* browser_context() const override; - - // Called by each renderer process for each StoragePartitionService interface - // it binds in the renderer process. Returns the id of the created binding. - mojo::BindingId Bind( - int process_id, -- mojo::InterfaceRequest request); -+ mojo::InterfaceRequest request) -+ override; - - // Remove a binding created by a previous Bind() call. -- void Unbind(mojo::BindingId binding_id); -+ void Unbind(mojo::BindingId binding_id) override; - - auto& bindings_for_testing() { return bindings_; } - -@@ -194,10 +196,11 @@ class CONTENT_EXPORT StoragePartitionImpl - // one must use the "chrome-guest://blahblah" site URL to ensure that the - // service worker stays in this StoragePartition. This is an empty GURL if - // this StoragePartition is not for guests. -- void set_site_for_service_worker(const GURL& site_for_service_worker) { -+ void set_site_for_service_worker( -+ const GURL& site_for_service_worker) override { - site_for_service_worker_ = site_for_service_worker; - } -- const GURL& site_for_service_worker() const { -+ const GURL& site_for_service_worker() const override { - return site_for_service_worker_; - } - -diff --git content/browser/streams/stream_context.cc content/browser/streams/stream_context.cc -index 9ed67fe1550b..d0c791791c38 100644 ---- content/browser/streams/stream_context.cc -+++ content/browser/streams/stream_context.cc -@@ -23,6 +23,11 @@ namespace content { - - StreamContext::StreamContext() {} - -+// static -+const void* StreamContext::GetUserDataKey() { -+ return kStreamContextKeyName; -+} -+ - StreamContext* StreamContext::GetFor(BrowserContext* context) { - if (!context->GetUserData(kStreamContextKeyName)) { - scoped_refptr stream = new StreamContext(); -diff --git content/browser/streams/stream_context.h content/browser/streams/stream_context.h -index 075ae3e7431e..57fb5fd2c4a8 100644 ---- content/browser/streams/stream_context.h -+++ content/browser/streams/stream_context.h -@@ -29,6 +29,7 @@ class StreamContext - public: - StreamContext(); - -+ CONTENT_EXPORT static const void* GetUserDataKey(); - CONTENT_EXPORT static StreamContext* GetFor(BrowserContext* browser_context); - - void InitializeOnIOThread(); -diff --git content/browser/webui/web_ui_url_loader_factory.cc content/browser/webui/web_ui_url_loader_factory.cc -index 63fe0125ca1c..698378600723 100644 ---- content/browser/webui/web_ui_url_loader_factory.cc -+++ content/browser/webui/web_ui_url_loader_factory.cc -@@ -19,7 +19,6 @@ - #include "content/browser/blob_storage/chrome_blob_storage_context.h" - #include "content/browser/frame_host/render_frame_host_impl.h" - #include "content/browser/resource_context_impl.h" --#include "content/browser/storage_partition_impl.h" - #include "content/browser/webui/network_error_url_loader.h" - #include "content/browser/webui/url_data_manager_backend.h" - #include "content/browser/webui/url_data_source_impl.h" -@@ -27,6 +26,7 @@ - #include "content/public/browser/browser_task_traits.h" - #include "content/public/browser/browser_thread.h" - #include "content/public/browser/render_process_host.h" -+#include "content/public/browser/storage_partition.h" - #include "content/public/browser/web_contents.h" - #include "content/public/browser/web_contents_observer.h" - #include "content/public/common/url_constants.h" -@@ -314,9 +314,8 @@ class WebUIURLLoaderFactory : public network::mojom::URLLoaderFactory, - const std::string& scheme() const { return scheme_; } - - private: -- StoragePartitionImpl* GetStoragePartition() { -- return static_cast( -- render_frame_host_->GetProcess()->GetStoragePartition()); -+ StoragePartition* GetStoragePartition() { -+ return render_frame_host_->GetProcess()->GetStoragePartition(); - } - - RenderFrameHost* render_frame_host_; -diff --git content/browser/worker_host/dedicated_worker_host.cc content/browser/worker_host/dedicated_worker_host.cc -index d55172625502..22abdeec0c94 100644 ---- content/browser/worker_host/dedicated_worker_host.cc -+++ content/browser/worker_host/dedicated_worker_host.cc -@@ -76,8 +76,7 @@ class DedicatedWorkerHost : public service_manager::mojom::InterfaceProvider { - client->OnScriptLoadStartFailed(); - return; - } -- auto* storage_partition_impl = static_cast( -- render_process_host->GetStoragePartition()); -+ auto* storage_partition_impl = render_process_host->GetStoragePartition(); - - scoped_refptr blob_url_loader_factory; - if (script_url.SchemeIsBlob()) { -@@ -95,11 +94,13 @@ class DedicatedWorkerHost : public service_manager::mojom::InterfaceProvider { - } - - appcache_handle_ = std::make_unique( -- storage_partition_impl->GetAppCacheService(), process_id_); -+ static_cast( -+ storage_partition_impl->GetAppCacheService()), process_id_); - - WorkerScriptFetchInitiator::Start( - process_id_, script_url, request_initiator_origin, RESOURCE_TYPE_WORKER, -- storage_partition_impl->GetServiceWorkerContext(), -+ static_cast( -+ storage_partition_impl->GetServiceWorkerContext()), - appcache_handle_->core(), std::move(blob_url_loader_factory), - storage_partition_impl, - base::BindOnce(&DedicatedWorkerHost::DidStartScriptLoad, -diff --git content/browser/worker_host/shared_worker_connector_impl.cc content/browser/worker_host/shared_worker_connector_impl.cc -index 4b410f1384b0..299e9402b93d 100644 ---- content/browser/worker_host/shared_worker_connector_impl.cc -+++ content/browser/worker_host/shared_worker_connector_impl.cc -@@ -53,8 +53,8 @@ void SharedWorkerConnectorImpl::Connect( - host->GetBrowserContext(), std::move(blob_url_token)); - } - SharedWorkerServiceImpl* service = -- static_cast(host->GetStoragePartition()) -- ->GetSharedWorkerService(); -+ static_cast(host->GetStoragePartition() -+ ->GetSharedWorkerService()); - service->ConnectToWorker(process_id_, frame_id_, std::move(info), - std::move(client), creation_context_type, - blink::MessagePortChannel(std::move(message_port)), -diff --git content/browser/worker_host/worker_script_fetch_initiator.cc content/browser/worker_host/worker_script_fetch_initiator.cc -index 81453c24a3a0..ded1058db7e7 100644 ---- content/browser/worker_host/worker_script_fetch_initiator.cc -+++ content/browser/worker_host/worker_script_fetch_initiator.cc -@@ -11,11 +11,11 @@ - #include "base/macros.h" - #include "base/metrics/field_trial_params.h" - #include "base/task/post_task.h" -+#include "content/browser/appcache/appcache_host.h" - #include "content/browser/appcache/appcache_navigation_handle.h" - #include "content/browser/appcache/appcache_navigation_handle_core.h" - #include "content/browser/file_url_loader_factory.h" - #include "content/browser/service_worker/service_worker_context_wrapper.h" --#include "content/browser/storage_partition_impl.h" - #include "content/browser/url_loader_factory_getter.h" - #include "content/browser/web_contents/web_contents_impl.h" - #include "content/browser/worker_host/worker_script_fetcher.h" -@@ -31,6 +31,7 @@ - #include "content/public/browser/render_process_host.h" - #include "content/public/browser/resource_context.h" - #include "content/public/browser/shared_cors_origin_access_list.h" -+#include "content/public/browser/storage_partition.h" - #include "content/public/common/content_features.h" - #include "content/public/common/content_switches.h" - #include "content/public/common/origin_util.h" -@@ -54,7 +55,7 @@ void WorkerScriptFetchInitiator::Start( - scoped_refptr service_worker_context, - AppCacheNavigationHandleCore* appcache_handle_core, - scoped_refptr blob_url_loader_factory, -- StoragePartitionImpl* storage_partition, -+ StoragePartition* storage_partition, - CompletionCallback callback) { - DCHECK_CURRENTLY_ON(BrowserThread::UI); - DCHECK(storage_partition); -@@ -113,7 +114,7 @@ void WorkerScriptFetchInitiator::Start( - base::BindOnce( - &WorkerScriptFetchInitiator::CreateScriptLoaderOnIO, process_id, - std::move(resource_request), -- storage_partition->url_loader_factory_getter(), -+ base::WrapRefCounted(storage_partition->url_loader_factory_getter()), - std::move(factory_bundle_for_browser), - std::move(subresource_loader_factories), resource_context, - std::move(service_worker_context), appcache_handle_core, -@@ -124,7 +125,7 @@ void WorkerScriptFetchInitiator::Start( - std::unique_ptr - WorkerScriptFetchInitiator::CreateFactoryBundle( - int process_id, -- StoragePartitionImpl* storage_partition, -+ StoragePartition* storage_partition, - bool file_support) { - DCHECK_CURRENTLY_ON(BrowserThread::UI); - -diff --git content/browser/worker_host/worker_script_fetch_initiator.h content/browser/worker_host/worker_script_fetch_initiator.h -index d334e29ed59b..62e3101ac0ce 100644 ---- content/browser/worker_host/worker_script_fetch_initiator.h -+++ content/browser/worker_host/worker_script_fetch_initiator.h -@@ -35,7 +35,7 @@ class BrowserContext; - class ResourceContext; - class ServiceWorkerContextWrapper; - class ServiceWorkerObjectHost; --class StoragePartitionImpl; -+class StoragePartition; - class URLLoaderFactoryGetter; - struct SubresourceLoaderParams; - -@@ -63,14 +63,14 @@ class WorkerScriptFetchInitiator { - scoped_refptr service_worker_context, - AppCacheNavigationHandleCore* appcache_handle_core, - scoped_refptr blob_url_loader_factory, -- StoragePartitionImpl* storage_partition, -+ StoragePartition* storage_partition, - CompletionCallback callback); - - private: - // Creates a loader factory bundle. Must be called on the UI thread. - static std::unique_ptr CreateFactoryBundle( - int process_id, -- StoragePartitionImpl* storage_partition, -+ StoragePartition* storage_partition, - bool file_support); - - // Adds additional request headers to |resource_request|. Must be called on -diff --git content/public/browser/browser_context.h content/public/browser/browser_context.h -index 0a6913f2ca56..31bda5a84c31 100644 ---- content/public/browser/browser_context.h -+++ content/public/browser/browser_context.h -@@ -227,6 +227,8 @@ class CONTENT_EXPORT BrowserContext : public base::SupportsUserData { - - BrowserContext(); - -+ static const void* GetStoragePartitionMapUserDataKey(); -+ - ~BrowserContext() override; - - // Shuts down the storage partitions associated to this browser context. -@@ -362,6 +364,13 @@ class CONTENT_EXPORT BrowserContext : public base::SupportsUserData { - virtual download::InProgressDownloadManager* - RetriveInProgressDownloadManager(); - -+ // CEF returns a proxy object that forwards method calls to |partition_impl|. -+ virtual content::StoragePartition* GetStoragePartitionProxy( -+ BrowserContext* browser_context, -+ content::StoragePartition* partition_impl) { -+ NOTREACHED(); -+ return nullptr; -+ } - private: - const std::string unique_id_; - bool was_notify_will_be_destroyed_called_ = false; -diff --git content/public/browser/storage_partition.h content/public/browser/storage_partition.h -index f3bf35ed1ff7..8059c07a44f2 100644 ---- content/public/browser/storage_partition.h -+++ content/public/browser/storage_partition.h -@@ -14,8 +14,10 @@ - #include "base/files/file_path.h" - #include "base/time/time.h" - #include "content/common/content_export.h" -+#include "mojo/public/cpp/bindings/binding_set.h" - #include "services/network/public/cpp/shared_url_loader_factory.h" - #include "services/network/public/mojom/cookie_manager.mojom-forward.h" -+#include "third_party/blink/public/mojom/dom_storage/storage_partition_service.mojom.h" - - class GURL; - -@@ -60,12 +62,29 @@ class PlatformNotificationContext; - class ServiceWorkerContext; - class SharedWorkerService; - -+class BackgroundFetchContext; -+class BlobRegistryWrapper; -+class BlobURLLoaderFactory; -+class BluetoothAllowedDevicesMap; -+class BroadcastChannelProvider; -+class CookieStoreContext; -+class DevToolsBackgroundServicesContext; -+class IdleManager; -+class LockManager; -+class PaymentAppContextImpl; -+class PrefetchURLLoaderService; -+class URLLoaderFactoryGetter; -+ - #if !defined(OS_ANDROID) - class HostZoomLevelContext; - class HostZoomMap; - class ZoomLevelDelegate; - #endif // !defined(OS_ANDROID) - -+namespace mojom { -+class StoragePartitionService; -+} -+ - // Defines what persistent state a child process can access. - // - // The StoragePartition defines the view each child process has of the -@@ -106,6 +125,8 @@ class CONTENT_EXPORT StoragePartition { - virtual storage::FileSystemContext* GetFileSystemContext() = 0; - virtual storage::DatabaseTracker* GetDatabaseTracker() = 0; - virtual DOMStorageContext* GetDOMStorageContext() = 0; -+ virtual IdleManager* GetIdleManager() = 0; -+ virtual LockManager* GetLockManager() = 0; - virtual IndexedDBContext* GetIndexedDBContext() = 0; - virtual ServiceWorkerContext* GetServiceWorkerContext() = 0; - virtual SharedWorkerService* GetSharedWorkerService() = 0; -@@ -241,6 +262,29 @@ class CONTENT_EXPORT StoragePartition { - // Wait until all deletions tasks are finished. For test use only. - virtual void WaitForDeletionTasksForTesting() = 0; - -+ virtual BackgroundFetchContext* GetBackgroundFetchContext() = 0; -+ virtual PaymentAppContextImpl* GetPaymentAppContext() = 0; -+ virtual BroadcastChannelProvider* GetBroadcastChannelProvider() = 0; -+ virtual BluetoothAllowedDevicesMap* GetBluetoothAllowedDevicesMap() = 0; -+ virtual BlobRegistryWrapper* GetBlobRegistry() = 0; -+ virtual PrefetchURLLoaderService* GetPrefetchURLLoaderService() = 0; -+ virtual CookieStoreContext* GetCookieStoreContext() = 0; -+ virtual DevToolsBackgroundServicesContext* -+ GetDevToolsBackgroundServicesContext() = 0; -+ -+ virtual URLLoaderFactoryGetter* url_loader_factory_getter() = 0; -+ virtual BrowserContext* browser_context() const = 0; -+ -+ virtual mojo::BindingId Bind( -+ int process_id, -+ mojo::InterfaceRequest request) = 0; -+ -+ virtual void Unbind(mojo::BindingId binding_id) = 0; -+ -+ virtual void set_site_for_service_worker( -+ const GURL& site_for_service_worker) = 0; -+ virtual const GURL& site_for_service_worker() const = 0; -+ - protected: - virtual ~StoragePartition() {} - }; -diff --git storage/browser/database/database_tracker.cc storage/browser/database/database_tracker.cc -index 18f8b0a11438..a10ab23aaceb 100644 ---- storage/browser/database/database_tracker.cc -+++ storage/browser/database/database_tracker.cc -@@ -509,7 +509,7 @@ bool DatabaseTracker::LazyInit() { - meta_table_.reset(new sql::MetaTable()); - - is_initialized_ = -- base::CreateDirectory(db_dir_) && -+ (is_incognito_ ? true : base::CreateDirectory(db_dir_)) && - (db_->is_open() || - (is_incognito_ ? db_->OpenInMemory() : - db_->Open(kTrackerDatabaseFullPath))) && diff --git a/patch/patches/supports_user_data_1710.patch b/patch/patches/supports_user_data_1710.patch deleted file mode 100644 index ef4191f0d..000000000 --- a/patch/patches/supports_user_data_1710.patch +++ /dev/null @@ -1,17 +0,0 @@ -diff --git base/supports_user_data.h base/supports_user_data.h -index 356c97329b8d..8fce524d7572 100644 ---- base/supports_user_data.h -+++ base/supports_user_data.h -@@ -38,9 +38,9 @@ class BASE_EXPORT SupportsUserData { - // This object will TAKE OWNERSHIP of the given data pointer, and will - // delete the object if it is changed or the object is destroyed. - // |key| must not be null--that value is too vulnerable for collision. -- Data* GetUserData(const void* key) const; -- void SetUserData(const void* key, std::unique_ptr data); -- void RemoveUserData(const void* key); -+ virtual Data* GetUserData(const void* key) const; -+ virtual void SetUserData(const void* key, std::unique_ptr data); -+ virtual void RemoveUserData(const void* key); - - // SupportsUserData is not thread-safe, and on debug build will assert it is - // only used on one execution sequence. Calling this method allows the caller diff --git a/patch/patches/webui_2037.patch b/patch/patches/webui_2037.patch index c895135e9..65953f4e9 100644 --- a/patch/patches/webui_2037.patch +++ b/patch/patches/webui_2037.patch @@ -59,60 +59,3 @@ index 14b789a35c34..19a1f340a101 100644 content::BrowserContext* context = render_process_host->GetBrowserContext(); extensions::ExtensionRegistry* extension_registry = -diff --git content/browser/resource_context_impl.cc content/browser/resource_context_impl.cc -index 261e9343b8a2..0fe566c705a4 100644 ---- content/browser/resource_context_impl.cc -+++ content/browser/resource_context_impl.cc -@@ -56,6 +56,10 @@ URLDataManagerBackend* GetURLDataManagerForResourceContext( - context->GetUserData(kURLDataManagerBackendKeyName)); - } - -+const void* GetURLDataManagerBackendUserDataKey() { -+ return kURLDataManagerBackendKeyName; -+} -+ - void InitializeResourceContext(BrowserContext* browser_context) { - ResourceContext* resource_context = browser_context->GetResourceContext(); - -diff --git content/browser/resource_context_impl.h content/browser/resource_context_impl.h -index 903cc543a242..5bd30ae82974 100644 ---- content/browser/resource_context_impl.h -+++ content/browser/resource_context_impl.h -@@ -28,6 +28,8 @@ CONTENT_EXPORT StreamContext* GetStreamContextForResourceContext( - URLDataManagerBackend* GetURLDataManagerForResourceContext( - ResourceContext* context); - -+CONTENT_EXPORT const void* GetURLDataManagerBackendUserDataKey(); -+ - // Initialize the above data on the ResourceContext from a given BrowserContext. - CONTENT_EXPORT void InitializeResourceContext(BrowserContext* browser_context); - -diff --git content/browser/webui/url_data_manager.cc content/browser/webui/url_data_manager.cc -index a7653565bbf0..7ebf6dd857c9 100644 ---- content/browser/webui/url_data_manager.cc -+++ content/browser/webui/url_data_manager.cc -@@ -157,6 +157,11 @@ void URLDataManager::UpdateWebUIDataSource( - ->UpdateWebUIDataSource(source_name, std::move(update)); - } - -+// static -+const void* URLDataManager::GetUserDataKey() { -+ return kURLDataManagerKeyName; -+} -+ - // static - bool URLDataManager::IsScheduledForDeletion( - const URLDataSourceImpl* data_source) { -diff --git content/browser/webui/url_data_manager.h content/browser/webui/url_data_manager.h -index 95cff69e1b42..7fd849867829 100644 ---- content/browser/webui/url_data_manager.h -+++ content/browser/webui/url_data_manager.h -@@ -69,6 +69,8 @@ class CONTENT_EXPORT URLDataManager : public base::SupportsUserData::Data { - const std::string& source_name, - std::unique_ptr update); - -+ static const void* GetUserDataKey(); -+ - private: - friend class URLDataSourceImpl; - friend struct DeleteURLDataSource;