This patch fixes the crash by AssertNoURLRequests().
Reference: https://review.tizen.org/gerrit/247190
Change-Id: Ibe1ab1c7b2360dd795211fe991cd6be2dd9f1409
Signed-off-by: Gajendra N <gajendra.n@samsung.com>
autofill::PersonalDataManagerFactory::GetInstance()
->PersonalDataManagerRemove(this);
#endif
-
- if (resource_context_) {
- resource_context_->set_url_request_context_getter(NULL);
+ ShutdownStoragePartitions();
+ if (resource_context_)
BrowserThread::DeleteSoon(BrowserThread::IO, FROM_HERE, resource_context_);
- }
}
-BrowserContextEfl::ResourceContextEfl::~ResourceContextEfl() {}
+BrowserContextEfl::ResourceContextEfl::~ResourceContextEfl() {
+ // |cookie_manager_| has access to
+ // |URLRequestContextGetterEfl::GetURLRequestContext()|. So it should be
+ // released before NotifyContextShuttingDown()
+ cookie_manager_ = nullptr;
+ if (getter_.get())
+ getter_->NotifyContextShuttingDown();
+}
bool BrowserContextEfl::ResourceContextEfl::HTTPCustomHeaderAdd(
const std::string& name,
io_task_runner);
}
-URLRequestContextGetterEfl::~URLRequestContextGetterEfl() {}
+URLRequestContextGetterEfl::~URLRequestContextGetterEfl() {
+ // NotifyContextShuttingDown() must have been called.
+ DCHECK_CURRENTLY_ON(BrowserThread::IO);
+ DCHECK(shut_down_);
+}
+
+void URLRequestContextGetterEfl::NotifyContextShuttingDown() {
+ DCHECK_CURRENTLY_ON(BrowserThread::IO);
+ shut_down_ = true;
+ URLRequestContextGetter::NotifyContextShuttingDown();
+}
net::URLRequestContext* URLRequestContextGetterEfl::GetURLRequestContext() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+ if (shut_down_)
+ return nullptr;
+
if (!url_request_context_) {
const base::CommandLine& command_line =
*base::CommandLine::ForCurrentProcess();
return weak_ptr_factory_.GetWeakPtr();
}
+ void NotifyContextShuttingDown();
+
protected:
virtual ~URLRequestContextGetterEfl();
bool ignore_certificate_errors_;
base::FilePath base_path_;
+ bool shut_down_ = false;
const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner_;
const scoped_refptr<base::SingleThreadTaskRunner>& file_task_runner_;
net::NetLog* net_log_;