Don't read Buffer in IO thread

This commit is contained in:
Cheng Zhao 2015-05-22 22:15:13 +08:00
parent d78efe7c22
commit b202bba2e6
6 changed files with 26 additions and 26 deletions

View file

@ -71,8 +71,6 @@ base::WeakPtr<AdapterRequestJob> AdapterRequestJob::GetWeakPtr() {
}
void AdapterRequestJob::CreateErrorJobAndStart(int error_code) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
real_job_ = new net::URLRequestErrorJob(
request(), network_delegate(), error_code);
real_job_->Start();
@ -81,25 +79,21 @@ void AdapterRequestJob::CreateErrorJobAndStart(int error_code) {
void AdapterRequestJob::CreateStringJobAndStart(const std::string& mime_type,
const std::string& charset,
const std::string& data) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
real_job_ = new URLRequestStringJob(
request(), network_delegate(), mime_type, charset, data);
real_job_->Start();
}
void AdapterRequestJob::CreateBufferJobAndStart(const std::string& mime_type,
const std::string& charset,
v8::Local<v8::Object> buffer) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
void AdapterRequestJob::CreateBufferJobAndStart(
const std::string& mime_type,
const std::string& charset,
scoped_refptr<base::RefCountedBytes> data) {
real_job_ = new URLRequestBufferJob(
request(), network_delegate(), mime_type, charset, buffer);
request(), network_delegate(), mime_type, charset, data);
real_job_->Start();
}
void AdapterRequestJob::CreateFileJobAndStart(const base::FilePath& path) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
real_job_ = asar::CreateJobFromPath(
path,
request(),
@ -111,8 +105,6 @@ void AdapterRequestJob::CreateFileJobAndStart(const base::FilePath& path) {
}
void AdapterRequestJob::CreateJobFromProtocolHandlerAndStart() {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
DCHECK(protocol_handler_);
real_job_ = protocol_handler_->MaybeCreateJob(request(),
network_delegate());
if (!real_job_.get())