Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_HOST_H_ | 5 #ifndef WEBKIT_APPCACHE_APPCACHE_HOST_H_ |
| 6 #define WEBKIT_APPCACHE_APPCACHE_HOST_H_ | 6 #define WEBKIT_APPCACHE_APPCACHE_HOST_H_ |
| 7 | 7 |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/gtest_prod_util.h" | 9 #include "base/gtest_prod_util.h" |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 64 void SelectCacheForSharedWorker(int64 appcache_id); | 64 void SelectCacheForSharedWorker(int64 appcache_id); |
| 65 void MarkAsForeignEntry(const GURL& document_url, | 65 void MarkAsForeignEntry(const GURL& document_url, |
| 66 int64 cache_document_was_loaded_from); | 66 int64 cache_document_was_loaded_from); |
| 67 void GetStatusWithCallback(GetStatusCallback* callback, | 67 void GetStatusWithCallback(GetStatusCallback* callback, |
| 68 void* callback_param); | 68 void* callback_param); |
| 69 void StartUpdateWithCallback(StartUpdateCallback* callback, | 69 void StartUpdateWithCallback(StartUpdateCallback* callback, |
| 70 void* callback_param); | 70 void* callback_param); |
| 71 void SwapCacheWithCallback(SwapCacheCallback* callback, | 71 void SwapCacheWithCallback(SwapCacheCallback* callback, |
| 72 void* callback_param); | 72 void* callback_param); |
| 73 | 73 |
| 74 // Called prior to the main resource load. When the system contains multiple | |
| 75 // candidates for a main resource load, the appcache preferred by the host | |
| 76 // that created this host is used to break ties. | |
|
jennb
2011/04/12 00:07:56
indentation
michaeln
2011/04/14 23:41:23
Done.
| |
| 77 void SetSpawningHostId(int spawning_process_id, int spawning_host_id); | |
| 78 AppCacheHost* GetSpawningHost(); | |
|
adamk
2011/04/11 20:45:16
Can this be a const AppChacheHost*? I think you s
| |
| 79 const GURL& preferred_manifest_url() { return preferred_manifest_url_; } | |
|
adamk
2011/04/11 20:45:16
You can make this a const method.
michaeln
2011/04/14 23:41:23
Done.
| |
| 80 void set_preferred_manifest_url(const GURL& url) { | |
| 81 preferred_manifest_url_ = url; | |
| 82 } | |
| 83 | |
| 74 // Support for loading resources out of the appcache. | 84 // Support for loading resources out of the appcache. |
| 75 // May return NULL if the request isn't subject to retrieval from an appache. | 85 // May return NULL if the request isn't subject to retrieval from an appache. |
| 76 AppCacheRequestHandler* CreateRequestHandler( | 86 AppCacheRequestHandler* CreateRequestHandler( |
| 77 net::URLRequest* request, ResourceType::Type resource_type); | 87 net::URLRequest* request, ResourceType::Type resource_type); |
| 78 | 88 |
| 79 // Support for devtools inspecting appcache resources. | 89 // Support for devtools inspecting appcache resources. |
| 80 void GetResourceList(std::vector<AppCacheResourceInfo>* resource_infos); | 90 void GetResourceList(std::vector<AppCacheResourceInfo>* resource_infos); |
| 81 | 91 |
| 82 // Establishes an association between this host and a cache. 'cache' may be | 92 // Establishes an association between this host and a cache. 'cache' may be |
| 83 // NULL to break any existing association. Associations are established | 93 // NULL to break any existing association. Associations are established |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 142 return parent_host_id_ != kNoHostId; | 152 return parent_host_id_ != kNoHostId; |
| 143 } | 153 } |
| 144 | 154 |
| 145 // Returns the parent context's host instance. This is only valid | 155 // Returns the parent context's host instance. This is only valid |
| 146 // to call when this instance is_for_dedicated_worker. | 156 // to call when this instance is_for_dedicated_worker. |
| 147 AppCacheHost* GetParentAppCacheHost() const; | 157 AppCacheHost* GetParentAppCacheHost() const; |
| 148 | 158 |
| 149 // Identifies the corresponding appcache host in the child process. | 159 // Identifies the corresponding appcache host in the child process. |
| 150 int host_id_; | 160 int host_id_; |
| 151 | 161 |
| 162 // Information about the host that created this one, the manifest | |
|
jennb
2011/04/12 00:07:56
nit: replace comma with semicolon
michaeln
2011/04/14 23:41:23
Done.
| |
| 163 // preferred by our creator influences which cache our main resource | |
| 164 // should be loaded from. | |
| 165 int spawning_host_id_; | |
| 166 int spawning_process_id_; | |
| 167 GURL preferred_manifest_url_; | |
| 168 | |
| 152 // Hosts for dedicated workers are special cased to shunt | 169 // Hosts for dedicated workers are special cased to shunt |
| 153 // request handling off to the dedicated worker's parent. | 170 // request handling off to the dedicated worker's parent. |
| 154 // The scriptable api is not accessible in dedicated workers | 171 // The scriptable api is not accessible in dedicated workers |
| 155 // so the other aspects of this class are not relevant for | 172 // so the other aspects of this class are not relevant for |
| 156 // these special case instances. | 173 // these special case instances. |
| 157 int parent_host_id_; | 174 int parent_host_id_; |
| 158 int parent_process_id_; | 175 int parent_process_id_; |
| 159 | 176 |
| 160 // The cache associated with this host, if any. | 177 // The cache associated with this host, if any. |
| 161 scoped_refptr<AppCache> associated_cache_; | 178 scoped_refptr<AppCache> associated_cache_; |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 231 FRIEND_TEST_ALL_PREFIXES(AppCacheHostTest, SetSwappableCache); | 248 FRIEND_TEST_ALL_PREFIXES(AppCacheHostTest, SetSwappableCache); |
| 232 FRIEND_TEST_ALL_PREFIXES(AppCacheHostTest, ForDedicatedWorker); | 249 FRIEND_TEST_ALL_PREFIXES(AppCacheHostTest, ForDedicatedWorker); |
| 233 FRIEND_TEST_ALL_PREFIXES(AppCacheGroupTest, QueueUpdate); | 250 FRIEND_TEST_ALL_PREFIXES(AppCacheGroupTest, QueueUpdate); |
| 234 | 251 |
| 235 DISALLOW_COPY_AND_ASSIGN(AppCacheHost); | 252 DISALLOW_COPY_AND_ASSIGN(AppCacheHost); |
| 236 }; | 253 }; |
| 237 | 254 |
| 238 } // namespace appcache | 255 } // namespace appcache |
| 239 | 256 |
| 240 #endif // WEBKIT_APPCACHE_APPCACHE_HOST_H_ | 257 #endif // WEBKIT_APPCACHE_APPCACHE_HOST_H_ |
| OLD | NEW |