| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_DISPATCHER_HOST_H_ | 5 #ifndef CONTENT_BROWSER_APPCACHE_APPCACHE_DISPATCHER_HOST_H_ |
| 6 #define CONTENT_BROWSER_APPCACHE_APPCACHE_DISPATCHER_HOST_H_ | 6 #define CONTENT_BROWSER_APPCACHE_APPCACHE_DISPATCHER_HOST_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 int process_id); | 31 int process_id); |
| 32 | 32 |
| 33 // BrowserIOMessageFilter implementation | 33 // BrowserIOMessageFilter implementation |
| 34 void OnChannelConnected(int32_t peer_pid) override; | 34 void OnChannelConnected(int32_t peer_pid) override; |
| 35 bool OnMessageReceived(const IPC::Message& message) override; | 35 bool OnMessageReceived(const IPC::Message& message) override; |
| 36 | 36 |
| 37 protected: | 37 protected: |
| 38 ~AppCacheDispatcherHost() override; | 38 ~AppCacheDispatcherHost() override; |
| 39 | 39 |
| 40 private: | 40 private: |
| 41 // PlzNavigate: |
| 42 // The AppCacheHost is precreated by the AppCacheNavigationHandleCore class |
| 43 // when a navigation is initiated. We register the host with the backend in |
| 44 // this function and ignore registrations for this host id from the renderer. |
| 45 void RegisterPrecreatedHost(std::unique_ptr<AppCacheHost> host); |
| 46 |
| 41 // IPC message handlers | 47 // IPC message handlers |
| 42 void OnRegisterHost(int host_id); | 48 void OnRegisterHost(int host_id); |
| 43 void OnUnregisterHost(int host_id); | 49 void OnUnregisterHost(int host_id); |
| 44 void OnSetSpawningHostId(int host_id, int spawning_host_id); | 50 void OnSetSpawningHostId(int host_id, int spawning_host_id); |
| 45 void OnSelectCache(int host_id, | 51 void OnSelectCache(int host_id, |
| 46 const GURL& document_url, | 52 const GURL& document_url, |
| 47 int64_t cache_document_was_loaded_from, | 53 int64_t cache_document_was_loaded_from, |
| 48 const GURL& opt_manifest_url); | 54 const GURL& opt_manifest_url); |
| 49 void OnSelectCacheForWorker(int host_id, int parent_process_id, | 55 void OnSelectCacheForWorker(int host_id, int parent_process_id, |
| 50 int parent_host_id); | 56 int parent_host_id); |
| 51 void OnSelectCacheForSharedWorker(int host_id, int64_t appcache_id); | 57 void OnSelectCacheForSharedWorker(int host_id, int64_t appcache_id); |
| 52 void OnMarkAsForeignEntry(int host_id, | 58 void OnMarkAsForeignEntry(int host_id, |
| 53 const GURL& document_url, | 59 const GURL& document_url, |
| 54 int64_t cache_document_was_loaded_from); | 60 int64_t cache_document_was_loaded_from); |
| 55 void OnGetStatus(int host_id, IPC::Message* reply_msg); | 61 void OnGetStatus(int host_id, IPC::Message* reply_msg); |
| 56 void OnStartUpdate(int host_id, IPC::Message* reply_msg); | 62 void OnStartUpdate(int host_id, IPC::Message* reply_msg); |
| 57 void OnSwapCache(int host_id, IPC::Message* reply_msg); | 63 void OnSwapCache(int host_id, IPC::Message* reply_msg); |
| 58 void OnGetResourceList( | 64 void OnGetResourceList( |
| 59 int host_id, | 65 int host_id, |
| 60 std::vector<AppCacheResourceInfo>* resource_infos); | 66 std::vector<AppCacheResourceInfo>* resource_infos); |
| 61 void GetStatusCallback(AppCacheStatus status, void* param); | 67 void GetStatusCallback(AppCacheStatus status, void* param); |
| 62 void StartUpdateCallback(bool result, void* param); | 68 void StartUpdateCallback(bool result, void* param); |
| 63 void SwapCacheCallback(bool result, void* param); | 69 void SwapCacheCallback(bool result, void* param); |
| 64 | 70 |
| 71 // Returns the AppCacheDispatcherHost instance associated with the |
| 72 // |process_id| passed in. |
| 73 static scoped_refptr<AppCacheDispatcherHost> GetHostForProcess( |
| 74 int process_id); |
| 65 | 75 |
| 66 scoped_refptr<ChromeAppCacheService> appcache_service_; | 76 scoped_refptr<ChromeAppCacheService> appcache_service_; |
| 67 AppCacheFrontendProxy frontend_proxy_; | 77 AppCacheFrontendProxy frontend_proxy_; |
| 68 AppCacheBackendImpl backend_impl_; | 78 AppCacheBackendImpl backend_impl_; |
| 69 | 79 |
| 70 content::GetStatusCallback get_status_callback_; | 80 content::GetStatusCallback get_status_callback_; |
| 71 content::StartUpdateCallback start_update_callback_; | 81 content::StartUpdateCallback start_update_callback_; |
| 72 content::SwapCacheCallback swap_cache_callback_; | 82 content::SwapCacheCallback swap_cache_callback_; |
| 73 std::unique_ptr<IPC::Message> pending_reply_msg_; | 83 std::unique_ptr<IPC::Message> pending_reply_msg_; |
| 74 | 84 |
| 75 // The corresponding ChildProcessHost object's id(). | 85 // The corresponding ChildProcessHost object's id(). |
| 76 int process_id_; | 86 int process_id_; |
| 77 | 87 |
| 88 // PlzNavigate: |
| 89 // This class needs to invoke functionality to register the precreated host |
| 90 // with the AppCacheDispatcherHost. |
| 91 friend class AppCacheNavigationHandleCore; |
| 92 |
| 78 base::WeakPtrFactory<AppCacheDispatcherHost> weak_factory_; | 93 base::WeakPtrFactory<AppCacheDispatcherHost> weak_factory_; |
| 79 | 94 |
| 80 DISALLOW_COPY_AND_ASSIGN(AppCacheDispatcherHost); | 95 DISALLOW_COPY_AND_ASSIGN(AppCacheDispatcherHost); |
| 81 }; | 96 }; |
| 82 | 97 |
| 83 } // namespace content | 98 } // namespace content |
| 84 | 99 |
| 85 #endif // CONTENT_BROWSER_APPCACHE_APPCACHE_DISPATCHER_HOST_H_ | 100 #endif // CONTENT_BROWSER_APPCACHE_APPCACHE_DISPATCHER_HOST_H_ |
| OLD | NEW |