Skip to content

Commit

Permalink
dbus: Remove ObjectProxy crash debugging code
Browse files Browse the repository at this point in the history
The crashes seem to be caused by memory corruption from
other parts of code. And they stopped since M97 (from field
and from lab). Assuming the issue is fixed and clean up the
debugging code.

Bug: 1211451, b:192617139
Change-Id: I88f6cb0c06d825353aed118d3b5eecafb315a694
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3312038
Reviewed-by: Ryo Hashimoto <[email protected]>
Commit-Queue: Xiyuan Xia <[email protected]>
Cr-Commit-Position: refs/heads/main@{#947519}
  • Loading branch information
Xiyuan Xia authored and Chromium LUCI CQ committed Dec 2, 2021
1 parent 4477acb commit 4ca2766
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 33 deletions.
29 changes: 0 additions & 29 deletions dbus/object_proxy.cc
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,6 @@ ObjectProxy::ReplyCallbackHolder::ReleaseCallback() {
return std::move(callback_);
}

bool ObjectProxy::ReplyCallbackHolder::IsNullCallback() const {
return callback_.is_null();
}

ObjectProxy::ObjectProxy(Bus* bus,
const std::string& service_name,
const ObjectPath& object_path,
Expand Down Expand Up @@ -182,10 +178,6 @@ std::unique_ptr<Response> ObjectProxy::CallMethodAndBlock(
void ObjectProxy::CallMethod(MethodCall* method_call,
int timeout_ms,
ResponseCallback callback) {
// `callback` should not be null. Otherwise, it crashes later in OnCallMethod.
// TODO(http://crbug/1211451): Remove after fix.
CHECK(!callback.is_null());

auto internal_callback = base::BindOnce(
&ObjectProxy::OnCallMethod, this, method_call->GetInterface(),
method_call->GetMember(), std::move(callback));
Expand All @@ -204,8 +196,6 @@ void ObjectProxy::CallMethodWithErrorResponse(

ReplyCallbackHolder callback_holder(bus_->GetOriginTaskRunner(),
std::move(callback));
// TODO(http://crbug/1211451): Remove after fix.
CHECK(!callback_holder.IsNullCallback());

if (!method_call->SetDestination(service_name_) ||
!method_call->SetPath(object_path_)) {
Expand Down Expand Up @@ -351,9 +341,6 @@ void ObjectProxy::StartAsyncMethodCall(int timeout_ms,
base::ScopedBlockingCall scoped_blocking_call(FROM_HERE,
base::BlockingType::MAY_BLOCK);

// TODO(http://crbug/1211451): Remove after fix.
CHECK(!callback_holder.IsNullCallback());

if (!bus_->Connect() || !bus_->SetUpAsyncOperations()) {
// In case of a failure, run the error callback with nullptr.
base::OnceClosure task =
Expand Down Expand Up @@ -396,9 +383,6 @@ void ObjectProxy::OnPendingCallIsComplete(ReplyCallbackHolder callback_holder,
base::ScopedBlockingCall scoped_blocking_call(FROM_HERE,
base::BlockingType::MAY_BLOCK);

// TODO(http://crbug/1211451): Remove after fix.
CHECK(!callback_holder.IsNullCallback());

DBusMessage* response_message = dbus_pending_call_steal_reply(pending_call);

// Either |response| or |error_response| takes ownership of the
Expand Down Expand Up @@ -452,9 +436,6 @@ void ObjectProxy::RunResponseOrErrorCallback(
base::TimeTicks start_time,
Response* response,
ErrorResponse* error_response) {
// TODO(http://crbug/1211451): Remove after fix.
CHECK(!callback_holder.IsNullCallback());

bus_->AssertOnOriginThread();
callback_holder.ReleaseCallback().Run(response, error_response);

Expand Down Expand Up @@ -647,16 +628,6 @@ void ObjectProxy::OnCallMethod(const std::string& interface_name,
ResponseCallback response_callback,
Response* response,
ErrorResponse* error_response) {
// Crash on null `response_callback` with details of the call.
// TODO(http://crbug/1211451): Remove after fix.
DEBUG_ALIAS_FOR_CSTR(interface_name_copy, interface_name.c_str(), 64);
DEBUG_ALIAS_FOR_CSTR(method_name_copy, method_name.c_str(), 64);
DEBUG_ALIAS_FOR_CSTR(object_path_copy, object_path_.value().c_str(), 64);
LOG_IF(FATAL, response_callback.is_null())
<< "Null response_callback"
<< ", method:" << interface_name << "." << method_name
<< ", obj=" << object_path_.value();

if (response) {
// Method call was successful.
std::move(response_callback).Run(response);
Expand Down
4 changes: 0 additions & 4 deletions dbus/object_proxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -251,10 +251,6 @@ class CHROME_DBUS_EXPORT ObjectProxy
// This must be called on the origin thread.
ResponseOrErrorCallback ReleaseCallback();

// Whether |callback_| is null.
// TODO(http://crbug/1211451): Remove after fix.
bool IsNullCallback() const;

private:
scoped_refptr<base::SequencedTaskRunner> origin_task_runner_;
ResponseOrErrorCallback callback_;
Expand Down

0 comments on commit 4ca2766

Please sign in to comment.