| 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 WEBKIT_APPCACHE_APPCACHE_SERVICE_H_ | 5 #ifndef WEBKIT_APPCACHE_APPCACHE_SERVICE_H_ |
| 6 #define WEBKIT_APPCACHE_APPCACHE_SERVICE_H_ | 6 #define WEBKIT_APPCACHE_APPCACHE_SERVICE_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/file_path.h" | 11 #include "base/file_path.h" |
| 12 #include "base/ref_counted.h" | 12 #include "base/ref_counted.h" |
| 13 #include "base/scoped_ptr.h" | 13 #include "base/scoped_ptr.h" |
| 14 #include "base/time.h" | 14 #include "base/time.h" |
| 15 #include "net/base/completion_callback.h" | 15 #include "net/base/completion_callback.h" |
| 16 #include "net/base/net_errors.h" | 16 #include "net/base/net_errors.h" |
| 17 #include "testing/gtest/include/gtest/gtest_prod.h" | 17 #include "testing/gtest/include/gtest/gtest_prod.h" |
| 18 #include "webkit/appcache/appcache_storage.h" | 18 #include "webkit/appcache/appcache_storage.h" |
| 19 | 19 |
| 20 class URLRequestContext; | 20 class URLRequestContext; |
| 21 | 21 |
| 22 namespace base { |
| 23 class MessageLoopProxy; |
| 24 } |
| 25 |
| 22 namespace appcache { | 26 namespace appcache { |
| 23 | 27 |
| 24 class AppCacheBackendImpl; | 28 class AppCacheBackendImpl; |
| 25 class AppCachePolicy; | 29 class AppCachePolicy; |
| 26 | 30 |
| 27 // Structure that contains basic info about an appcache. | 31 // Structure that contains basic info about an appcache. |
| 28 struct AppCacheInfo { | 32 struct AppCacheInfo { |
| 29 AppCacheInfo() {} | 33 AppCacheInfo() {} |
| 30 AppCacheInfo(const GURL& manifest_url, | 34 AppCacheInfo(const GURL& manifest_url, |
| 31 int64 size, | 35 int64 size, |
| (...skipping 23 matching lines...) Expand all Loading... |
| 55 }; | 59 }; |
| 56 | 60 |
| 57 // Class that manages the application cache service. Sends notifications | 61 // Class that manages the application cache service. Sends notifications |
| 58 // to many frontends. One instance per user-profile. Each instance has | 62 // to many frontends. One instance per user-profile. Each instance has |
| 59 // exclusive access to it's cache_directory on disk. | 63 // exclusive access to it's cache_directory on disk. |
| 60 class AppCacheService { | 64 class AppCacheService { |
| 61 public: | 65 public: |
| 62 AppCacheService(); | 66 AppCacheService(); |
| 63 virtual ~AppCacheService(); | 67 virtual ~AppCacheService(); |
| 64 | 68 |
| 65 void Initialize(const FilePath& cache_directory); | 69 void Initialize(const FilePath& cache_directory, |
| 70 base::MessageLoopProxy* cache_thread); |
| 66 | 71 |
| 67 // Purges any memory not needed. | 72 // Purges any memory not needed. |
| 68 void PurgeMemory() { | 73 void PurgeMemory() { |
| 69 if (storage_.get()) | 74 if (storage_.get()) |
| 70 storage_->PurgeMemory(); | 75 storage_->PurgeMemory(); |
| 71 } | 76 } |
| 72 | 77 |
| 73 // Populates 'collection' with info about all of the appcaches stored | 78 // Populates 'collection' with info about all of the appcaches stored |
| 74 // within the service, 'callback' is invoked upon completion. The service | 79 // within the service, 'callback' is invoked upon completion. The service |
| 75 // acquires a reference to the 'collection' until until completion. | 80 // acquires a reference to the 'collection' until until completion. |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 URLRequestContext* request_context_; | 140 URLRequestContext* request_context_; |
| 136 | 141 |
| 137 // TODO(jennb): service state: e.g. reached quota? | 142 // TODO(jennb): service state: e.g. reached quota? |
| 138 | 143 |
| 139 DISALLOW_COPY_AND_ASSIGN(AppCacheService); | 144 DISALLOW_COPY_AND_ASSIGN(AppCacheService); |
| 140 }; | 145 }; |
| 141 | 146 |
| 142 } // namespace appcache | 147 } // namespace appcache |
| 143 | 148 |
| 144 #endif // WEBKIT_APPCACHE_APPCACHE_SERVICE_H_ | 149 #endif // WEBKIT_APPCACHE_APPCACHE_SERVICE_H_ |
| OLD | NEW |