Notify net error asyncronously

Notifying net error syncronously would result in crash.
This commit is contained in:
Cheng Zhao 2017-08-02 11:07:03 +09:00
parent b315eb83fd
commit 4e2cb549c7
2 changed files with 6 additions and 3 deletions

View file

@ -15,6 +15,7 @@
#include "base/strings/string_util.h"
#include "base/synchronization/lock.h"
#include "base/task_runner.h"
#include "base/threading/thread_task_runner_handle.h"
#include "net/base/file_stream.h"
#include "net/base/filename_util.h"
#include "net/base/io_buffer.h"
@ -119,7 +120,10 @@ void URLRequestAsarJob::Start() {
weak_ptr_factory_.GetWeakPtr(),
base::Owned(meta_info)));
} else {
NotifyStartError(net::URLRequestStatus(net::URLRequestStatus::FAILED,
base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE,
base::Bind(&URLRequestAsarJob::DidOpen,
weak_ptr_factory_.GetWeakPtr(),
net::ERR_FILE_NOT_FOUND));
}
}

View file

@ -89,7 +89,6 @@ class URLRequestAsarJob : public net::URLRequestJob {
// Callback after fetching file info on a background thread.
void DidFetchMetaInfo(const FileMetaInfo* meta_info);
// Callback after opening file on a background thread.
void DidOpen(int result);