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 CONTENT_BROWSER_APPCACHE_APPCACHE_BACKEND_IMPL_H_ | 5 #ifndef CONTENT_BROWSER_APPCACHE_APPCACHE_BACKEND_IMPL_H_ |
6 #define CONTENT_BROWSER_APPCACHE_APPCACHE_BACKEND_IMPL_H_ | 6 #define CONTENT_BROWSER_APPCACHE_APPCACHE_BACKEND_IMPL_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include "base/containers/hash_tables.h" | 10 #include "base/containers/hash_tables.h" |
11 #include "content/browser/appcache/appcache_host.h" | 11 #include "content/browser/appcache/appcache_host.h" |
12 #include "content/common/content_export.h" | 12 #include "content/common/content_export.h" |
13 | 13 |
14 namespace content { | 14 namespace content { |
15 | 15 |
16 class AppCacheServiceImpl; | 16 class AppCacheServiceImpl; |
17 | 17 |
18 class CONTENT_EXPORT AppCacheBackendImpl { | 18 class CONTENT_EXPORT AppCacheBackendImpl { |
19 public: | 19 public: |
20 AppCacheBackendImpl(); | 20 AppCacheBackendImpl(); |
21 ~AppCacheBackendImpl(); | 21 ~AppCacheBackendImpl(); |
22 | 22 |
23 void Initialize(AppCacheServiceImpl* service, | 23 void Initialize(AppCacheServiceImpl* service, |
24 AppCacheFrontend* frontend, | 24 AppCacheFrontend* frontend, |
25 int process_id); | 25 int process_id, |
26 int frame_id); | |
26 | 27 |
28 void set_process_id(int pid) { process_id_ = pid; } | |
27 int process_id() const { return process_id_; } | 29 int process_id() const { return process_id_; } |
28 | 30 |
31 void set_frame_id(int id) { frame_id_ = id; } | |
32 int frame_id() const { return frame_id_; } | |
33 | |
29 // Methods to support the AppCacheBackend interface. A false return | 34 // Methods to support the AppCacheBackend interface. A false return |
30 // value indicates an invalid host_id and that no action was taken | 35 // value indicates an invalid host_id and that no action was taken |
31 // by the backend impl. | 36 // by the backend impl. |
32 bool RegisterHost(int host_id); | 37 bool RegisterHost(int host_id); |
33 bool UnregisterHost(int host_id); | 38 bool UnregisterHost(int host_id); |
34 bool SetSpawningHostId(int host_id, int spawning_host_id); | 39 bool SetSpawningHostId(int host_id, int spawning_host_id); |
35 bool SelectCache(int host_id, | 40 bool SelectCache(int host_id, |
36 const GURL& document_url, | 41 const GURL& document_url, |
37 const int64_t cache_document_was_loaded_from, | 42 const int64_t cache_document_was_loaded_from, |
38 const GURL& manifest_url); | 43 const GURL& manifest_url); |
(...skipping 20 matching lines...) Expand all Loading... | |
59 | 64 |
60 typedef base::hash_map<int, std::unique_ptr<AppCacheHost>> HostMap; | 65 typedef base::hash_map<int, std::unique_ptr<AppCacheHost>> HostMap; |
61 const HostMap& hosts() { return hosts_; } | 66 const HostMap& hosts() { return hosts_; } |
62 | 67 |
63 // Methods to support cross site navigations. Hosts are transferred | 68 // Methods to support cross site navigations. Hosts are transferred |
64 // from process to process accordingly, deparented from the old | 69 // from process to process accordingly, deparented from the old |
65 // processes backend and reparented to the new. | 70 // processes backend and reparented to the new. |
66 std::unique_ptr<AppCacheHost> TransferHostOut(int host_id); | 71 std::unique_ptr<AppCacheHost> TransferHostOut(int host_id); |
67 void TransferHostIn(int new_host_id, std::unique_ptr<AppCacheHost> host); | 72 void TransferHostIn(int new_host_id, std::unique_ptr<AppCacheHost> host); |
68 | 73 |
74 // PlzNavigate: | |
75 // When a navigation commits, we need to switch the AppCacheFrontend and | |
76 // possibly the AppCacheServiceImpl instance we are registered with. | |
michaeln
2016/11/22 00:17:27
under what circumstances would we need to swap the
ananta
2016/11/23 04:05:14
IsolatedApps is one case. Need to look into why th
| |
77 void FrameNavigationCommitted(AppCacheFrontend* frontend, | |
78 AppCacheServiceImpl* service); | |
79 | |
80 // PlzNavigate: | |
81 // Copies hosts registered with the AppCacheBackend passed in the |backend| | |
82 // parameter. | |
83 void CopyExistingHosts(AppCacheBackendImpl* backend); | |
84 | |
69 private: | 85 private: |
70 AppCacheServiceImpl* service_; | 86 AppCacheServiceImpl* service_; |
71 AppCacheFrontend* frontend_; | 87 AppCacheFrontend* frontend_; |
72 int process_id_; | 88 int process_id_; |
89 // For PlzNavigate, this contains the frame id when the navigation is | |
90 // initiated. | |
91 int frame_id_; | |
73 HostMap hosts_; | 92 HostMap hosts_; |
74 | 93 |
75 DISALLOW_COPY_AND_ASSIGN(AppCacheBackendImpl); | 94 DISALLOW_COPY_AND_ASSIGN(AppCacheBackendImpl); |
76 }; | 95 }; |
77 | 96 |
78 } // namespace | 97 } // namespace |
79 | 98 |
80 #endif // CONTENT_BROWSER_APPCACHE_APPCACHE_BACKEND_IMPL_H_ | 99 #endif // CONTENT_BROWSER_APPCACHE_APPCACHE_BACKEND_IMPL_H_ |
OLD | NEW |