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. | |
77 void SetSpawningHostId(int spawning_process_id, int spawning_host_id); | |
78 const AppCacheHost* GetSpawningHost() const; | |
adamk
2011/04/15 17:20:51
Please add a comment to this method explaining und
michaeln
2011/04/15 19:33:34
Done.
// Called prior to the main resource load
| |
79 const GURL& preferred_manifest_url() const { | |
80 return preferred_manifest_url_; | |
81 } | |
82 void set_preferred_manifest_url(const GURL& url) { | |
83 preferred_manifest_url_ = url; | |
84 } | |
85 | |
74 // Support for loading resources out of the appcache. | 86 // Support for loading resources out of the appcache. |
75 // May return NULL if the request isn't subject to retrieval from an appache. | 87 // May return NULL if the request isn't subject to retrieval from an appache. |
76 AppCacheRequestHandler* CreateRequestHandler( | 88 AppCacheRequestHandler* CreateRequestHandler( |
77 net::URLRequest* request, ResourceType::Type resource_type); | 89 net::URLRequest* request, ResourceType::Type resource_type); |
78 | 90 |
79 // Support for devtools inspecting appcache resources. | 91 // Support for devtools inspecting appcache resources. |
80 void GetResourceList(std::vector<AppCacheResourceInfo>* resource_infos); | 92 void GetResourceList(std::vector<AppCacheResourceInfo>* resource_infos); |
81 | 93 |
82 // Establishes an association between this host and a cache. 'cache' may be | 94 // Establishes an association between this host and a cache. 'cache' may be |
83 // NULL to break any existing association. Associations are established | 95 // 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; | 154 return parent_host_id_ != kNoHostId; |
143 } | 155 } |
144 | 156 |
145 // Returns the parent context's host instance. This is only valid | 157 // Returns the parent context's host instance. This is only valid |
146 // to call when this instance is_for_dedicated_worker. | 158 // to call when this instance is_for_dedicated_worker. |
147 AppCacheHost* GetParentAppCacheHost() const; | 159 AppCacheHost* GetParentAppCacheHost() const; |
148 | 160 |
149 // Identifies the corresponding appcache host in the child process. | 161 // Identifies the corresponding appcache host in the child process. |
150 int host_id_; | 162 int host_id_; |
151 | 163 |
164 // Information about the host that created this one; the manifest | |
165 // preferred by our creator influences which cache our main resource | |
166 // should be loaded from. | |
167 int spawning_host_id_; | |
168 int spawning_process_id_; | |
169 GURL preferred_manifest_url_; | |
170 | |
152 // Hosts for dedicated workers are special cased to shunt | 171 // Hosts for dedicated workers are special cased to shunt |
153 // request handling off to the dedicated worker's parent. | 172 // request handling off to the dedicated worker's parent. |
154 // The scriptable api is not accessible in dedicated workers | 173 // The scriptable api is not accessible in dedicated workers |
155 // so the other aspects of this class are not relevant for | 174 // so the other aspects of this class are not relevant for |
156 // these special case instances. | 175 // these special case instances. |
157 int parent_host_id_; | 176 int parent_host_id_; |
158 int parent_process_id_; | 177 int parent_process_id_; |
159 | 178 |
160 // The cache associated with this host, if any. | 179 // The cache associated with this host, if any. |
161 scoped_refptr<AppCache> associated_cache_; | 180 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); | 250 FRIEND_TEST_ALL_PREFIXES(AppCacheHostTest, SetSwappableCache); |
232 FRIEND_TEST_ALL_PREFIXES(AppCacheHostTest, ForDedicatedWorker); | 251 FRIEND_TEST_ALL_PREFIXES(AppCacheHostTest, ForDedicatedWorker); |
233 FRIEND_TEST_ALL_PREFIXES(AppCacheGroupTest, QueueUpdate); | 252 FRIEND_TEST_ALL_PREFIXES(AppCacheGroupTest, QueueUpdate); |
234 | 253 |
235 DISALLOW_COPY_AND_ASSIGN(AppCacheHost); | 254 DISALLOW_COPY_AND_ASSIGN(AppCacheHost); |
236 }; | 255 }; |
237 | 256 |
238 } // namespace appcache | 257 } // namespace appcache |
239 | 258 |
240 #endif // WEBKIT_APPCACHE_APPCACHE_HOST_H_ | 259 #endif // WEBKIT_APPCACHE_APPCACHE_HOST_H_ |
OLD | NEW |