The request should go through UI thread.
This commit is contained in:
parent
f63661256f
commit
b7c9f8ba1c
1 changed files with 16 additions and 5 deletions
|
@ -41,9 +41,10 @@ class AdapterRequestJob : public net::URLRequestJob {
|
||||||
protected:
|
protected:
|
||||||
virtual void Start() OVERRIDE {
|
virtual void Start() OVERRIDE {
|
||||||
DCHECK(!real_job_);
|
DCHECK(!real_job_);
|
||||||
real_job_ = new net::URLRequestErrorJob(
|
content::BrowserThread::PostTask(
|
||||||
request(), network_delegate(), net::ERR_NOT_IMPLEMENTED);
|
content::BrowserThread::UI,
|
||||||
real_job_->Start();
|
FROM_HERE,
|
||||||
|
base::Bind(&AdapterRequestJob::GetJobTypeInUI, base::Unretained(this)));
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void Kill() OVERRIDE {
|
virtual void Kill() OVERRIDE {
|
||||||
|
@ -94,9 +95,19 @@ class AdapterRequestJob : public net::URLRequestJob {
|
||||||
};
|
};
|
||||||
|
|
||||||
void GetJobTypeInUI() {
|
void GetJobTypeInUI() {
|
||||||
|
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
|
||||||
|
content::BrowserThread::PostTask(
|
||||||
|
content::BrowserThread::IO,
|
||||||
|
FROM_HERE,
|
||||||
|
base::Bind(&AdapterRequestJob::CreateJobAndStart,
|
||||||
|
base::Unretained(this)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CreateJobAndStart() {
|
void CreateJobAndStart() {
|
||||||
|
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
|
||||||
|
real_job_ = new net::URLRequestErrorJob(
|
||||||
|
request(), network_delegate(), net::ERR_NOT_IMPLEMENTED);
|
||||||
|
real_job_->Start();
|
||||||
}
|
}
|
||||||
|
|
||||||
scoped_refptr<net::URLRequestJob> real_job_;
|
scoped_refptr<net::URLRequestJob> real_job_;
|
||||||
|
@ -141,7 +152,7 @@ v8::Handle<v8::Value> Protocol::RegisterProtocol(const v8::Arguments& args) {
|
||||||
node::node_isolate, v8::Handle<v8::Function>::Cast(args[1]));
|
node::node_isolate, v8::Handle<v8::Function>::Cast(args[1]));
|
||||||
|
|
||||||
content::BrowserThread::PostTask(content::BrowserThread::IO,
|
content::BrowserThread::PostTask(content::BrowserThread::IO,
|
||||||
FROM_HERE,
|
FROM_HERE,
|
||||||
base::Bind(&RegisterProtocolInIO, scheme));
|
base::Bind(&RegisterProtocolInIO, scheme));
|
||||||
|
|
||||||
return v8::Undefined();
|
return v8::Undefined();
|
||||||
|
@ -158,7 +169,7 @@ v8::Handle<v8::Value> Protocol::UnregisterProtocol(const v8::Arguments& args) {
|
||||||
handlers_.erase(it);
|
handlers_.erase(it);
|
||||||
|
|
||||||
content::BrowserThread::PostTask(content::BrowserThread::IO,
|
content::BrowserThread::PostTask(content::BrowserThread::IO,
|
||||||
FROM_HERE,
|
FROM_HERE,
|
||||||
base::Bind(&UnregisterProtocolInIO, scheme));
|
base::Bind(&UnregisterProtocolInIO, scheme));
|
||||||
|
|
||||||
return v8::Undefined();
|
return v8::Undefined();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue