Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add AutoDisallowEvents to PaintOpBuffer and fix up and remove Asserts #792

Conversation

Domiii
Copy link

@Domiii Domiii commented Jul 1, 2023

@Domiii Domiii self-assigned this Jul 1, 2023
@Domiii Domiii changed the title RUN-2296: Add REPLAY_ASSERT_LIFECYCLE to ref_counter.h + more RUN-2296: Add REPLAY_ASSERT_REF_COUNTS to ref_counter.h + more Jul 2, 2023
Copy link

@bhackett1024 bhackett1024 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a bunch of complex refcount class logic here mixed in with assorted asserts. Please factor these out into separate PRs, this makes the changes much more difficult to review.

In addition to the comments I have serious concerns about these refcounting changes. All these macros are poorly documented and many seem unnecessary, this makes it a lot harder to see what changes we're making to chromium, their effects and possible performance implications.

More generally, in the past we've tried to assert refcount changes but it quickly gets to be very gnarly, as this PR demonstrates. I'd like to better understand why we need these now, and why we can't treat the object destruction as non-deterministic and not worry about the refcount changes matching precisely when replaying. Can we discuss this at the next crash fix meeting?

functionName, record_replay_id, refCount); \
} \
} \
static_assert(true, "require semicolon")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the value of assertWhenEventsDisallowed ? It is false in all the uses here. Also, the label is always non-null, why do we test for it (and compare it with zero which is confusing). All the branching here seems like it could be reduced to a single AssertMaybeEventsDisallowed call, which will be clearer and minimize overhead.

@@ -334,16 +374,20 @@ class RefCounted : public subtle::RefCountedBase {
static constexpr subtle::StartRefCountFromZeroTag kRefCountPreference =
subtle::kStartRefCountFromZeroTag;

REPLAY_REF_COUNT_DECLARE_STUB();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems pretty weird to be putting a RecordReplayId() member on every single refcounted object, which almost always returns zero. This sort of pollution will make it harder to rely on compiler type errors to fix problems in the code.

…n-2296-assert-lifecycle-of-displayitemlist-paintopbuffer-and
2. fix up Asserts
3. add `AutoDisallowEvents`
@Domiii
Copy link
Author

Domiii commented Jul 5, 2023

@bhackett1024:

There's a bunch of complex refcount class logic here mixed in with assorted asserts. Please factor these out into separate PRs, this makes the changes much more difficult to review.

In addition to the comments I have serious concerns about these refcounting changes. All these macros are poorly documented and many seem unnecessary, this makes it a lot harder to see what changes we're making to chromium, their effects and possible performance implications.

More generally, in the past we've tried to assert refcount changes but it quickly gets to be very gnarly, as this PR demonstrates. I'd like to better understand why we need these now

Yeah - I removed REPLAY_ASSERT_REF_COUNTS. We also discussed it internally and we agree with your assessment that these Asserts often won't lead to much. We need a better solution, and Chris will propose one soon.

why we can't treat the object destruction as non-deterministic and not worry about the refcount changes matching precisely when replaying

Ok, let's give it a try. If it does not work, we have something in the pipeline that might.

Can we discuss this at the next crash fix meeting?

Sure! Already jotted it down.

@Domiii Domiii requested a review from bhackett1024 July 5, 2023 14:56
@Domiii Domiii changed the title RUN-2296: Add REPLAY_ASSERT_REF_COUNTS to ref_counter.h + more Add AutoDisallowEvents to PaintOpBuffer and friends Jul 6, 2023
@Domiii Domiii changed the title Add AutoDisallowEvents to PaintOpBuffer and friends Add AutoDisallowEvents to PaintOpBuffer and fix up and remove Asserts Jul 6, 2023
@Domiii Domiii merged commit c275c6e into master Jul 6, 2023
1 check passed
@Domiii Domiii deleted the dominik/run-2296-assert-lifecycle-of-displayitemlist-paintopbuffer-and branch July 6, 2023 15:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants