Commit 44acfec4 authored by perkj's avatar perkj Committed by Commit bot

Make sure Blink WebRTCSessionDescriptionRequest and WebRTCVoidRequest are...

Make sure Blink WebRTCSessionDescriptionRequest and WebRTCVoidRequest are deleted on the correct thread in RTCPeerConnectionHandler.
Blink objects must always be destroyed on the main render thread. Since the object holding WebRTCSessionDescriptionRequest and WebRTCVoidRequest in rtc_peerconnection_handler.cc are refcounted, the destructor is not ensured to run on the main render thread.

BUG=470047

Review URL: https://codereview.chromium.org/1023443007

Cr-Commit-Position: refs/heads/master@{#321989}
parent 4e9ea92c
......@@ -262,6 +262,7 @@ class CreateSessionDescriptionRequest
tracker_.TrackOnSuccess(desc);
webkit_request_.requestSucceeded(CreateWebKitSessionDescription(desc));
webkit_request_.reset();
delete desc;
}
void OnFailure(const std::string& error) override {
......@@ -273,10 +274,13 @@ class CreateSessionDescriptionRequest
tracker_.TrackOnFailure(error);
webkit_request_.requestFailed(base::UTF8ToUTF16(error));
webkit_request_.reset();
}
protected:
~CreateSessionDescriptionRequest() override {}
~CreateSessionDescriptionRequest() override {
DCHECK(webkit_request_.isNull());
}
const scoped_refptr<base::SingleThreadTaskRunner> main_thread_;
blink::WebRTCSessionDescriptionRequest webkit_request_;
......@@ -307,6 +311,7 @@ class SetSessionDescriptionRequest
}
tracker_.TrackOnSuccess(NULL);
webkit_request_.requestSucceeded();
webkit_request_.reset();
}
void OnFailure(const std::string& error) override {
if (!main_thread_->BelongsToCurrentThread()) {
......@@ -316,10 +321,13 @@ class SetSessionDescriptionRequest
}
tracker_.TrackOnFailure(error);
webkit_request_.requestFailed(base::UTF8ToUTF16(error));
webkit_request_.reset();
}
protected:
~SetSessionDescriptionRequest() override {}
~SetSessionDescriptionRequest() override {
DCHECK(webkit_request_.isNull());
}
private:
const scoped_refptr<base::SingleThreadTaskRunner> main_thread_;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment