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 CHROME_WORKER_WORKER_WEBAPPLICATIONCACHEHOST_IMPL_H_ | 5 #ifndef CHROME_WORKER_WORKER_WEBAPPLICATIONCACHEHOST_IMPL_H_ |
6 #define CHROME_WORKER_WORKER_WEBAPPLICATIONCACHEHOST_IMPL_H_ | 6 #define CHROME_WORKER_WORKER_WEBAPPLICATIONCACHEHOST_IMPL_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "webkit/appcache/web_application_cache_host_impl.h" | 9 #include "webkit/appcache/web_application_cache_host_impl.h" |
10 | 10 |
11 // Information used to construct and initialize an appcache host | 11 // Information used to construct and initialize an appcache host |
12 // for a worker. | 12 // for a worker. |
13 struct WorkerAppCacheInitInfo { | 13 struct WorkerAppCacheInitInfo { |
14 bool is_shared_worker; | |
15 int parent_process_id; | 14 int parent_process_id; |
16 int parent_appcache_host_id; // Only valid for dedicated workers. | |
17 int64 main_resource_appcache_id; // Only valid for shared workers. | 15 int64 main_resource_appcache_id; // Only valid for shared workers. |
18 | 16 |
19 WorkerAppCacheInitInfo() | 17 WorkerAppCacheInitInfo() |
20 : is_shared_worker(false), parent_process_id(0), | 18 : parent_process_id(0), |
21 parent_appcache_host_id(0), main_resource_appcache_id(0) { | 19 main_resource_appcache_id(0) { |
22 } | 20 } |
23 WorkerAppCacheInitInfo( | 21 WorkerAppCacheInitInfo( |
24 bool is_shared, int process_id, int host_id, int64 cache_id) | 22 int process_id, int64 cache_id) |
25 : is_shared_worker(is_shared), parent_process_id(process_id), | 23 : parent_process_id(process_id), |
26 parent_appcache_host_id(host_id), main_resource_appcache_id(cache_id) { | 24 main_resource_appcache_id(cache_id) { |
27 } | 25 } |
28 }; | 26 }; |
29 | 27 |
30 class WorkerWebApplicationCacheHostImpl | 28 class WorkerWebApplicationCacheHostImpl |
31 : public appcache::WebApplicationCacheHostImpl { | 29 : public appcache::WebApplicationCacheHostImpl { |
32 public: | 30 public: |
33 WorkerWebApplicationCacheHostImpl( | 31 WorkerWebApplicationCacheHostImpl( |
34 const WorkerAppCacheInitInfo& init_info, | 32 const WorkerAppCacheInitInfo& init_info, |
35 WebKit::WebApplicationCacheHostClient* client); | 33 WebKit::WebApplicationCacheHostClient* client); |
36 | 34 |
37 // Main resource loading is different for workers. The resource is | 35 // Main resource loading is different for workers. The resource is |
38 // loaded by the creator of the worker rather than the worker itself. | 36 // loaded by the creator of the worker rather than the worker itself. |
39 // These overrides are stubbed out. | 37 // These overrides are stubbed out. |
40 virtual void willStartMainResourceRequest( | 38 virtual void willStartMainResourceRequest( |
41 WebKit::WebURLRequest&, const WebKit::WebFrame*); | 39 WebKit::WebURLRequest&, const WebKit::WebFrame*); |
42 virtual void didReceiveResponseForMainResource( | 40 virtual void didReceiveResponseForMainResource( |
43 const WebKit::WebURLResponse&); | 41 const WebKit::WebURLResponse&); |
44 virtual void didReceiveDataForMainResource(const char* data, int len); | 42 virtual void didReceiveDataForMainResource(const char* data, int len); |
45 virtual void didFinishLoadingMainResource(bool success); | 43 virtual void didFinishLoadingMainResource(bool success); |
46 | 44 |
47 // Cache selection is also different for workers. We know at construction | 45 // Cache selection is also different for workers. We know at construction |
48 // time what cache to select and do so then. | 46 // time what cache to select and do so then. |
49 // These overrides are stubbed out. | 47 // These overrides are stubbed out. |
50 virtual void selectCacheWithoutManifest(); | 48 virtual void selectCacheWithoutManifest(); |
51 virtual bool selectCacheWithManifest(const WebKit::WebURL& manifestURL); | 49 virtual bool selectCacheWithManifest(const WebKit::WebURL& manifestURL); |
52 }; | 50 }; |
53 | 51 |
54 #endif // CHROME_WORKER_WORKER_WEBAPPLICATIONCACHEHOST_IMPL_H_ | 52 #endif // CHROME_WORKER_WORKER_WEBAPPLICATIONCACHEHOST_IMPL_H_ |
OLD | NEW |