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

@@ -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
index d66a0216832f..25c5ea80cb07 100644
--- chrome/browser/profiles/profile_manager.cc

View File

@@ -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<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
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

View File

@@ -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<ExtensionHostDelegate>
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;

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 =
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<base::DictionaryValue> update);
+ static const void* GetUserDataKey();
+
private:
friend class URLDataSourceImpl;
friend struct DeleteURLDataSource;