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_EXTENSIONS_API_TABS_TABS_API_H_
#define CEF_LIBCEF_BROWSER_EXTENSIONS_API_TABS_TABS_API_H_
#include "base/memory/raw_ptr.h"
#include "cef/libcef/browser/extensions/extension_function_details.h"
#include "chrome/common/extensions/api/tabs.h"
#include "extensions/browser/api/execute_code_function.h"
@@ -68,7 +69,7 @@ class TabsUpdateFunction : public BaseAPIFunction {
DECLARE_EXTENSION_FUNCTION("tabs.update", TABS_UPDATE)
int tab_id_ = -1;
content::WebContents* web_contents_ = nullptr;
raw_ptr<content::WebContents> web_contents_ = nullptr;
};
// Implement API calls tabs.executeScript, tabs.insertCSS, and tabs.removeCSS.

View File

@@ -28,8 +28,9 @@ void CefBrowserPlatformDelegateBackground::CloseHostWindow() {
// No host window, so continue browser destruction now. Do it asynchronously
// so the call stack has a chance to unwind.
CEF_POST_TASK(
CEF_UIT, base::BindOnce(&AlloyBrowserHostImpl::WindowDestroyed,
AlloyBrowserHostImpl::FromBaseChecked(browser_)));
CEF_UIT,
base::BindOnce(&AlloyBrowserHostImpl::WindowDestroyed,
AlloyBrowserHostImpl::FromBaseChecked(browser_.get())));
}
CefWindowHandle CefBrowserPlatformDelegateBackground::GetHostWindowHandle()

View File

@@ -6,6 +6,7 @@
#define CEF_LIBCEF_BROWSER_EXTENSIONS_EXTENSION_FUNCTION_DETAILS_H_
#include "base/functional/callback_forward.h"
#include "base/memory/raw_ptr.h"
#include "cef/include/cef_extension.h"
#include "cef/libcef/browser/alloy/alloy_browser_host_impl.h"
#include "chrome/common/extensions/api/tabs.h"
@@ -136,7 +137,7 @@ class CefExtensionFunctionDetails {
private:
// The function for which these details have been created. Must outlive the
// CefExtensionFunctionDetails instance.
ExtensionFunction* function_;
raw_ptr<ExtensionFunction> function_;
mutable CefRefPtr<CefExtension> cef_extension_;

View File

@@ -9,6 +9,7 @@
#include <map>
#include <memory>
#include "base/memory/raw_ptr.h"
#include "base/memory/weak_ptr.h"
#include "base/one_shot_event.h"
#include "cef/include/cef_extension_handler.h"
@@ -152,7 +153,7 @@ class CefExtensionSystem : public ExtensionSystem {
void NotifyExtensionUnloaded(const Extension* extension,
UnloadedExtensionReason reason);
content::BrowserContext* browser_context_; // Not owned.
raw_ptr<content::BrowserContext> browser_context_; // Not owned.
bool initialized_ = false;
@@ -169,11 +170,11 @@ class CefExtensionSystem : public ExtensionSystem {
base::OneShotEvent ready_;
// Sets of enabled/disabled/terminated/blacklisted extensions. Not owned.
ExtensionRegistry* registry_;
raw_ptr<ExtensionRegistry> registry_;
// The associated RendererStartupHelper. Guaranteed to outlive the
// ExtensionSystem, and thus us.
extensions::RendererStartupHelper* renderer_helper_;
raw_ptr<extensions::RendererStartupHelper> renderer_helper_;
// Map of extension ID to CEF extension object.
ExtensionMap extension_map_;

View File

@@ -6,6 +6,7 @@
#ifndef CEF_LIBCEF_BROWSER_EXTENSIONS_MIME_HANDLER_VIEW_GUEST_DELEGATE_H_
#define CEF_LIBCEF_BROWSER_EXTENSIONS_MIME_HANDLER_VIEW_GUEST_DELEGATE_H_
#include "base/memory/raw_ptr.h"
#include "extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest_delegate.h"
namespace content {
@@ -34,7 +35,7 @@ class CefMimeHandlerViewGuestDelegate : public MimeHandlerViewGuestDelegate {
const content::ContextMenuParams& params) override;
private:
content::WebContents* owner_web_contents_;
raw_ptr<content::WebContents> owner_web_contents_;
};
} // namespace extensions

View File

@@ -10,6 +10,7 @@
#include <memory>
#include "base/files/file_path.h"
#include "base/memory/raw_ptr.h"
#include "components/value_store/value_store_factory.h"
namespace value_store {
@@ -48,7 +49,7 @@ class CefValueStoreFactory : public ValueStoreFactory {
std::unique_ptr<ValueStore> CreateStore();
base::FilePath db_path_;
ValueStore* last_created_store_ = nullptr;
raw_ptr<ValueStore> last_created_store_ = nullptr;
// A mapping from directories to their ValueStore. None of these value
// stores are owned by this factory, so care must be taken when calling