Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1666)

Unified Diff: android_webview/browser/aw_browser_context.cc

Issue 23803005: Fix threading issues in aw form database (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: minor comment update Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | android_webview/browser/aw_form_database_service.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: android_webview/browser/aw_browser_context.cc
diff --git a/android_webview/browser/aw_browser_context.cc b/android_webview/browser/aw_browser_context.cc
index 9700645683e3a551ed056b8cae2a4e66a8bee5a0..3a1037bab3fe6075c3180a0b98090d811f1d421c 100644
--- a/android_webview/browser/aw_browser_context.cc
+++ b/android_webview/browser/aw_browser_context.cc
@@ -23,6 +23,8 @@
#include "content/public/browser/web_contents.h"
#include "net/url_request/url_request_context.h"
+using content::BrowserThread;
+
namespace android_webview {
namespace {
@@ -41,11 +43,11 @@ class AwResourceContext : public content::ResourceContext {
// content::ResourceContext implementation.
virtual net::HostResolver* GetHostResolver() OVERRIDE {
- DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
return getter_->GetURLRequestContext()->host_resolver();
}
virtual net::URLRequestContext* GetRequestContext() OVERRIDE {
- DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
return getter_->GetURLRequestContext();
}
virtual bool AllowMicAccess(const GURL& origin) OVERRIDE {
@@ -73,6 +75,10 @@ AwBrowserContext::AwBrowserContext(
user_pref_service_ready_(false) {
DCHECK(g_browser_context == NULL);
g_browser_context = this;
+
+ // This constructor is entered during the creation of ContentBrowserClient,
+ // before browser threads are created. Therefore any checks to enforce
+ // threading (such as BrowserThread::CurrentlyOn()) will fail here.
}
AwBrowserContext::~AwBrowserContext() {
@@ -109,6 +115,9 @@ void AwBrowserContext::PreMainMessageLoopRun() {
visitedlink_master_.reset(
new visitedlink::VisitedLinkMaster(this, this, false));
visitedlink_master_->Init();
+
+ form_database_service_.reset(
+ new AwFormDatabaseService(context_storage_path_));
}
void AwBrowserContext::AddVisitedURLs(const std::vector<GURL>& urls) {
@@ -146,10 +155,6 @@ AwQuotaManagerBridge* AwBrowserContext::GetQuotaManagerBridge() {
}
AwFormDatabaseService* AwBrowserContext::GetFormDatabaseService() {
- if (!form_database_service_) {
- form_database_service_.reset(
- new AwFormDatabaseService(context_storage_path_));
- }
return form_database_service_.get();
}
« no previous file with comments | « no previous file | android_webview/browser/aw_form_database_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698