Revert "[WIP] refactor: (Part I) make the ownership of URLRequestContextGetter more clear (#13956)"

This reverts commit 1c0bb06d4a.
This commit is contained in:
Charles Kerr 2018-08-13 16:16:04 -07:00
parent 1c0bb06d4a
commit b9490177da
34 changed files with 1121 additions and 985 deletions

View file

@ -93,13 +93,16 @@ void URLRequestFetchJob::BeforeStartInUI(v8::Isolate* isolate,
if (options.Get("session", &val)) {
if (val->IsNull()) {
// We have to create the URLRequestContextGetter on UI thread.
url_request_context_getter_ =
new brightray::URLRequestContextGetter(nullptr, nullptr);
url_request_context_getter_ = new brightray::URLRequestContextGetter(
this, nullptr, base::FilePath(), true,
BrowserThread::GetTaskRunnerForThread(BrowserThread::IO), nullptr,
content::URLRequestInterceptorScopedVector());
} else {
mate::Handle<api::Session> session;
if (mate::ConvertFromV8(isolate, val, &session) && !session.IsEmpty()) {
AtomBrowserContext* browser_context = session->browser_context();
url_request_context_getter_ = browser_context->GetRequestContext();
url_request_context_getter_ =
browser_context->url_request_context_getter();
}
}
}
@ -164,8 +167,6 @@ void URLRequestFetchJob::StartAsync(std::unique_ptr<base::Value> options) {
request()->extra_request_headers().ToString());
fetcher_->Start();
url_request_context_getter_ = nullptr;
}
void URLRequestFetchJob::HeadersCompleted() {