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

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

Issue 215024: Fix appcache_service and request_context referencing. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 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
Index: chrome/common/appcache/chrome_appcache_service.h
===================================================================
--- chrome/common/appcache/chrome_appcache_service.h (revision 26601)
+++ chrome/common/appcache/chrome_appcache_service.h (working copy)
@@ -9,6 +9,7 @@
#include "base/message_loop.h"
#include "base/ref_counted.h"
#include "base/task.h"
+#include "chrome/browser/browser_process.h"
#include "chrome/browser/chrome_thread.h"
#include "chrome/common/chrome_constants.h"
#include "webkit/appcache/appcache_service.h"
@@ -28,21 +29,21 @@
public:
explicit ChromeAppCacheService()
- : was_initialized_with_io_thread_(false) {
- DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI));
+ : is_initialized_(false), was_initialized_with_io_thread_(false) {
}
+ bool is_initialized() const { return is_initialized_; }
+
void InitializeOnUIThread(const FilePath& data_directory,
- URLRequestContext* request_context,
bool is_incognito) {
- DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI));
- set_request_context(request_context);
+ DCHECK(!is_initialized_);
+ is_initialized_ = true;
- // Some test cases run without an IO thread.
- MessageLoop* io_thread = ChromeThread::GetMessageLoop(ChromeThread::IO);
+ // 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->PostTask(FROM_HERE,
+ io_thread->message_loop()->PostTask(FROM_HERE,
NewRunnableMethod(this, &ChromeAppCacheService::InitializeOnIOThread,
data_directory, is_incognito));
}
@@ -63,6 +64,7 @@
: data_directory.Append(chrome::kAppCacheDirname));
}
+ bool is_initialized_;
bool was_initialized_with_io_thread_;
};

Powered by Google App Engine
This is Rietveld 408576698