chrome: osr: Fix performance manager init (see #3681)

This commit is contained in:
Marshall Greenblatt 2024-04-27 14:25:51 -04:00
parent c0e7854782
commit fe5b0dd668
6 changed files with 19 additions and 29 deletions

View File

@ -25,6 +25,7 @@
#include "components/find_in_page/find_tab_helper.h"
#include "components/find_in_page/find_types.h"
#include "components/javascript_dialogs/tab_modal_dialog_manager.h"
#include "components/performance_manager/embedder/performance_manager_registry.h"
#include "components/permissions/permission_request_manager.h"
#include "components/zoom/zoom_controller.h"
#include "content/browser/renderer_host/render_widget_host_impl.h"
@ -427,6 +428,16 @@ void CefBrowserPlatformDelegateAlloy::AttachHelpers(
web_contents, CreateAlloyJavaScriptTabModalDialogManagerDelegateDesktop(
web_contents));
} else {
if (IsWindowless()) {
// Logic from ChromeContentBrowserClientCef::GetWebContentsViewDelegate
// which is not called for windowless browsers. Needs to be done before
// calling AttachTabHelpers.
if (auto* registry =
performance_manager::PerformanceManagerRegistry::GetInstance()) {
registry->MaybeCreatePageNodeForWebContents(web_contents);
}
}
// Adopt the WebContents now, so all observers are in place, as the network
// requests for its initial navigation will start immediately
TabHelpers::AttachTabHelpers(web_contents);

View File

@ -33,6 +33,7 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/chrome_switches.h"
#include "components/performance_manager/embedder/performance_manager_registry.h"
#include "content/public/browser/navigation_throttle.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/render_view_host.h"
@ -479,9 +480,13 @@ void ChromeContentBrowserClientCef::RegisterBrowserInterfaceBindersForFrame(
std::unique_ptr<content::WebContentsViewDelegate>
ChromeContentBrowserClientCef::GetWebContentsViewDelegate(
content::WebContents* web_contents) {
// This does more work than just creating the delegate, so we call it even
// though the result gets discarded.
ChromeContentBrowserClient::GetWebContentsViewDelegate(web_contents);
// From ChromeContentBrowserClient::GetWebContentsViewDelegate. Windowless
// browsers don't call this method and use
// CefBrowserPlatformDelegateAlloy::AttachHelpers instead.
if (auto* registry =
performance_manager::PerformanceManagerRegistry::GetInstance()) {
registry->MaybeCreatePageNodeForWebContents(web_contents);
}
// Used to customize context menu behavior for Alloy style. Called during
// WebContents::Create() so we don't yet have an associated BrowserHost.

View File

@ -10,8 +10,6 @@
#include "libcef/browser/osr/touch_selection_controller_client_osr.h"
#include "libcef/common/drag_data_impl.h"
#include "content/browser/browser_plugin/browser_plugin_embedder.h"
#include "content/browser/browser_plugin/browser_plugin_guest.h"
#include "content/browser/web_contents/web_contents_impl.h"
#include "content/public/browser/render_widget_host.h"

View File

@ -11,9 +11,7 @@
#include "third_party/skia/include/core/SkColor.h"
namespace content {
class BrowserPluginGuest;
class WebContents;
class WebContentsViewDelegate;
} // namespace content
class AlloyBrowserHostImpl;

View File

@ -303,12 +303,6 @@ patches = [
# https://github.com/chromiumembedded/cef/issues/2830
'name': 'chrome_browser_net_proxy',
},
{
# chrome: Fix assertion in FrameNodeImpl::SetIntersectsViewport when loading
# PDF viewer with Chrome runtime + Alloy style + windowless rendering.
# https://github.com/chromiumembedded/cef/issues/3681
'name': 'chrome_browser_osr',
},
{
# Support override of CreatePermissionPrompt.
# https://github.com/chromiumembedded/cef/issues/3352

View File

@ -1,16 +0,0 @@
diff --git components/performance_manager/graph/frame_node_impl.cc components/performance_manager/graph/frame_node_impl.cc
index c277c918b08ce..8ca8fd2670edd 100644
--- components/performance_manager/graph/frame_node_impl.cc
+++ components/performance_manager/graph/frame_node_impl.cc
@@ -355,8 +355,9 @@ void FrameNodeImpl::SetIntersectsViewport(bool intersects_viewport) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
// The intersection with the viewport of the outermost main frame or embedder
// is not tracked.
- DCHECK(parent_or_outer_document_or_embedder());
- intersects_viewport_.SetAndMaybeNotify(this, intersects_viewport);
+ if (parent_or_outer_document_or_embedder()) {
+ intersects_viewport_.SetAndMaybeNotify(this, intersects_viewport);
+ }
}
void FrameNodeImpl::SetInitialVisibility(Visibility visibility) {