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

Cherry pick PR #713: Fix crash in net fetcher #784

Merged
merged 1 commit into from
Jun 29, 2023
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
14 changes: 13 additions & 1 deletion net/url_request/url_fetcher_core.cc
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,9 @@ void URLFetcherCore::Start() {
}

void URLFetcherCore::Stop() {
if (delegate_task_runner_) // May be NULL in tests.
if (delegate_task_runner_) { // May be NULL in tests.
DCHECK(delegate_task_runner_->RunsTasksInCurrentSequence());
}

delegate_ = NULL;
fetcher_ = NULL;
Expand Down Expand Up @@ -779,8 +780,11 @@ void URLFetcherCore::StartURLRequest() {
if (!extra_request_headers_.IsEmpty())
request_->SetExtraRequestHeaders(extra_request_headers_);

#if defined(STARBOARD)
request_->SetLoadTimingInfoCallback(base::Bind(&URLFetcherCore::GetLoadTimingInfo,
base::Unretained(this)));
#endif

request_->Start();
}

Expand Down Expand Up @@ -1129,6 +1133,14 @@ void URLFetcherCore::AssertHasNoUploadData() const {
#if defined(STARBOARD)
void URLFetcherCore::GetLoadTimingInfo(
const net::LoadTimingInfo& timing_info) {
delegate_task_runner_->PostTask(
FROM_HERE,
base::Bind(&URLFetcherCore::GetLoadTimingInfoInDelegateThread,
this, timing_info));
}

void URLFetcherCore::GetLoadTimingInfoInDelegateThread(
const net::LoadTimingInfo& timing_info) {
// Check if the URLFetcherCore has been stopped before.
if (delegate_) {
delegate_->ReportLoadTimingInfo(timing_info);
Expand Down
1 change: 1 addition & 0 deletions net/url_request/url_fetcher_core.h
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ class URLFetcherCore : public base::RefCountedThreadSafe<URLFetcherCore>,
static void SetIgnoreCertificateRequests(bool ignored);
#if defined (STARBOARD)
void GetLoadTimingInfo(const net::LoadTimingInfo& timing_info);
void GetLoadTimingInfoInDelegateThread(const net::LoadTimingInfo& timing_info);
#endif // defined(STARBOARD)
private:
friend class base::RefCountedThreadSafe<URLFetcherCore>;
Expand Down
Loading