0

[BRP] Tackle "in not-rewritten platform specific code" exclusions

The following actions were needed to handle raw_ptr rewrites,
depending on the case:
- add .get() here and there (mostly assignment to auto*)
- convert AutoReset<T*> to AutoReset<raw_ptr<T>>
- convert function param from T*& to raw_ptr<T>&

In one case a struct was marked as STACK_ALLOCATED(), hence not
needing raw_ptr or RAW_PTR_EXCLUSION there at all.

Some pointers were kept unrewritten, but the exclusion reason was
reclassified.

No performance regression has been observed on benchmarks:
https://pinpoint-dot-chromeperf.appspot.com/job/14f97c43810000
https://pinpoint-dot-chromeperf.appspot.com/job/17cb0eb3810000
https://pinpoint-dot-chromeperf.appspot.com/job/10eeb1f5810000
https://pinpoint-dot-chromeperf.appspot.com/job/105491c8410000

Bug: 331840472
DanglingUntriaged-notes: rewriting new pointers
Change-Id: I6559367355463881b1563b38a799595d2c12662d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5595156
Code-Coverage: findit-for-me@appspot.gserviceaccount.com <findit-for-me@appspot.gserviceaccount.com>
Commit-Queue: Bartek Nowierski <bartekn@chromium.org>
Auto-Submit: Bartek Nowierski <bartekn@chromium.org>
Reviewed-by: Keishi Hattori <keishi@chromium.org>
Owners-Override: Keishi Hattori <keishi@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1310666}
This commit is contained in:
Bartek Nowierski
2024-06-05 16:16:22 +00:00
committed by Chromium LUCI CQ
parent f474fa9096
commit 7b885b2ce6
31 changed files with 83 additions and 132 deletions

@ -185,7 +185,7 @@ TEST_F(SlimLayerTreeCompositorFrameTest, OneSolidColorQuad) {
viz::HasTransform(gfx::Transform()),
viz::HasOpacity(1.0f), viz::AreContentsOpaque(true))));
auto* quad = pass->quad_list.back();
auto* shared_quad_state = quad->shared_quad_state;
auto* shared_quad_state = quad->shared_quad_state.get();
EXPECT_EQ(shared_quad_state->quad_layer_rect, viewport_);
EXPECT_EQ(shared_quad_state->visible_quad_layer_rect, viewport_);
@ -214,7 +214,7 @@ TEST_F(SlimLayerTreeCompositorFrameTest, LayerTransform) {
viz::HasVisibleRect(viewport_))));
auto* quad = pass->quad_list.front();
auto* shared_quad_state = quad->shared_quad_state;
auto* shared_quad_state = quad->shared_quad_state.get();
EXPECT_EQ(shared_quad_state->quad_layer_rect, gfx::Rect(10, 20));
EXPECT_EQ(shared_quad_state->visible_quad_layer_rect, gfx::Rect(10, 20));
@ -1088,7 +1088,7 @@ TEST_F(SlimLayerTreeCompositorFrameTest, NonAxisAlignedClip) {
viz::HasTransform(gfx::Transform()))));
auto* render_pass_quad = viz::CompositorRenderPassDrawQuad::MaterialCast(
root_pass->quad_list.ElementAt(0));
auto* shared_quad_state = render_pass_quad->shared_quad_state;
auto* shared_quad_state = render_pass_quad->shared_quad_state.get();
EXPECT_EQ(shared_quad_state->quad_layer_rect, gfx::Rect(50, 50));
EXPECT_EQ(shared_quad_state->visible_quad_layer_rect, gfx::Rect(50, 50));
EXPECT_EQ(shared_quad_state->clip_rect, std::nullopt);
@ -1138,7 +1138,7 @@ TEST_F(SlimLayerTreeCompositorFrameTest, ChildPassOutputRect) {
{
// SharedQuadState should match the quad.
auto* shared_quad_state =
child_pass->quad_list.ElementAt(0)->shared_quad_state;
child_pass->quad_list.ElementAt(0)->shared_quad_state.get();
EXPECT_EQ(shared_quad_state->quad_layer_rect, gfx::Rect(80, 80));
EXPECT_EQ(shared_quad_state->visible_quad_layer_rect, gfx::Rect(30, 30));
}
@ -1156,7 +1156,7 @@ TEST_F(SlimLayerTreeCompositorFrameTest, ChildPassOutputRect) {
{
auto* render_pass_quad = viz::CompositorRenderPassDrawQuad::MaterialCast(
root_pass->quad_list.ElementAt(0));
auto* shared_quad_state = render_pass_quad->shared_quad_state;
auto* shared_quad_state = render_pass_quad->shared_quad_state.get();
EXPECT_EQ(shared_quad_state->quad_layer_rect, gfx::Rect(20, 20, 30, 30));
EXPECT_EQ(shared_quad_state->visible_quad_layer_rect,
gfx::Rect(20, 20, 30, 30));
@ -1199,7 +1199,7 @@ TEST_F(SlimLayerTreeCompositorFrameTest, Filters) {
{
// SharedQuadState should match the quad.
auto* shared_quad_state =
child_pass->quad_list.ElementAt(0)->shared_quad_state;
child_pass->quad_list.ElementAt(0)->shared_quad_state.get();
EXPECT_EQ(shared_quad_state->quad_layer_rect, gfx::Rect(80, 80));
EXPECT_EQ(shared_quad_state->visible_quad_layer_rect, gfx::Rect(80, 80));
}
@ -1222,7 +1222,7 @@ TEST_F(SlimLayerTreeCompositorFrameTest, Filters) {
{
auto* render_pass_quad = viz::CompositorRenderPassDrawQuad::MaterialCast(
root_pass->quad_list.ElementAt(0));
auto* shared_quad_state = render_pass_quad->shared_quad_state;
auto* shared_quad_state = render_pass_quad->shared_quad_state.get();
EXPECT_EQ(shared_quad_state->quad_layer_rect, gfx::Rect(40, 40));
EXPECT_EQ(shared_quad_state->visible_quad_layer_rect, gfx::Rect(40, 40));
EXPECT_EQ(shared_quad_state->clip_rect, std::nullopt);
@ -1923,7 +1923,7 @@ TEST_F(SlimLayerTreeCompositorFrameTest, SimpleRoundedCorner) {
viz::HasRect(viewport_), viz::HasVisibleRect(viewport_),
viz::HasTransform(gfx::Transform()))));
auto* quad = pass->quad_list.front();
auto* shared_quad_state = quad->shared_quad_state;
auto* shared_quad_state = quad->shared_quad_state.get();
EXPECT_TRUE(shared_quad_state->mask_filter_info.HasRoundedCorners());
EXPECT_TRUE(shared_quad_state->is_fast_rounded_corner);
EXPECT_EQ(shared_quad_state->mask_filter_info.rounded_corner_bounds(),
@ -1967,7 +1967,7 @@ TEST_F(SlimLayerTreeCompositorFrameTest, RoundedCornerWithChild) {
50.0f, 20.0f);
{
auto* quad = pass->quad_list.front();
auto* shared_quad_state = quad->shared_quad_state;
auto* shared_quad_state = quad->shared_quad_state.get();
EXPECT_TRUE(shared_quad_state->mask_filter_info.HasRoundedCorners());
EXPECT_TRUE(shared_quad_state->is_fast_rounded_corner);
EXPECT_EQ(shared_quad_state->mask_filter_info.rounded_corner_bounds(),
@ -1976,7 +1976,7 @@ TEST_F(SlimLayerTreeCompositorFrameTest, RoundedCornerWithChild) {
{
auto* quad = pass->quad_list.ElementAt(1u);
auto* shared_quad_state = quad->shared_quad_state;
auto* shared_quad_state = quad->shared_quad_state.get();
EXPECT_TRUE(shared_quad_state->mask_filter_info.HasRoundedCorners());
EXPECT_TRUE(shared_quad_state->is_fast_rounded_corner);
EXPECT_EQ(shared_quad_state->mask_filter_info.rounded_corner_bounds(),
@ -2008,7 +2008,7 @@ TEST_F(SlimLayerTreeCompositorFrameTest, NonAxisAlignedRoundedCorner) {
viz::HasTransform(gfx::Transform()))));
{
auto* quad = child_pass->quad_list.front();
auto* shared_quad_state = quad->shared_quad_state;
auto* shared_quad_state = quad->shared_quad_state.get();
EXPECT_TRUE(shared_quad_state->mask_filter_info.HasRoundedCorners());
EXPECT_TRUE(shared_quad_state->is_fast_rounded_corner);
EXPECT_EQ(shared_quad_state->mask_filter_info.rounded_corner_bounds(),
@ -2031,7 +2031,7 @@ TEST_F(SlimLayerTreeCompositorFrameTest, NonAxisAlignedRoundedCorner) {
viz::HasTransform(gfx::Transform()))));
{
auto* quad = root_pass->quad_list.front();
auto* shared_quad_state = quad->shared_quad_state;
auto* shared_quad_state = quad->shared_quad_state.get();
EXPECT_FALSE(shared_quad_state->mask_filter_info.HasRoundedCorners());
}
}
@ -2061,7 +2061,7 @@ TEST_F(SlimLayerTreeCompositorFrameTest, RoundedCornerOnParentAndChild) {
viz::HasTransform(gfx::Transform()))));
{
auto* quad = child_pass->quad_list.front();
auto* shared_quad_state = quad->shared_quad_state;
auto* shared_quad_state = quad->shared_quad_state.get();
EXPECT_TRUE(shared_quad_state->mask_filter_info.HasRoundedCorners());
EXPECT_TRUE(shared_quad_state->is_fast_rounded_corner);
EXPECT_EQ(shared_quad_state->mask_filter_info.rounded_corner_bounds(),
@ -2089,7 +2089,7 @@ TEST_F(SlimLayerTreeCompositorFrameTest, RoundedCornerOnParentAndChild) {
50.0f, 20.0f);
{
auto* quad = root_pass->quad_list.front();
auto* shared_quad_state = quad->shared_quad_state;
auto* shared_quad_state = quad->shared_quad_state.get();
EXPECT_TRUE(shared_quad_state->mask_filter_info.HasRoundedCorners());
EXPECT_TRUE(shared_quad_state->is_fast_rounded_corner);
EXPECT_EQ(shared_quad_state->mask_filter_info.rounded_corner_bounds(),
@ -2098,7 +2098,7 @@ TEST_F(SlimLayerTreeCompositorFrameTest, RoundedCornerOnParentAndChild) {
{
auto* quad = root_pass->quad_list.ElementAt(1u);
auto* shared_quad_state = quad->shared_quad_state;
auto* shared_quad_state = quad->shared_quad_state.get();
EXPECT_TRUE(shared_quad_state->mask_filter_info.HasRoundedCorners());
EXPECT_TRUE(shared_quad_state->is_fast_rounded_corner);
EXPECT_EQ(shared_quad_state->mask_filter_info.rounded_corner_bounds(),
@ -2144,14 +2144,14 @@ TEST_F(SlimLayerTreeCompositorFrameTest, GradientMaskWithChild) {
viz::HasTransform(gfx::Transform()))));
{
auto* quad = pass->quad_list.front();
auto* shared_quad_state = quad->shared_quad_state;
auto* shared_quad_state = quad->shared_quad_state.get();
EXPECT_TRUE(shared_quad_state->mask_filter_info.HasGradientMask());
EXPECT_EQ(shared_quad_state->mask_filter_info.gradient_mask(), gradient);
}
{
auto* quad = pass->quad_list.ElementAt(1u);
auto* shared_quad_state = quad->shared_quad_state;
auto* shared_quad_state = quad->shared_quad_state.get();
EXPECT_TRUE(shared_quad_state->mask_filter_info.HasGradientMask());
EXPECT_EQ(shared_quad_state->mask_filter_info.gradient_mask(), gradient);
}
@ -2188,7 +2188,7 @@ TEST_F(SlimLayerTreeCompositorFrameTest, GradientMaskOnParentAndChild) {
viz::HasTransform(gfx::Transform()))));
{
auto* quad = child_pass->quad_list.front();
auto* shared_quad_state = quad->shared_quad_state;
auto* shared_quad_state = quad->shared_quad_state.get();
EXPECT_TRUE(shared_quad_state->mask_filter_info.HasGradientMask());
EXPECT_EQ(shared_quad_state->mask_filter_info.gradient_mask(),
child_gradient);
@ -2212,7 +2212,7 @@ TEST_F(SlimLayerTreeCompositorFrameTest, GradientMaskOnParentAndChild) {
viz::HasTransform(gfx::Transform()))));
{
auto* quad = root_pass->quad_list.front();
auto* shared_quad_state = quad->shared_quad_state;
auto* shared_quad_state = quad->shared_quad_state.get();
EXPECT_TRUE(shared_quad_state->mask_filter_info.HasGradientMask());
EXPECT_EQ(shared_quad_state->mask_filter_info.gradient_mask(),
parent_gradient);
@ -2220,7 +2220,7 @@ TEST_F(SlimLayerTreeCompositorFrameTest, GradientMaskOnParentAndChild) {
{
auto* quad = root_pass->quad_list.ElementAt(1u);
auto* shared_quad_state = quad->shared_quad_state;
auto* shared_quad_state = quad->shared_quad_state.get();
EXPECT_TRUE(shared_quad_state->mask_filter_info.HasGradientMask());
EXPECT_EQ(shared_quad_state->mask_filter_info.gradient_mask(),
parent_gradient);

@ -112,7 +112,7 @@ Browser* WebsiteMetricsBrowserTestMixin::CreateBrowser() {
::ui::PAGE_TRANSITION_AUTO_TOPLEVEL);
params.disposition = disposition;
Navigate(&params);
auto* const contents = params.navigated_or_inserted_contents;
auto* const contents = params.navigated_or_inserted_contents.get();
CHECK_EQ(::chrome::FindBrowserWithTab(params.navigated_or_inserted_contents),
browser);
::content::TestNavigationObserver observer(contents);

@ -258,7 +258,7 @@ class BrowserAppInstanceTrackerTest : public InProcessBrowserTest {
ui::PAGE_TRANSITION_AUTO_TOPLEVEL);
params.disposition = disposition;
Navigate(&params);
auto* contents = params.navigated_or_inserted_contents;
auto* contents = params.navigated_or_inserted_contents.get();
DCHECK_EQ(chrome::FindBrowserWithTab(params.navigated_or_inserted_contents),
browser);
content::TestNavigationObserver observer(contents);

@ -611,7 +611,7 @@ void BrowserServiceLacros::OpenUrlImpl(Profile* profile,
Navigate(&navigate_params);
auto* tab = navigate_params.navigated_or_inserted_contents;
auto* tab = navigate_params.navigated_or_inserted_contents.get();
if (tab && params->from == crosapi::mojom::OpenUrlFrom::kArc) {
// Add a flag to remember this tab originated in the ARC context.
tab->SetUserData(&arc::ArcWebContentsData::kArcTransitionFlag,

@ -125,8 +125,9 @@ Value::List ChromePolicyConversionsClient::GetExtensionPolicies(
const bool for_signin_screen =
policy_domain == POLICY_DOMAIN_SIGNIN_EXTENSIONS;
#if BUILDFLAG(IS_CHROMEOS_ASH)
Profile* extension_profile =
for_signin_screen ? ash::ProfileHelper::GetSigninProfile() : profile_;
Profile* extension_profile = for_signin_screen
? ash::ProfileHelper::GetSigninProfile()
: profile_.get();
#else // BUILDFLAG(IS_CHROMEOS_ASH)
Profile* extension_profile = profile_;
#endif // BUILDFLAG(IS_CHROMEOS_ASH)

@ -5,7 +5,7 @@
#ifndef CHROME_BROWSER_POLICY_CHROME_POLICY_CONVERSIONS_CLIENT_H_
#define CHROME_BROWSER_POLICY_CHROME_POLICY_CONVERSIONS_CLIENT_H_
#include "base/memory/raw_ptr_exclusion.h"
#include "base/memory/raw_ptr.h"
#include "build/chromeos_buildflags.h"
#include "components/policy/core/browser/policy_conversions_client.h"
@ -43,9 +43,7 @@ class ChromePolicyConversionsClient : public PolicyConversionsClient {
#endif
private:
// This field is not a raw_ptr<> because of missing |.get()| in not-rewritten
// platform specific code.
RAW_PTR_EXCLUSION Profile* profile_;
raw_ptr<Profile> profile_;
};
} // namespace policy

@ -370,7 +370,7 @@ void ChromeNewWindowClient::OpenUrl(const GURL& url,
navigate_params.browser->window()->GetNativeWindow());
}
auto* tab = navigate_params.navigated_or_inserted_contents;
auto* tab = navigate_params.navigated_or_inserted_contents.get();
if (from == OpenUrlFrom::kArc && tab) {
// Add a flag to remember this tab originated in the ARC context.
tab->SetUserData(&arc::ArcWebContentsData::kArcTransitionFlag,

@ -122,7 +122,7 @@ class BrowserStatusMonitor : public BrowserListObserver,
std::set<raw_ptr<Browser, SetExperimental>> known_browsers_;
// Tabs that are removed from one browser and are getting reinserted into
// another.
std::set<raw_ptr<content::WebContents, SetExperimental>> tabs_in_transit_;
std::set<raw_ptr<content::WebContents, DanglingUntriaged>> tabs_in_transit_;
#endif
};

@ -11,7 +11,6 @@
#include <vector>
#include "base/memory/raw_ptr.h"
#include "base/memory/raw_ptr_exclusion.h"
#include "base/memory/ref_counted.h"
#include "base/time/time.h"
#include "build/build_config.h"
@ -159,11 +158,8 @@ struct NavigateParams {
// new WebContents, this field will remain NULL and the WebContents deleted if
// the WebContents it created is not added to a TabStripModel before
// Navigate() returns.
//
// This field is not a raw_ptr<> because of missing |.get()| in not-rewritten
// platform specific code.
RAW_PTR_EXCLUSION content::WebContents* navigated_or_inserted_contents =
nullptr;
raw_ptr<content::WebContents, DanglingUntriaged>
navigated_or_inserted_contents = nullptr;
// [in] The WebContents that initiated the Navigate() request if such
// context is necessary. Default is NULL, i.e. no context.

@ -9,6 +9,7 @@
#include "base/command_line.h"
#include "base/functional/bind.h"
#include "base/location.h"
#include "base/memory/raw_ptr.h"
#include "base/metrics/histogram_functions.h"
#include "base/metrics/user_metrics.h"
#include "base/notreached.h"
@ -378,8 +379,8 @@ void FullscreenController::FullscreenTabOpeningPopup(
void FullscreenController::OnTabDeactivated(
content::WebContents* web_contents) {
base::AutoReset<content::WebContents*> auto_resetter(&deactivated_contents_,
web_contents);
base::AutoReset<raw_ptr<content::WebContents>> auto_resetter(
&deactivated_contents_, web_contents);
ExclusiveAccessControllerBase::OnTabDeactivated(web_contents);
}

@ -6,7 +6,7 @@
#define CHROME_BROWSER_UI_EXCLUSIVE_ACCESS_FULLSCREEN_CONTROLLER_H_
#include "base/functional/callback.h"
#include "base/memory/raw_ptr_exclusion.h"
#include "base/memory/raw_ptr.h"
#include "base/memory/weak_ptr.h"
#include "base/observer_list.h"
#include "base/task/cancelable_task_tracker.h"
@ -245,9 +245,7 @@ class FullscreenController : public ExclusiveAccessControllerBase {
// Set in OnTabDeactivated(). Used to see if we're in the middle of
// deactivation of a tab.
// This field is not a raw_ptr<> because it was filtered by the rewriter for:
// #addr-of
RAW_PTR_EXCLUSION content::WebContents* deactivated_contents_ = nullptr;
raw_ptr<content::WebContents> deactivated_contents_ = nullptr;
// Used in testing to set the state to tab fullscreen.
bool is_tab_fullscreen_for_testing_ = false;

@ -11,7 +11,6 @@
#include <vector>
#include "base/memory/raw_ptr.h"
#include "base/memory/raw_ptr_exclusion.h"
#include "chrome/browser/ui/tabs/tab_change_type.h"
#include "components/sessions/core/session_id.h"
#include "components/tab_groups/tab_group_id.h"
@ -78,9 +77,7 @@ class TabStripModelChange {
void WriteIntoTrace(perfetto::TracedValue context) const;
// This field is not a raw_ptr<> because of incompatibilities with tracing
// in not-rewritten platform specific code.
RAW_PTR_EXCLUSION content::WebContents* contents;
raw_ptr<content::WebContents, DanglingUntriaged> contents;
int index;
RemoveReason remove_reason;
std::optional<SessionID> session_id;

@ -2,8 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "base/memory/raw_ptr.h"
#include "base/memory/raw_ptr_exclusion.h"
#include "base/memory/stack_allocated.h"
#include "base/strings/string_util.h"
#include "base/test/bind.h"
#include "base/test/scoped_feature_list.h"
@ -87,12 +86,13 @@ class WebAppTabStripBrowserTest : public WebAppBrowserTestBase {
}
struct App {
STACK_ALLOCATED();
public:
webapps::AppId id;
raw_ptr<Browser> browser;
raw_ptr<BrowserView> browser_view;
// This field is not a raw_ptr<> because of missing |.get()| in
// not-rewritten platform specific code.
RAW_PTR_EXCLUSION content::WebContents* web_contents;
Browser* browser;
BrowserView* browser_view;
content::WebContents* web_contents;
};
App InstallAndLaunch() {

@ -72,8 +72,8 @@ enum SECItemType {
struct SECItem {
SECItemType type;
// This field is not a raw_ptr<> because non Windows platforms uses SECItem
// from seccomon.h which is not in this repo and doesn't use raw_ptr<>.
// RAW_PTR_EXCLUSION: Non-Windows platforms use SECItem from seccomon.h, which
// is not in this repo and doesn't use raw_ptr<>.
RAW_PTR_EXCLUSION unsigned char* data;
unsigned int len;
};

@ -38,7 +38,8 @@ class PopupNavigationDelegate {
// Performs the navigation.
struct NavigateResult {
raw_ptr<content::WebContents> navigated_or_inserted_contents = nullptr;
raw_ptr<content::WebContents, DanglingUntriaged>
navigated_or_inserted_contents = nullptr;
WindowOpenDisposition disposition = WindowOpenDisposition::UNKNOWN;
};
virtual NavigateResult NavigateWithGesture(

@ -8,7 +8,7 @@
#include <stddef.h>
#include "base/functional/callback.h"
#include "base/memory/raw_ptr_exclusion.h"
#include "base/memory/raw_ptr.h"
#include "components/viz/common/quads/shared_quad_state.h"
#include "components/viz/common/resources/resource_id.h"
#include "components/viz/common/viz_common_export.h"
@ -76,9 +76,7 @@ class VIZ_COMMON_EXPORT DrawQuad {
// Stores state common to a large bundle of quads; kept separate for memory
// efficiency. There is special treatment to reconstruct these pointers
// during serialization.
// This field is not a raw_ptr<> because of missing |.get()| in not-rewritten
// platform specific code.
RAW_PTR_EXCLUSION const SharedQuadState* shared_quad_state;
raw_ptr<const SharedQuadState, DanglingUntriaged> shared_quad_state;
bool IsDebugQuad() const { return material == Material::kDebugBorder; }

@ -90,7 +90,7 @@ gfx::CALayerResult FromRenderPassQuad(
return gfx::kCALayerFailedRenderPassBackdropFilters;
}
auto* shared_quad_state = quad->shared_quad_state;
auto* shared_quad_state = quad->shared_quad_state.get();
if (shared_quad_state->sorting_context_id != 0)
return gfx::kCALayerFailedRenderPassSortingContextId;

@ -14,6 +14,7 @@
#include "base/auto_reset.h"
#include "base/containers/circular_deque.h"
#include "base/logging.h"
#include "base/memory/raw_ptr.h"
#include "base/metrics/histogram_macros.h"
#include "base/numerics/safe_conversions.h"
#include "base/timer/elapsed_timer.h"
@ -587,7 +588,7 @@ void DirectRenderer::FlushPolygons(
void DirectRenderer::DrawRenderPassAndExecuteCopyRequests(
AggregatedRenderPass* render_pass) {
base::AutoReset<const AggregatedRenderPass*> current_render_pass(
base::AutoReset<raw_ptr<const AggregatedRenderPass>> current_render_pass(
&current_frame()->current_render_pass, render_pass);
if (render_pass_bypass_quads_.find(render_pass->id) !=

@ -14,7 +14,6 @@
#include "base/containers/flat_map.h"
#include "base/functional/callback.h"
#include "base/memory/raw_ptr.h"
#include "base/memory/raw_ptr_exclusion.h"
#include "base/time/time.h"
#include "build/build_config.h"
#include "components/viz/common/quads/aggregated_render_pass.h"
@ -139,9 +138,7 @@ class VIZ_SERVICE_EXPORT DirectRenderer {
raw_ptr<const AggregatedRenderPassList> render_passes_in_draw_order =
nullptr;
raw_ptr<const AggregatedRenderPass> root_render_pass = nullptr;
// This field is not a raw_ptr<> because of a reference to raw_ptr in
// not-rewritten platform specific code and #addr-of.
RAW_PTR_EXCLUSION const AggregatedRenderPass* current_render_pass = nullptr;
raw_ptr<const AggregatedRenderPass> current_render_pass = nullptr;
gfx::Rect root_damage_rect;
std::vector<gfx::Rect> root_content_bounds;

@ -582,7 +582,7 @@ void DebugDrawFrame(
render_pass->transform_to_root_target.ToDecomposedString().c_str());
for (auto* quad : render_pass->quad_list) {
auto* sqs = quad->shared_quad_state;
auto* sqs = quad->shared_quad_state.get();
auto quad_to_root_transform = sqs->quad_to_target_transform;
if (non_root_passes_in_root_space()) {
quad_to_root_transform.PostConcat(

@ -9,7 +9,6 @@
#include <vector>
#include "base/containers/flat_map.h"
#include "base/memory/raw_ptr.h"
#include "base/memory/raw_ptr_exclusion.h"
#include "build/build_config.h"
#include "components/viz/common/quads/aggregated_render_pass.h"
@ -224,8 +223,7 @@ class VIZ_SERVICE_EXPORT OverlayCandidate {
// If |rpdq| is present, then the renderer must draw the filter effects and
// copy the result into the buffer backing of a render pass.
// This field is not a raw_ptr<> because of missing |.get()| in not-rewritten
// platform specific code.
// RAW_PTR_EXCLUSION: #addr-of
RAW_PTR_EXCLUSION const AggregatedRenderPassDrawQuad* rpdq = nullptr;
// Quad |shared_quad_state| opacity is ubiquitous for quad types

@ -899,7 +899,7 @@ TEST_F(DCLayerOverlayTest, RoundedCorners) {
auto* root_pass = pass_list.back().get();
auto* replaced_quad = root_pass->quad_list.back();
auto* replaced_sqs = replaced_quad->shared_quad_state;
auto* replaced_sqs = replaced_quad->shared_quad_state.get();
// The video should be forced to an underlay mode, even there is nothing on
// top.
@ -957,7 +957,7 @@ TEST_F(DCLayerOverlayTest, RoundedCorners) {
auto* root_pass = pass_list.back().get();
auto* replaced_quad = root_pass->quad_list.back();
auto* replaced_sqs = replaced_quad->shared_quad_state;
auto* replaced_sqs = replaced_quad->shared_quad_state.get();
// still in an underlay mode.
EXPECT_EQ(1U, dc_layer_list.size());
@ -1015,7 +1015,7 @@ TEST_F(DCLayerOverlayTest, RoundedCorners) {
auto* root_pass = pass_list.back().get();
auto* replaced_quad = root_pass->quad_list.back();
auto* replaced_sqs = replaced_quad->shared_quad_state;
auto* replaced_sqs = replaced_quad->shared_quad_state.get();
// still in an underlay mode.
EXPECT_EQ(1U, dc_layer_list.size());

@ -3420,7 +3420,7 @@ void SkiaRenderer::CopyDrawnRenderPass(
// Root framebuffer uses a zero-mailbox in SkiaOutputSurface.
gpu::Mailbox mailbox;
const auto* const render_pass = current_frame()->current_render_pass;
const auto* const render_pass = current_frame()->current_render_pass.get();
AggregatedRenderPassId render_pass_id = render_pass->id;
auto it = render_pass_backings_.find(render_pass_id);
if (it != render_pass_backings_.end()) {
@ -3848,11 +3848,12 @@ void SkiaRenderer::PrepareRenderPassOverlay(
// the |current_render_pass| is nullptr during ScheduleOverlays(), since all
// overlay quads should be in the |root_render_pass|, before they are promoted
// to overlays, so set the |root_render_pass| to the |current_render_pass|.
base::AutoReset<const AggregatedRenderPass*> auto_reset_current_render_pass(
&current_frame()->current_render_pass, current_frame()->root_render_pass);
base::AutoReset<raw_ptr<const AggregatedRenderPass>>
auto_reset_current_render_pass(&current_frame()->current_render_pass,
current_frame()->root_render_pass);
auto* shared_quad_state =
const_cast<SharedQuadState*>(quad->shared_quad_state);
const_cast<SharedQuadState*>(quad->shared_quad_state.get());
std::optional<gfx::Transform> quad_to_target_transform_inverse;
if (shared_quad_state->quad_to_target_transform.IsInvertible()) {

@ -504,7 +504,7 @@ void SurfaceAggregator::AddRenderPassFilterDamageToDamageList(
GetExpandedRectWithPixelMovingForegroundFilter(
*render_pass_quad, child_render_pass.filters);
} else if (child_render_pass.backdrop_filters.HasFilterThatMovesPixels()) {
const auto* shared_quad_state = render_pass_quad->shared_quad_state;
const auto* shared_quad_state = render_pass_quad->shared_quad_state.get();
damage_rect_in_target_space = cc::MathUtil::MapEnclosingClippedRect(
shared_quad_state->quad_to_target_transform, damage_rect);
if (shared_quad_state->clip_rect) {

@ -8828,7 +8828,7 @@ TEST_F(SurfaceAggregatorValidSurfaceTest, PerQuadDamageSameSharedQuadState) {
int draw_rect_index = 0;
for (auto* quad : output_root_pass->quad_list) {
auto* quad_sqs = quad->shared_quad_state;
auto* quad_sqs = quad->shared_quad_state.get();
EXPECT_TRUE(quad_sqs->overlay_damage_index.has_value());
EXPECT_EQ(
aggregated_frame

@ -5099,7 +5099,7 @@ namespace {
uint32_t SendTouchTapWithExpectedTarget(
RenderWidgetHostViewBase* root_view,
const gfx::Point& touch_point,
RenderWidgetHostViewInput*& router_touch_target,
raw_ptr<RenderWidgetHostViewInput>& router_touch_target,
RenderWidgetHostViewBase* expected_target,
RenderWidgetHostImpl* child_render_widget_host) {
auto* root_view_aura = static_cast<RenderWidgetHostViewAura*>(root_view);
@ -5203,7 +5203,7 @@ void SendGestureTapSequenceWithExpectedTarget(
void SendTouchpadPinchSequenceWithExpectedTarget(
RenderWidgetHostViewBase* root_view,
const gfx::Point& gesture_point,
RenderWidgetHostViewInput*& router_touchpad_gesture_target,
raw_ptr<RenderWidgetHostViewInput>& router_touchpad_gesture_target,
RenderWidgetHostViewBase* expected_target) {
auto* root_view_aura = static_cast<RenderWidgetHostViewAura*>(root_view);
@ -5255,7 +5255,7 @@ void SendTouchpadPinchSequenceWithExpectedTarget(
void SendTouchpadFlingSequenceWithExpectedTarget(
RenderWidgetHostViewBase* root_view,
const gfx::Point& gesture_point,
RenderWidgetHostViewInput*& router_wheel_target,
raw_ptr<RenderWidgetHostViewInput>& router_wheel_target,
RenderWidgetHostViewBase* expected_target) {
auto* root_view_aura = static_cast<RenderWidgetHostViewAura*>(root_view);

@ -257,7 +257,7 @@ id MockGestureEvent(NSEventType type,
void SendMacTouchpadPinchSequenceWithExpectedTarget(
RenderWidgetHostViewBase* root_view,
const gfx::Point& gesture_point,
RenderWidgetHostViewInput*& router_touchpad_gesture_target,
raw_ptr<RenderWidgetHostViewInput>& router_touchpad_gesture_target,
RenderWidgetHostViewBase* expected_target) {
auto* root_view_mac = static_cast<RenderWidgetHostViewMac*>(root_view);
RenderWidgetHostViewCocoa* cocoa_view = root_view_mac->GetInProcessNSView();

@ -13,16 +13,15 @@
#include "base/gtest_prod_util.h"
#include "base/memory/raw_ptr.h"
#include "base/memory/raw_ptr_exclusion.h"
#include "base/memory/weak_ptr.h"
#include "components/input/event_with_latency_info.h"
#include "components/viz/common/hit_test/hit_test_query.h"
#include "components/viz/common/hit_test/hit_test_region_observer.h"
#include "components/viz/common/surfaces/surface_id.h"
#include "content/common/input/touch_emulator_client.h"
#include "content/common/input/render_widget_targeter.h"
#include "content/common/content_export.h"
#include "content/common/input/render_widget_host_view_input_observer.h"
#include "content/common/input/render_widget_targeter.h"
#include "content/common/input/touch_emulator_client.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "third_party/blink/public/mojom/input/input_event_result.mojom-shared.h"
#include "ui/gfx/geometry/transform.h"
@ -365,22 +364,15 @@ class CONTENT_EXPORT RenderWidgetHostInputEventRouter final
FrameSinkIdOwnerMap owner_map_;
TargetMap touchscreen_gesture_target_map_;
// This field is not a raw_ptr<> because of a reference to raw_ptr in
// not-rewritten platform specific code.
RAW_PTR_EXCLUSION RenderWidgetHostViewInput* touch_target_ = nullptr;
raw_ptr<RenderWidgetHostViewInput> touch_target_ = nullptr;
base::WeakPtr<RenderWidgetHostViewInput> touchscreen_gesture_target_;
bool touchscreen_gesture_target_moved_recently_ = false;
bool touchscreen_gesture_target_moved_recently_for_iov2_ = false;
// // This field is not a raw_ptr<> because of a reference to raw_ptr in
// not-rewritten platform specific code.
RAW_PTR_EXCLUSION RenderWidgetHostViewInput* touchpad_gesture_target_ =
nullptr;
raw_ptr<RenderWidgetHostViewInput> touchpad_gesture_target_ = nullptr;
raw_ptr<RenderWidgetHostViewInput> bubbling_gesture_scroll_target_ = nullptr;
raw_ptr<RenderWidgetHostViewInput> bubbling_gesture_scroll_origin_ = nullptr;
// Used to target wheel events for the duration of a scroll.
// This field is not a raw_ptr<> because of missing |.get()| in not-rewritten
// platform specific code.
RAW_PTR_EXCLUSION RenderWidgetHostViewInput* wheel_target_ = nullptr;
raw_ptr<RenderWidgetHostViewInput> wheel_target_ = nullptr;
// Maintains the same target between mouse down and mouse up.
raw_ptr<RenderWidgetHostViewInput> mouse_capture_target_ = nullptr;
// There is no mouse capture set if a mouse down event dispatches to main

@ -55,32 +55,6 @@ blink::SVGFilterBuilder::last_effect_
# global variable is in a build configuration specific code
base::android::ReachedAddressesBitset::reached_
# Populated manually - missing |.get()| in not-rewritten platform specific code
viz::OverlayCandidate::rpdq
viz::CALayerOverlay::rpdq
viz::DrawQuad::shared_quad_state
content::RenderWidgetHostInputEventRouter::wheel_target_
NavigateParams::navigated_or_inserted_contents
web_app::WebAppTabStripBrowserTest::App::web_contents
policy::ChromePolicyConversionsClient::profile_
# Populated manually - reference to raw_ptr in not-rewritten platform specific code
viz::DirectRenderer::DrawingFrame::current_render_pass
TabGroupViews::header_
TabGroupViews::underline_
TabGroupViews::highlight_
views::LayoutManager::view_setting_visibility_on_
FullscreenController::deactivated_contents_
content::RenderWidgetHostInputEventRouter::touch_target_
content::RenderWidgetHostInputEventRouter::touchpad_gesture_target_
base::MessagePumpLibevent::run_state_
# Populated manually - incompatibilities with tracing in not-rewritten platform specific code
TabStripModelChange::RemovedTab::contents
# Populated manually - extra .get() added in not-rewritten platform specific code
SECItem::data
# Populated manually - the rewriter has trouble appending |.get()| inside macros
# that work with |XDisplay*|.
extensions::GlobalShortcutListenerX11::x_display_
@ -169,10 +143,11 @@ courgette::LabelManagerTest_SimpleIndexAssigner_Test::TestBody()::TestCase::expe
# as a pointer to PA memory
sandbox::TargetProcess::base_address_ # https://crbug.com/1173374
# Populated manually - pointers that kernel sees as raw pointers
# https://crbug.com/1395075
base::(anonymous namespace)::kernel_sigaction::k_sa_handler
base::(anonymous namespace)::kernel_sigaction::k_sa_restorer
# Populated manually - pointers that other code (e.g. kernel code) sees a
# different version of the struct/class, which uses a raw pointer.
base::(anonymous namespace)::kernel_sigaction::k_sa_handler # https://crbug.com/1395075
base::(anonymous namespace)::kernel_sigaction::k_sa_restorer # as above
SECItem::data
# Populated manually - uninitialized memory reinterpret_cast to raw_ptr<T>
# causing AddRef/Deref mismatch.

@ -58,7 +58,7 @@ void LayoutManager::ViewVisibilitySet(View* host,
void LayoutManager::SetViewVisibility(View* view, bool visible) {
DCHECK(!view->parent() || view->parent()->GetLayoutManager() == this ||
view->parent()->GetLayoutManager() == nullptr);
base::AutoReset<View*> setter(&view_setting_visibility_on_, view);
base::AutoReset<raw_ptr<View>> setter(&view_setting_visibility_on_, view);
view->SetVisible(visible);
}

@ -8,7 +8,6 @@
#include <vector>
#include "base/memory/raw_ptr.h"
#include "base/memory/raw_ptr_exclusion.h"
#include "ui/views/layout/layout_types.h"
#include "ui/views/views_export.h"
@ -118,9 +117,7 @@ class VIEWS_EXPORT LayoutManager {
private:
friend class views::View;
// This field is not a raw_ptr<> because of a reference to raw_ptr in
// not-rewritten platform specific code and #addr-of.
RAW_PTR_EXCLUSION View* view_setting_visibility_on_ = nullptr;
raw_ptr<View> view_setting_visibility_on_ = nullptr;
};
} // namespace views