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

Unified Diff: chrome/common/appcache/chrome_appcache_service.h

Issue 258008: Move initialization of ChromeURLRequestContexts to the IO thread. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: sync again, just in case Created 11 years, 2 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 | « chrome/common/appcache/appcache_dispatcher_host.cc ('k') | chrome/common/chrome_plugin_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/appcache/chrome_appcache_service.h
===================================================================
--- chrome/common/appcache/chrome_appcache_service.h (revision 29872)
+++ chrome/common/appcache/chrome_appcache_service.h (working copy)
@@ -20,52 +20,23 @@
// object, and those URLRequestContexts are refcounted independently of the
// owning profile.
//
-// All methods, including the dtor, are expected to be called on the IO thread
-// except for the ctor and the init method which are expected to be called on
-// the UI thread.
+// All methods, including the dtor, are expected to be called on the IO thread.
class ChromeAppCacheService
- : public base::RefCountedThreadSafe<ChromeAppCacheService>,
+ : public base::RefCounted<ChromeAppCacheService>,
public appcache::AppCacheService {
public:
- explicit ChromeAppCacheService()
- : is_initialized_(false), was_initialized_with_io_thread_(false) {
+ ChromeAppCacheService(const FilePath& data_directory,
+ bool is_incognito) {
+ Initialize(is_incognito ? FilePath()
+ : data_directory.Append(chrome::kAppCacheDirname));
}
-
- bool is_initialized() const { return is_initialized_; }
-
- void InitializeOnUIThread(const FilePath& data_directory,
- bool is_incognito) {
- DCHECK(!is_initialized_);
- is_initialized_ = true;
-
- // The I/O thread may be NULL during testing.
- base::Thread* io_thread = g_browser_process->io_thread();
- if (io_thread) {
- was_initialized_with_io_thread_ = true;
- io_thread->message_loop()->PostTask(FROM_HERE,
- NewRunnableMethod(this, &ChromeAppCacheService::InitializeOnIOThread,
- data_directory, is_incognito));
- }
- }
-
private:
- friend class base::RefCountedThreadSafe<ChromeAppCacheService>;
+ friend class base::RefCounted<ChromeAppCacheService>;
virtual ~ChromeAppCacheService() {
- DCHECK(!was_initialized_with_io_thread_ ||
- ChromeThread::CurrentlyOn(ChromeThread::IO));
- }
-
- void InitializeOnIOThread(const FilePath& data_directory,
- bool is_incognito) {
DCHECK(ChromeThread::CurrentlyOn(ChromeThread::IO));
- Initialize(is_incognito ? FilePath()
- : data_directory.Append(chrome::kAppCacheDirname));
}
-
- bool is_initialized_;
- bool was_initialized_with_io_thread_;
};
#endif // CHROME_COMMON_APPCACHE_CHROME_APPCACHE_SERVICE_H_
« no previous file with comments | « chrome/common/appcache/appcache_dispatcher_host.cc ('k') | chrome/common/chrome_plugin_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698