Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(659)

Side by Side Diff: content/browser/appcache/appcache_dispatcher_host.h

Issue 2501343003: PlzNavigate: AppCache support. (Closed)
Patch Set: Add DCHECKs for PlzNavigate and fix a double Release problem which caused one unit_test to fail wit… Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 AppCache backend is setup by the AppCacheFrameNavigationHandler class
43 // when a navigation for a FrameTreeNode occurs. When the navigation commits
44 // we get notified here along with the |backend| which was registered when
45 // the navigation was initiated. We need to switch the backend instance
46 // maintained by this class instance with the one passed in.
47 void FrameNavigationCommitted(std::unique_ptr<AppCacheBackendImpl> backend);
michaeln 2016/11/22 00:17:27 I think this assumes the destination process had n
ananta 2016/11/23 04:05:14 Reverted
48
49 // PlzNavigate: A pending host is registered when a navigation is initiated
50 // by the browser. The registration completes when the renderer sends the
51 // AppCacheHostMsg_RegisterHost message to us. This function should be called
52 // on the IO thread.
michaeln 2016/11/22 00:17:27 why does the navigation we need more than the 'hos
ananta 2016/11/23 04:05:14 Leaving this as is for now. I don't know if we can
53 void RegisterPendingHost(int host);
54
41 // IPC message handlers 55 // IPC message handlers
42 void OnRegisterHost(int host_id); 56 void OnRegisterHost(int host_id);
43 void OnUnregisterHost(int host_id); 57 void OnUnregisterHost(int host_id);
44 void OnSetSpawningHostId(int host_id, int spawning_host_id); 58 void OnSetSpawningHostId(int host_id, int spawning_host_id);
45 void OnSelectCache(int host_id, 59 void OnSelectCache(int host_id,
46 const GURL& document_url, 60 const GURL& document_url,
47 int64_t cache_document_was_loaded_from, 61 int64_t cache_document_was_loaded_from,
48 const GURL& opt_manifest_url); 62 const GURL& opt_manifest_url);
49 void OnSelectCacheForWorker(int host_id, int parent_process_id, 63 void OnSelectCacheForWorker(int host_id, int parent_process_id,
50 int parent_host_id); 64 int parent_host_id);
51 void OnSelectCacheForSharedWorker(int host_id, int64_t appcache_id); 65 void OnSelectCacheForSharedWorker(int host_id, int64_t appcache_id);
52 void OnMarkAsForeignEntry(int host_id, 66 void OnMarkAsForeignEntry(int host_id,
53 const GURL& document_url, 67 const GURL& document_url,
54 int64_t cache_document_was_loaded_from); 68 int64_t cache_document_was_loaded_from);
55 void OnGetStatus(int host_id, IPC::Message* reply_msg); 69 void OnGetStatus(int host_id, IPC::Message* reply_msg);
56 void OnStartUpdate(int host_id, IPC::Message* reply_msg); 70 void OnStartUpdate(int host_id, IPC::Message* reply_msg);
57 void OnSwapCache(int host_id, IPC::Message* reply_msg); 71 void OnSwapCache(int host_id, IPC::Message* reply_msg);
58 void OnGetResourceList( 72 void OnGetResourceList(
59 int host_id, 73 int host_id,
60 std::vector<AppCacheResourceInfo>* resource_infos); 74 std::vector<AppCacheResourceInfo>* resource_infos);
61 void GetStatusCallback(AppCacheStatus status, void* param); 75 void GetStatusCallback(AppCacheStatus status, void* param);
62 void StartUpdateCallback(bool result, void* param); 76 void StartUpdateCallback(bool result, void* param);
63 void SwapCacheCallback(bool result, void* param); 77 void SwapCacheCallback(bool result, void* param);
64 78
79 // Returns the AppCacheDispatcherHost instance associated with the
80 // |process_id| passed in.
81 static scoped_refptr<AppCacheDispatcherHost> GetHostForProcess(
82 int process_id);
65 83
66 scoped_refptr<ChromeAppCacheService> appcache_service_; 84 scoped_refptr<ChromeAppCacheService> appcache_service_;
67 AppCacheFrontendProxy frontend_proxy_; 85 AppCacheFrontendProxy frontend_proxy_;
68 AppCacheBackendImpl backend_impl_; 86 std::unique_ptr<AppCacheBackendImpl> backend_impl_;
69 87
70 content::GetStatusCallback get_status_callback_; 88 content::GetStatusCallback get_status_callback_;
71 content::StartUpdateCallback start_update_callback_; 89 content::StartUpdateCallback start_update_callback_;
72 content::SwapCacheCallback swap_cache_callback_; 90 content::SwapCacheCallback swap_cache_callback_;
73 std::unique_ptr<IPC::Message> pending_reply_msg_; 91 std::unique_ptr<IPC::Message> pending_reply_msg_;
74 92
75 // The corresponding ChildProcessHost object's id(). 93 // The corresponding ChildProcessHost object's id().
76 int process_id_; 94 int process_id_;
77 95
96 // PlzNavigate: Contains a list of pending hosts which have been registered
97 // via the RegisterPendingHost() function. The host is removed from the list
98 // when we receive the AppCacheHostMsg_RegisterHost IPC message.
99 std::set<int> pending_hosts_;
100
101 // PlzNavigate:
102 // This class needs to invoke functionality to initialize the
103 // AppCacheBackendImpl instance, etc.
104 friend class AppCacheFrameNavigationHandler;
105
78 base::WeakPtrFactory<AppCacheDispatcherHost> weak_factory_; 106 base::WeakPtrFactory<AppCacheDispatcherHost> weak_factory_;
79 107
80 DISALLOW_COPY_AND_ASSIGN(AppCacheDispatcherHost); 108 DISALLOW_COPY_AND_ASSIGN(AppCacheDispatcherHost);
81 }; 109 };
82 110
83 } // namespace content 111 } // namespace content
84 112
85 #endif // CONTENT_BROWSER_APPCACHE_APPCACHE_DISPATCHER_HOST_H_ 113 #endif // CONTENT_BROWSER_APPCACHE_APPCACHE_DISPATCHER_HOST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698