OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_COMMON_APPCACHE_CHROME_APPCACHE_SERVICE_H_ | 5 #ifndef CHROME_COMMON_APPCACHE_CHROME_APPCACHE_SERVICE_H_ |
6 #define CHROME_COMMON_APPCACHE_CHROME_APPCACHE_SERVICE_H_ | 6 #define CHROME_COMMON_APPCACHE_CHROME_APPCACHE_SERVICE_H_ |
7 | 7 |
8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/ref_counted.h" | 10 #include "base/ref_counted.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 : public base::RefCountedThreadSafe<ChromeAppCacheService>, | 26 : public base::RefCountedThreadSafe<ChromeAppCacheService>, |
27 public appcache::AppCacheService { | 27 public appcache::AppCacheService { |
28 public: | 28 public: |
29 | 29 |
30 explicit ChromeAppCacheService() | 30 explicit ChromeAppCacheService() |
31 : was_initialized_with_io_thread_(false) { | 31 : was_initialized_with_io_thread_(false) { |
32 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI)); | 32 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI)); |
33 } | 33 } |
34 | 34 |
35 void InitializeOnUIThread(const FilePath& data_directory, | 35 void InitializeOnUIThread(const FilePath& data_directory, |
| 36 URLRequestContext* request_context, |
36 bool is_incognito) { | 37 bool is_incognito) { |
37 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI)); | 38 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI)); |
| 39 set_request_context(request_context); |
38 | 40 |
39 // Some test cases run without an IO thread. | 41 // Some test cases run without an IO thread. |
40 MessageLoop* io_thread = ChromeThread::GetMessageLoop(ChromeThread::IO); | 42 MessageLoop* io_thread = ChromeThread::GetMessageLoop(ChromeThread::IO); |
41 if (io_thread) { | 43 if (io_thread) { |
42 was_initialized_with_io_thread_ = true; | 44 was_initialized_with_io_thread_ = true; |
43 io_thread->PostTask(FROM_HERE, | 45 io_thread->PostTask(FROM_HERE, |
44 NewRunnableMethod(this, &ChromeAppCacheService::InitializeOnIOThread, | 46 NewRunnableMethod(this, &ChromeAppCacheService::InitializeOnIOThread, |
45 data_directory, is_incognito)); | 47 data_directory, is_incognito)); |
46 } | 48 } |
47 } | 49 } |
(...skipping 10 matching lines...) Expand all Loading... |
58 bool is_incognito) { | 60 bool is_incognito) { |
59 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::IO)); | 61 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::IO)); |
60 Initialize(is_incognito ? FilePath() | 62 Initialize(is_incognito ? FilePath() |
61 : data_directory.Append(chrome::kAppCacheDirname)); | 63 : data_directory.Append(chrome::kAppCacheDirname)); |
62 } | 64 } |
63 | 65 |
64 bool was_initialized_with_io_thread_; | 66 bool was_initialized_with_io_thread_; |
65 }; | 67 }; |
66 | 68 |
67 #endif // CHROME_COMMON_APPCACHE_CHROME_APPCACHE_SERVICE_H_ | 69 #endif // CHROME_COMMON_APPCACHE_CHROME_APPCACHE_SERVICE_H_ |
OLD | NEW |