Apply raw_ptr rewrite to libcef (see #3239)

This commit is contained in:
Marshall Greenblatt
2024-05-11 11:48:38 -04:00
parent 2156c9fd5d
commit 0170f431a0
109 changed files with 290 additions and 185 deletions

View File

@@ -5,6 +5,7 @@
#ifndef CEF_LIBCEF_BROWSER_NATIVE_BROWSER_PLATFORM_DELEGATE_NATIVE_H_
#define CEF_LIBCEF_BROWSER_NATIVE_BROWSER_PLATFORM_DELEGATE_NATIVE_H_
#include "base/memory/raw_ptr.h"
#include "cef/libcef/browser/alloy/browser_platform_delegate_alloy.h"
// Base implementation of native browser functionality.
@@ -70,7 +71,7 @@ class CefBrowserPlatformDelegateNative
const SkColor background_color_;
// Not owned by this object.
WindowlessHandler* windowless_handler_ = nullptr;
raw_ptr<WindowlessHandler> windowless_handler_ = nullptr;
};
#endif // CEF_LIBCEF_BROWSER_NATIVE_BROWSER_PLATFORM_DELEGATE_NATIVE_H_

View File

@@ -5,6 +5,7 @@
#ifndef CEF_LIBCEF_BROWSER_NATIVE_BROWSER_PLATFORM_DELEGATE_NATIVE_AURA_H_
#define CEF_LIBCEF_BROWSER_NATIVE_BROWSER_PLATFORM_DELEGATE_NATIVE_AURA_H_
#include "base/memory/raw_ptr.h"
#include "base/memory/weak_ptr.h"
#include "cef/libcef/browser/native/browser_platform_delegate_native.h"
#include "ui/events/event.h"
@@ -79,7 +80,7 @@ class CefBrowserPlatformDelegateNativeAura
// Widget hosting the web contents. It will be deleted automatically when the
// associated root window is destroyed.
views::Widget* window_widget_ = nullptr;
raw_ptr<views::Widget> window_widget_ = nullptr;
private:
// Will only be called if the Widget is deleted before

View File

@@ -65,7 +65,7 @@ bool CefBrowserPlatformDelegateNativeLinux::CreateHostWindow() {
// Create a new window object. It will delete itself when the associated X11
// window is destroyed.
window_x11_ =
new CefWindowX11(browser_, parent_window, rect,
new CefWindowX11(browser_.get(), parent_window, rect,
CefString(&window_info_.window_name).ToString());
DCHECK_NE(window_x11_->xwindow(), x11::Window::None);
window_info_.window =

View File

@@ -5,6 +5,7 @@
#ifndef CEF_LIBCEF_BROWSER_NATIVE_BROWSER_PLATFORM_DELEGATE_NATIVE_LINUX_H_
#define CEF_LIBCEF_BROWSER_NATIVE_BROWSER_PLATFORM_DELEGATE_NATIVE_LINUX_H_
#include "base/memory/raw_ptr.h"
#include "cef/libcef/browser/native/browser_platform_delegate_native_aura.h"
#include "ui/base/ozone_buildflags.h"
@@ -44,7 +45,7 @@ class CefBrowserPlatformDelegateNativeLinux
bool host_window_created_ = false;
#if BUILDFLAG(IS_OZONE_X11)
CefWindowX11* window_x11_ = nullptr;
raw_ptr<CefWindowX11> window_x11_ = nullptr;
#endif
};

View File

@@ -74,7 +74,7 @@ void CefWindowDelegateView::Init(gfx::AcceleratedWidget parent_widget,
void CefWindowDelegateView::InitContent() {
SetBackground(views::CreateSolidBackground(background_color_));
SetLayoutManager(std::make_unique<views::FillLayout>());
AddChildView(web_view_);
AddChildView(web_view_.get());
}
void CefWindowDelegateView::DeleteDelegate() {

View File

@@ -6,6 +6,7 @@
#define CEF_LIBCEF_BROWSER_NATIVE_WINDOW_DELEGATE_VIEW_H_
#pragma once
#include "base/memory/raw_ptr.h"
#include "ui/views/widget/widget_delegate.h"
namespace content {
@@ -54,7 +55,7 @@ class CefWindowDelegateView : public views::WidgetDelegateView {
base::RepeatingClosure on_bounds_changed_;
base::OnceClosure on_delete_;
views::WebView* web_view_ = nullptr;
raw_ptr<views::WebView> web_view_ = nullptr;
};
#endif // CEF_LIBCEF_BROWSER_NATIVE_WINDOW_DELEGATE_VIEW_H_

View File

@@ -7,6 +7,7 @@
#define CEF_LIBCEF_BROWSER_NATIVE_WINDOW_X11_H_
#pragma once
#include "base/memory/raw_ptr.h"
#include "base/memory/weak_ptr.h"
#include "cef/include/internal/cef_ptr.h"
#include "ui/events/platform/platform_event_dispatcher.h"
@@ -70,7 +71,7 @@ class CefWindowX11 : public ui::PlatformEventDispatcher,
CefRefPtr<CefBrowserHostBase> browser_;
// The display and the native X window hosting the root window.
x11::Connection* const connection_;
const raw_ptr<x11::Connection> connection_;
x11::Window parent_xwindow_;
x11::Window xwindow_;