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

Fix ThreadGroup unit tests for cobalt. #2232

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion base/debug/leak_annotations.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
// ANNOTATE_LEAKING_OBJECT_PTR(X): the heap object referenced by pointer X will
// be annotated as a leak.

#if defined(LEAK_SANITIZER) && !BUILDFLAG(IS_NACL)
#if defined(LEAK_SANITIZER) && !BUILDFLAG(IS_NACL) || defined(STARBOARD) && defined(ADDRESS_SANITIZER)

#include <sanitizer/lsan_interface.h>

Expand Down
23 changes: 14 additions & 9 deletions base/synchronization/condition_variable_starboard.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ namespace base {

ConditionVariable::ConditionVariable(Lock* user_lock)
: user_mutex_(user_lock->lock_.native_handle())
#if !defined(NDEBUG) || defined(DCHECK_ALWAYS_ON)
#if DCHECK_IS_ON()
,
user_lock_(user_lock)
#endif
Expand All @@ -40,31 +40,36 @@ ConditionVariable::~ConditionVariable() {
}

void ConditionVariable::Wait() {
internal::ScopedBlockingCallWithBaseSyncPrimitives scoped_blocking_call(FROM_HERE,
BlockingType::MAY_BLOCK);
#if !defined(NDEBUG) || defined(DCHECK_ALWAYS_ON)
absl::optional<internal::ScopedBlockingCallWithBaseSyncPrimitives>
scoped_blocking_call;
if (waiting_is_blocking_)
scoped_blocking_call.emplace(FROM_HERE, BlockingType::MAY_BLOCK);

#if DCHECK_IS_ON()
user_lock_->CheckHeldAndUnmark();
#endif
SbConditionVariableResult result =
SbConditionVariableWait(&condition_, user_mutex_);
DCHECK(SbConditionVariableIsSignaled(result));
#if !defined(NDEBUG) || defined(DCHECK_ALWAYS_ON)
#if DCHECK_IS_ON()
user_lock_->CheckUnheldAndMark();
#endif
}

void ConditionVariable::TimedWait(const TimeDelta& max_time) {
internal::ScopedBlockingCallWithBaseSyncPrimitives scoped_blocking_call(FROM_HERE,
BlockingType::MAY_BLOCK);
absl::optional<internal::ScopedBlockingCallWithBaseSyncPrimitives>
aee-google marked this conversation as resolved.
Show resolved Hide resolved
scoped_blocking_call;
if (waiting_is_blocking_)
scoped_blocking_call.emplace(FROM_HERE, BlockingType::MAY_BLOCK);
SbTime duration = max_time.ToSbTime();

#if !defined(NDEBUG) || defined(DCHECK_ALWAYS_ON)
#if DCHECK_IS_ON()
user_lock_->CheckHeldAndUnmark();
#endif
SbConditionVariableResult result =
SbConditionVariableWaitTimed(&condition_, user_mutex_, duration);
DCHECK_NE(kSbConditionVariableFailed, result);
#if !defined(NDEBUG) || defined(DCHECK_ALWAYS_ON)
#if DCHECK_IS_ON()
user_lock_->CheckUnheldAndMark();
#endif
}
Expand Down
Loading