Notify net error asyncronously
Notifying net error syncronously would result in crash.
This commit is contained in:
parent
b315eb83fd
commit
4e2cb549c7
2 changed files with 6 additions and 3 deletions
|
@ -15,6 +15,7 @@
|
||||||
#include "base/strings/string_util.h"
|
#include "base/strings/string_util.h"
|
||||||
#include "base/synchronization/lock.h"
|
#include "base/synchronization/lock.h"
|
||||||
#include "base/task_runner.h"
|
#include "base/task_runner.h"
|
||||||
|
#include "base/threading/thread_task_runner_handle.h"
|
||||||
#include "net/base/file_stream.h"
|
#include "net/base/file_stream.h"
|
||||||
#include "net/base/filename_util.h"
|
#include "net/base/filename_util.h"
|
||||||
#include "net/base/io_buffer.h"
|
#include "net/base/io_buffer.h"
|
||||||
|
@ -119,7 +120,10 @@ void URLRequestAsarJob::Start() {
|
||||||
weak_ptr_factory_.GetWeakPtr(),
|
weak_ptr_factory_.GetWeakPtr(),
|
||||||
base::Owned(meta_info)));
|
base::Owned(meta_info)));
|
||||||
} else {
|
} 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));
|
net::ERR_FILE_NOT_FOUND));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -89,7 +89,6 @@ class URLRequestAsarJob : public net::URLRequestJob {
|
||||||
// Callback after fetching file info on a background thread.
|
// Callback after fetching file info on a background thread.
|
||||||
void DidFetchMetaInfo(const FileMetaInfo* meta_info);
|
void DidFetchMetaInfo(const FileMetaInfo* meta_info);
|
||||||
|
|
||||||
|
|
||||||
// Callback after opening file on a background thread.
|
// Callback after opening file on a background thread.
|
||||||
void DidOpen(int result);
|
void DidOpen(int result);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue