Remove Chromium patches that are no longer required (see issue #2622).

This commit is contained in:
Marshall Greenblatt
2019-03-23 20:39:54 -04:00
parent ea27dff338
commit 9b43d265c3
16 changed files with 106 additions and 1391 deletions

View File

@ -61,15 +61,5 @@
], ],
# Patterns that should not be found in the chromium/src directory after # Patterns that should not be found in the chromium/src directory after
# applying patch files. # applying patch files.
'patterns': [ '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<StoragePartitionImpl\*>(',
'exclude_matches': '^(.+?)test(.+?):',
'message': 'New instances in non-test files should be converted to ' +\
'call StoragePartition methods.' +\
'\nSee storage_partition_1973.patch.',
},
],
} }

View File

@ -316,11 +316,6 @@ CefRefPtr<CefBrowserHostImpl> CefBrowserHostImpl::Create(
request_context_impl->GetBrowserContext(); request_context_impl->GetBrowserContext();
DCHECK(browser_context); 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) { if (!create_params.request_context) {
// Using the global request context. // Using the global request context.
create_params.request_context = request_context_impl.get(); create_params.request_context = request_context_impl.get();

View File

@ -27,14 +27,11 @@ ChromeBrowserProcessStub::ChromeBrowserProcessStub()
: initialized_(false), : initialized_(false),
context_initialized_(false), context_initialized_(false),
shutdown_(false), shutdown_(false),
locale_("en-US") { locale_("en-US") {}
chrome::SetBrowserContextIncognitoHelper(this);
}
ChromeBrowserProcessStub::~ChromeBrowserProcessStub() { ChromeBrowserProcessStub::~ChromeBrowserProcessStub() {
DCHECK((!initialized_ && !context_initialized_) || shutdown_); DCHECK((!initialized_ && !context_initialized_) || shutdown_);
g_browser_process = NULL; g_browser_process = NULL;
chrome::SetBrowserContextIncognitoHelper(nullptr);
} }
void ChromeBrowserProcessStub::Initialize() { void ChromeBrowserProcessStub::Initialize() {
@ -385,15 +382,3 @@ ChromeBrowserProcessStub::pref_service_factory() const {
NOTREACHED(); NOTREACHED();
return NULL; return NULL;
} }
content::BrowserContext*
ChromeBrowserProcessStub::GetBrowserContextRedirectedInIncognito(
content::BrowserContext* context) {
return CefBrowserContext::GetForContext(context);
}
content::BrowserContext*
ChromeBrowserProcessStub::GetBrowserContextOwnInstanceInIncognito(
content::BrowserContext* context) {
return GetBrowserContextRedirectedInIncognito(context);
}

View File

@ -15,7 +15,6 @@
#include "base/compiler_specific.h" #include "base/compiler_specific.h"
#include "chrome/browser/browser_process.h" #include "chrome/browser/browser_process.h"
#include "chrome/browser/extensions/event_router_forwarder.h" #include "chrome/browser/extensions/event_router_forwarder.h"
#include "chrome/browser/profiles/incognito_helpers.h"
#include "media/media_buildflags.h" #include "media/media_buildflags.h"
class ChromeProfileManagerStub; class ChromeProfileManagerStub;
@ -29,8 +28,7 @@ class BackgroundModeManager {
DISALLOW_COPY_AND_ASSIGN(BackgroundModeManager); DISALLOW_COPY_AND_ASSIGN(BackgroundModeManager);
}; };
class ChromeBrowserProcessStub : public BrowserProcess, class ChromeBrowserProcessStub : public BrowserProcess {
public chrome::BrowserContextIncognitoHelper {
public: public:
ChromeBrowserProcessStub(); ChromeBrowserProcessStub();
~ChromeBrowserProcessStub() override; ~ChromeBrowserProcessStub() override;
@ -109,12 +107,6 @@ class ChromeBrowserProcessStub : public BrowserProcess,
override; override;
prefs::InProcessPrefServiceFactory* pref_service_factory() const 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: private:
bool initialized_; bool initialized_;
bool context_initialized_; bool context_initialized_;

View File

@ -696,13 +696,6 @@ CefContentBrowserClient::GetExtraServiceManifests() {
return std::vector<service_manager::Manifest>{GetCefRendererManifest()}; return std::vector<service_manager::Manifest>{GetCefRendererManifest()};
} }
bool CefContentBrowserClient::IsSameBrowserContext(
content::BrowserContext* context1,
content::BrowserContext* context2) {
return CefBrowserContext::GetForContext(context1) ==
CefBrowserContext::GetForContext(context2);
}
void CefContentBrowserClient::AppendExtraCommandLineSwitches( void CefContentBrowserClient::AppendExtraCommandLineSwitches(
base::CommandLine* command_line, base::CommandLine* command_line,
int child_process_id) { int child_process_id) {

View File

@ -59,8 +59,6 @@ class CefContentBrowserClient : public content::ContentBrowserClient {
base::Optional<service_manager::Manifest> GetServiceManifestOverlay( base::Optional<service_manager::Manifest> GetServiceManifestOverlay(
base::StringPiece name) override; base::StringPiece name) override;
std::vector<service_manager::Manifest> GetExtraServiceManifests() override; std::vector<service_manager::Manifest> GetExtraServiceManifests() override;
bool IsSameBrowserContext(content::BrowserContext* context1,
content::BrowserContext* context2) override;
void AppendExtraCommandLineSwitches(base::CommandLine* command_line, void AppendExtraCommandLineSwitches(base::CommandLine* command_line,
int child_process_id) override; int child_process_id) override;
void AdjustUtilityServiceProcessCommandLine( void AdjustUtilityServiceProcessCommandLine(

View File

@ -65,14 +65,14 @@ bool CefExtensionsBrowserClient::AreExtensionsDisabled(
} }
bool CefExtensionsBrowserClient::IsValidContext(BrowserContext* context) { bool CefExtensionsBrowserClient::IsValidContext(BrowserContext* context) {
return CefBrowserContext::GetForContext(context) != NULL; return GetOriginalContext(context) != NULL;
} }
bool CefExtensionsBrowserClient::IsSameContext(BrowserContext* first, bool CefExtensionsBrowserClient::IsSameContext(BrowserContext* first,
BrowserContext* second) { BrowserContext* second) {
// Returns true if |first| and |second| share the same underlying // Returns true if |first| and |second| share the same underlying
// CefBrowserContext. // CefBrowserContext.
return GetCefImplContext(first) == GetCefImplContext(second); return GetOriginalContext(first) == GetOriginalContext(second);
} }
bool CefExtensionsBrowserClient::HasOffTheRecordContext( bool CefExtensionsBrowserClient::HasOffTheRecordContext(
@ -88,11 +88,6 @@ BrowserContext* CefExtensionsBrowserClient::GetOffTheRecordContext(
BrowserContext* CefExtensionsBrowserClient::GetOriginalContext( BrowserContext* CefExtensionsBrowserClient::GetOriginalContext(
BrowserContext* context) { BrowserContext* context) {
return GetCefImplContext(context);
}
BrowserContext* CefExtensionsBrowserClient::GetCefImplContext(
BrowserContext* context) {
return CefBrowserContext::GetForContext(context); return CefBrowserContext::GetForContext(context);
} }

View File

@ -36,8 +36,6 @@ class CefExtensionsBrowserClient : public ExtensionsBrowserClient {
content::BrowserContext* context) override; content::BrowserContext* context) override;
content::BrowserContext* GetOriginalContext( content::BrowserContext* GetOriginalContext(
content::BrowserContext* context) override; content::BrowserContext* context) override;
content::BrowserContext* GetCefImplContext(
content::BrowserContext* context) override;
bool IsGuestSession(content::BrowserContext* context) const override; bool IsGuestSession(content::BrowserContext* context) const override;
bool IsExtensionIncognitoEnabled( bool IsExtensionIncognitoEnabled(
const std::string& extension_id, const std::string& extension_id,

View File

@ -165,11 +165,6 @@ patches = [
# https://bitbucket.org/chromiumembedded/cef/issue/1639 # https://bitbucket.org/chromiumembedded/cef/issue/1639
'name': 'service_manager_654986', '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 # Fix missing check for defined(ENABLE_THEMES) in
# renderer_preferences_util.cc on Linux. # renderer_preferences_util.cc on Linux.
@ -237,7 +232,6 @@ patches = [
}, },
{ {
# Make some methods of ProfileManager virtual. # Make some methods of ProfileManager virtual.
# Allow CEF to intercept GetBrowserContext*InIncognito functions.
'name': 'chrome_browser_profiles', 'name': 'chrome_browser_profiles',
}, },
{ {
@ -255,16 +249,10 @@ patches = [
'name': 'chrome_plugins', '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 # Don't create databases, blob_storage or VideoDecodeStats directories when
# cache_path is empty. # cache_path is empty.
# https://bitbucket.org/chromiumembedded/cef/issues/2289 # https://bitbucket.org/chromiumembedded/cef/issues/2289
'name': 'storage_partition_1973', 'name': 'storage_incognito_2289',
}, },
{ {
# Fix plugin placeholder blocked message. # Fix plugin placeholder blocked message.
@ -272,9 +260,7 @@ patches = [
'name': 'webview_plugin_2020', 'name': 'webview_plugin_2020',
}, },
{ {
# Support WebUI by: # Support WebUI by removing dependency on non-NULL IOThread* object.
# (a) Exposing required UserData keys;
# (b) Removing dependency on non-NULL IOThread* object.
# https://bitbucket.org/chromiumembedded/cef/issues/2037 # https://bitbucket.org/chromiumembedded/cef/issues/2037
'name': 'webui_2037', 'name': 'webui_2037',
}, },
@ -349,10 +335,8 @@ patches = [
'name': 'linux_gtk_2014', 'name': 'linux_gtk_2014',
}, },
{ {
# Changes necessary to support for chrome extensions: # Changes necessary to support for chrome extensions. Add a new
# (a) Add a new ExtensionHost constructor that allows CEF to create the # ExtensionHost constructor that allows CEF to create the WebContents.
# WebContents.
# (b) Always create ProcessManager using CEF's BrowserContextImpl.
# https://bitbucket.org/chromiumembedded/cef/issues/1947 # https://bitbucket.org/chromiumembedded/cef/issues/1947
# #
# Don't initialize PrerenderContents object in StreamsPrivateAPI. # Don't initialize PrerenderContents object in StreamsPrivateAPI.

View File

@ -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<content::BrowserContext*>(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 diff --git chrome/browser/profiles/profile_manager.cc chrome/browser/profiles/profile_manager.cc
index d66a0216832f..25c5ea80cb07 100644 index d66a0216832f..25c5ea80cb07 100644
--- chrome/browser/profiles/profile_manager.cc --- chrome/browser/profiles/profile_manager.cc

View File

@ -82,22 +82,6 @@ index 1e912186c32c..38d03aafc8b0 100644
static_assert(WILL_FAIL_REQUEST < WILL_PROCESS_RESPONSE, static_assert(WILL_FAIL_REQUEST < WILL_PROCESS_RESPONSE,
"WillFailRequest state should come before WillProcessResponse"); "WillFailRequest state should come before WillProcessResponse");
return navigation_request_->render_frame_host(); 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<StoragePartitionImpl*>(
+ 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 diff --git content/browser/frame_host/render_frame_message_filter.cc content/browser/frame_host/render_frame_message_filter.cc
index 09095ba2dc8e..2fb0becabf88 100644 index 09095ba2dc8e..2fb0becabf88 100644
--- content/browser/frame_host/render_frame_message_filter.cc --- content/browser/frame_host/render_frame_message_filter.cc
@ -148,6 +132,19 @@ index 31aa4bc38442..0314343499d3 100644
if (stale) { if (stale) {
// Refresh the plugins asynchronously. // 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 diff --git content/browser/plugin_service_impl.cc content/browser/plugin_service_impl.cc
index a599f989065f..115867edec92 100644 index a599f989065f..115867edec92 100644
--- content/browser/plugin_service_impl.cc --- content/browser/plugin_service_impl.cc

View File

@ -26,55 +26,11 @@ index 9e81f0a33ede..b796e79ae7ef 100644
auto* browser_context = web_contents->GetBrowserContext(); 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 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
+++ content/public/browser/content_browser_client.h +++ content/public/browser/content_browser_client.h
@@ -460,6 +460,13 @@ class CONTENT_EXPORT ContentBrowserClient { @@ -1491,6 +1491,10 @@ 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 {
// Used as part of the user agent string. // Used as part of the user agent string.
virtual std::string GetProduct() const; 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 // 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 // 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 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
+++ extensions/browser/extensions_browser_client.h +++ extensions/browser/extensions_browser_client.h
@@ -62,6 +62,7 @@ class ComponentExtensionResourceManager; @@ -62,6 +62,7 @@ class ComponentExtensionResourceManager;
@ -202,19 +158,7 @@ index 93dce1cad08c..fdb7ad2193d7 100644
class ExtensionHostDelegate; class ExtensionHostDelegate;
class ExtensionPrefsObserver; class ExtensionPrefsObserver;
class ExtensionApiFrameIdMap; class ExtensionApiFrameIdMap;
@@ -134,6 +135,11 @@ class ExtensionsBrowserClient { @@ -216,6 +217,14 @@ 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 {
virtual std::unique_ptr<ExtensionHostDelegate> virtual std::unique_ptr<ExtensionHostDelegate>
CreateExtensionHostDelegate() = 0; CreateExtensionHostDelegate() = 0;
@ -253,28 +197,3 @@ index 14fa00f41564..9487425a5627 100644
host->CreateRenderViewSoon(); host->CreateRenderViewSoon();
OnBackgroundHostCreated(host); OnBackgroundHostCreated(host);
return true; 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;

View File

@ -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<media::VideoDecodeStatsDBImpl> stats_db =
- media::VideoDecodeStatsDBImpl::Create(
- GetPath().Append(FILE_PATH_LITERAL("VideoDecodeStats")));
+ std::unique_ptr<media::VideoDecodeStatsDB> stats_db;
+ if (GetPath().empty()) {
+ stats_db =
+ std::make_unique<media::InMemoryVideoDecodeStatsDBImpl>(nullptr);
+ } else {
+ stats_db = media::VideoDecodeStatsDBImpl::Create(
+ GetPath().Append(FILE_PATH_LITERAL("VideoDecodeStats")));
+ }
auto new_decode_history = std::make_unique<media::VideoDecodePerfHistory>(
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))) &&

File diff suppressed because it is too large Load Diff

View File

@ -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> data);
- void RemoveUserData(const void* key);
+ virtual Data* GetUserData(const void* key) const;
+ virtual void SetUserData(const void* key, std::unique_ptr<Data> 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

View File

@ -59,60 +59,3 @@ index 14b789a35c34..19a1f340a101 100644
content::BrowserContext* context = content::BrowserContext* context =
render_process_host->GetBrowserContext(); render_process_host->GetBrowserContext();
extensions::ExtensionRegistry* extension_registry = 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<base::DictionaryValue> update);
+ static const void* GetUserDataKey();
+
private:
friend class URLDataSourceImpl;
friend struct DeleteURLDataSource;