blob: 73fb40fe120c2474b36bc836a6ffe84b4f817bfc [file] [log] [blame]
[email protected]98b6d942013-11-10 00:34:071// Copyright 2013 The Chromium Authors. All rights reserved.
[email protected]481e1a42009-05-06 20:56:052// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
[email protected]98b6d942013-11-10 00:34:075#ifndef EXTENSIONS_BROWSER_PROCESS_MANAGER_H_
6#define EXTENSIONS_BROWSER_PROCESS_MANAGER_H_
[email protected]481e1a42009-05-06 20:56:057
avic9cec102015-12-23 00:39:268#include <stdint.h>
9
[email protected]45776222009-07-15 20:21:5810#include <map>
[email protected]8a17bd52009-06-06 08:19:4911#include <set>
[email protected]45776222009-07-15 20:21:5812#include <string>
David Bertoni3e1e9fa2018-08-29 20:39:3013#include <utility>
Istiaque Ahmedb744ecf2019-02-06 00:23:3214#include <vector>
[email protected]481e1a42009-05-06 20:56:0515
[email protected]a23f62e2013-04-26 13:13:0216#include "base/callback.h"
[email protected]17902752011-08-31 22:52:5417#include "base/compiler_specific.h"
avic9cec102015-12-23 00:39:2618#include "base/macros.h"
[email protected]3b63f8f42011-03-28 01:54:1519#include "base/memory/ref_counted.h"
[email protected]99c49b52012-05-02 01:50:2020#include "base/memory/weak_ptr.h"
[email protected]08d469b22014-03-31 00:51:2421#include "base/observer_list.h"
Istiaque Ahmedd4b67ee2019-03-02 10:53:2022#include "base/scoped_observer.h"
reillyg0ea3fa902014-10-28 15:30:2323#include "components/keyed_service/core/keyed_service.h"
dgozman47679eb12016-10-17 17:30:1824#include "content/public/browser/devtools_agent_host_observer.h"
Evan Stade922f3f1f2019-09-04 21:05:1325#include "content/public/browser/render_process_host.h"
Istiaque Ahmedd4b67ee2019-03-02 10:53:2026#include "content/public/browser/render_process_host_observer.h"
David Bertoni3e1e9fa2018-08-29 20:39:3027#include "extensions/browser/activity.h"
kmarshall24b29b22015-04-29 01:41:4728#include "extensions/browser/event_page_tracker.h"
Vasiliy Telezhnikov9980b402021-02-18 20:41:5429#include "extensions/browser/extension_host_observer.h"
limasdfe0f061b2015-02-27 00:35:0630#include "extensions/browser/extension_registry_observer.h"
Istiaque Ahmedb744ecf2019-02-06 00:23:3231#include "extensions/browser/service_worker/worker_id.h"
32#include "extensions/browser/service_worker/worker_id_set.h"
rdevlin.cronin0670b562016-07-02 02:05:4333#include "extensions/common/extension_id.h"
[email protected]481e1a42009-05-06 20:56:0534
[email protected]481e1a42009-05-06 20:56:0535class GURL;
[email protected]b6583592012-01-25 19:52:3336
37namespace content {
[email protected]7f474212013-11-05 04:26:1638class BrowserContext;
[email protected]a23f62e2013-04-26 13:13:0239class DevToolsAgentHost;
[email protected]9dfed872013-12-30 23:08:5640class RenderFrameHost;
[email protected]481e1a42009-05-06 20:56:0541class SiteInstance;
rdevlin.cronin6ae04a012015-04-03 20:19:4042class WebContents;
Nico Weber210c0bc2019-02-11 22:01:0943} // namespace content
[email protected]481e1a42009-05-06 20:56:0544
[email protected]1c321ee2012-05-21 03:02:3445namespace extensions {
[email protected]98b6d942013-11-10 00:34:0746
[email protected]1c321ee2012-05-21 03:02:3447class Extension;
[email protected]3a1dc572012-07-31 22:25:1348class ExtensionHost;
[email protected]6b54fda2014-07-22 02:13:4749class ExtensionRegistry;
[email protected]08d469b22014-03-31 00:51:2450class ProcessManagerObserver;
[email protected]1c321ee2012-05-21 03:02:3451
[email protected]bc535ee52010-08-31 18:40:3252// Manages dynamic state of running Chromium extensions. There is one instance
53// of this class per Profile. OTR Profiles have a separate instance that keeps
54// track of split-mode extensions only.
reillyg0ea3fa902014-10-28 15:30:2355class ProcessManager : public KeyedService,
kmarshall24b29b22015-04-29 01:41:4756 public ExtensionRegistryObserver,
dgozman47679eb12016-10-17 17:30:1857 public EventPageTracker,
Istiaque Ahmedd4b67ee2019-03-02 10:53:2058 public content::DevToolsAgentHostObserver,
Vasiliy Telezhnikov9980b402021-02-18 20:41:5459 public content::RenderProcessHostObserver,
60 public ExtensionHostObserver {
[email protected]481e1a42009-05-06 20:56:0561 public:
rdevlin.cronin6ae04a012015-04-03 20:19:4062 using ExtensionHostSet = std::set<extensions::ExtensionHost*>;
[email protected]d1fe1352012-04-26 00:47:3263
reillyg0ea3fa902014-10-28 15:30:2364 static ProcessManager* Get(content::BrowserContext* context);
dcheng9168b2f2014-10-21 12:38:2465 ~ProcessManager() override;
[email protected]481e1a42009-05-06 20:56:0566
sense383ce0f2017-03-24 04:06:4367 // KeyedService support:
68 void Shutdown() override;
69
rdevlin.cronin6ae04a012015-04-03 20:19:4070 void RegisterRenderFrameHost(content::WebContents* web_contents,
71 content::RenderFrameHost* render_frame_host,
72 const Extension* extension);
73 void UnregisterRenderFrameHost(content::RenderFrameHost* render_frame_host);
[email protected]d1fe1352012-04-26 00:47:3274
Istiaque Ahmedb744ecf2019-02-06 00:23:3275 // Registers or unregisters a running worker state to this process manager.
76 // Note: This does not create any Service Workers.
Istiaque Ahmedb744ecf2019-02-06 00:23:3277 void RegisterServiceWorker(const WorkerId& worker_id);
78 void UnregisterServiceWorker(const WorkerId& worker_id);
79
rdevlin.cronin6ae04a012015-04-03 20:19:4080 // Returns the SiteInstance that the given URL belongs to.
81 // TODO(aa): This only returns correct results for extensions and packaged
82 // apps, not hosted apps.
83 virtual scoped_refptr<content::SiteInstance> GetSiteInstanceForURL(
84 const GURL& url);
[email protected]d1fe1352012-04-26 00:47:3285
rdevlin.cronin6ae04a012015-04-03 20:19:4086 using FrameSet = std::set<content::RenderFrameHost*>;
87 const FrameSet GetAllFrames() const;
88
89 // Returns all RenderFrameHosts that are registered for the specified
90 // extension.
91 ProcessManager::FrameSet GetRenderFrameHostsForExtension(
92 const std::string& extension_id);
93
robcdcc4b82015-12-06 12:39:4594 bool IsRenderFrameHostRegistered(content::RenderFrameHost* render_frame_host);
95
[email protected]08d469b22014-03-31 00:51:2496 void AddObserver(ProcessManagerObserver* observer);
97 void RemoveObserver(ProcessManagerObserver* observer);
98
[email protected]029ad372011-05-20 17:12:5699 // Creates a new UI-less extension instance. Like CreateViewHost, but not
[email protected]6ad9cdf72014-02-27 13:12:41100 // displayed anywhere. Returns false if no background host can be created,
101 // for example for hosted apps and extensions that aren't enabled in
102 // Incognito.
103 virtual bool CreateBackgroundHost(const Extension* extension,
104 const GURL& url);
[email protected]bc535ee52010-08-31 18:40:32105
rdevlin.cronin6ae04a012015-04-03 20:19:40106 // Creates background hosts if the embedder is ready and they are not already
107 // loaded.
108 void MaybeCreateStartupBackgroundHosts();
109
110 // Gets the ExtensionHost for the background page for an extension, or null if
[email protected]4814b512009-11-07 00:12:29111 // the extension isn't running or doesn't have a background page.
[email protected]98b6d942013-11-10 00:34:07112 ExtensionHost* GetBackgroundHostForExtension(const std::string& extension_id);
[email protected]4814b512009-11-07 00:12:29113
rdevlin.croninb48a98e2015-05-01 00:00:28114 // Returns the ExtensionHost for the given |render_frame_host|, if there is
115 // one.
116 ExtensionHost* GetExtensionHostForRenderFrameHost(
117 content::RenderFrameHost* render_frame_host);
118
[email protected]7042b682012-04-19 22:57:51119 // Returns true if the (lazy) background host for the given extension has
120 // already been sent the unload event and is shutting down.
121 bool IsBackgroundHostClosing(const std::string& extension_id);
122
Devlin Cronin7a282e32017-08-10 01:54:10123 // Returns the extension associated with the specified RenderFrameHost,
124 // or null.
rdevlin.cronin6ae04a012015-04-03 20:19:40125 const Extension* GetExtensionForRenderFrameHost(
126 content::RenderFrameHost* render_frame_host);
Devlin Cronin7a282e32017-08-10 01:54:10127
128 // Returns the extension associated with the main frame of the given
129 // |web_contents|, or null if there isn't one.
rdevlin.cronin6ae04a012015-04-03 20:19:40130 const Extension* GetExtensionForWebContents(
Lucas Furukawa Gadanie1c5dfda2018-11-29 17:57:41131 content::WebContents* web_contents);
rdevlin.cronin6ae04a012015-04-03 20:19:40132
[email protected]720ad1312012-02-27 23:07:36133 // Getter and setter for the lazy background page's keepalive count. This is
134 // the count of how many outstanding "things" are keeping the page alive.
135 // When this reaches 0, we will begin the process of shutting down the page.
136 // "Things" include pending events, resource loads, and API calls.
wez714dde12017-02-14 22:26:03137 // Returns -1 if |extension| does not have a lazy background page.
David Bertoni3e1e9fa2018-08-29 20:39:30138 // The calls to increment and decrement the count also accept a category
139 // of activity and an extra string of data. These are kept so there is
140 // more information for the counts. See the Activity struct definition
141 // for more details regarding the extra data.
[email protected]98b6d942013-11-10 00:34:07142 int GetLazyKeepaliveCount(const Extension* extension);
David Bertoni3e1e9fa2018-08-29 20:39:30143 void IncrementLazyKeepaliveCount(const Extension* extension,
144 Activity::Type activity_type,
145 const std::string& extra_data);
146 void DecrementLazyKeepaliveCount(const Extension* extension,
147 Activity::Type activity_type,
148 const std::string& extra_data);
149
Vasiliy Telezhnikov78b98d02021-03-16 14:26:28150 // Sends out notification to observers when the extension process is gone.
151 void NotifyExtensionProcessTerminated(const Extension* extension);
152
Istiaque Ahmedb744ecf2019-02-06 00:23:32153 // Methods to increment or decrement the ref-count of a specified service
154 // worker with id |worker_id|.
155 // The increment method returns the guid that needs to be passed to the
156 // decrement method.
157 std::string IncrementServiceWorkerKeepaliveCount(
158 const WorkerId& worker_id,
159 Activity::Type activity_type,
160 const std::string& extra_data);
161 // Decrements the ref-count of the specified worker with |worker_id| that
162 // had its ref-count incremented with |request_uuid|.
163 void DecrementServiceWorkerKeepaliveCount(const WorkerId& worker_id,
164 const std::string& request_uuid,
165 Activity::Type activity_type,
166 const std::string& extra_data);
167
David Bertoni3e1e9fa2018-08-29 20:39:30168 using ActivitiesMultisetPair = std::pair<Activity::Type, std::string>;
169 using ActivitiesMultiset = std::multiset<ActivitiesMultisetPair>;
170
171 // Return the current set of keep-alive activities for the extension.
172 ActivitiesMultiset GetLazyKeepaliveActivities(const Extension* extension);
[email protected]720ad1312012-02-27 23:07:36173
[email protected]584e6572013-02-16 07:02:33174 // Handles a response to the ShouldSuspend message, used for lazy background
[email protected]720ad1312012-02-27 23:07:36175 // pages.
avic9cec102015-12-23 00:39:26176 void OnShouldSuspendAck(const std::string& extension_id,
177 uint64_t sequence_id);
[email protected]103f19f2012-04-02 19:30:12178
[email protected]9dfed872013-12-30 23:08:56179 // Tracks network requests for a given RenderFrameHost, used to know
[email protected]6baff0b52012-03-06 01:30:18180 // when network activity is idle for lazy background pages.
Vasiliy Telezhnikov9980b402021-02-18 20:41:54181 void NetworkRequestStarted(content::RenderFrameHost* render_frame_host,
182 uint64_t request_id);
183 void NetworkRequestDone(content::RenderFrameHost* render_frame_host,
184 uint64_t request_id);
[email protected]6baff0b52012-03-06 01:30:18185
[email protected]0d475e072012-07-26 02:30:42186 // Prevents |extension|'s background page from being closed and sends the
187 // onSuspendCanceled() event to it.
[email protected]98b6d942013-11-10 00:34:07188 void CancelSuspend(const Extension* extension);
[email protected]0d475e072012-07-26 02:30:42189
[email protected]9602db42014-07-25 05:24:37190 // Called on shutdown to close our extension hosts.
191 void CloseBackgroundHosts();
192
kmarshall24b29b22015-04-29 01:41:47193 // EventPageTracker implementation.
194 bool IsEventPageSuspended(const std::string& extension_id) override;
195 bool WakeEventPage(const std::string& extension_id,
Istiaque Ahmed28edfd22018-08-30 23:40:47196 base::OnceCallback<void(bool)> callback) override;
kmarshall24b29b22015-04-29 01:41:47197
yoza9bf5602014-09-19 02:03:31198 // Sets the time in milliseconds that an extension event page can
199 // be idle before it is shut down; must be > 0.
200 static void SetEventPageIdleTimeForTesting(unsigned idle_time_msec);
201
202 // Sets the time in milliseconds that an extension event page has
203 // between being notified of its impending unload and that unload
204 // happening.
205 static void SetEventPageSuspendingTimeForTesting(
206 unsigned suspending_time_msec);
207
[email protected]6b54fda2014-07-22 02:13:47208 // Creates a non-incognito instance for tests. |registry| allows unit tests
209 // to inject an ExtensionRegistry that is not managed by the usual
210 // BrowserContextKeyedServiceFactory system.
211 static ProcessManager* CreateForTesting(content::BrowserContext* context,
212 ExtensionRegistry* registry);
213
214 // Creates an incognito-context instance for tests.
[email protected]b9f6ba32014-03-10 18:34:08215 static ProcessManager* CreateIncognitoForTesting(
216 content::BrowserContext* incognito_context,
217 content::BrowserContext* original_context,
[email protected]6b54fda2014-07-22 02:13:47218 ExtensionRegistry* registry);
219
rdevlin.cronin6ae04a012015-04-03 20:19:40220 content::BrowserContext* browser_context() const { return browser_context_; }
221
222 const ExtensionHostSet& background_hosts() const {
223 return background_hosts_;
224 }
225
Istiaque Ahmedb744ecf2019-02-06 00:23:32226 // Returns true if this ProcessManager has registered any worker with id
227 // |worker_id|.
228 bool HasServiceWorker(const WorkerId& worker_id) const;
229
230 // Returns all the Service Worker infos that is active in the given render
231 // process for the extension with |extension_id|.
232 std::vector<WorkerId> GetServiceWorkers(const ExtensionId& extension_id,
233 int render_process_id) const;
234
Ghazale Hosseinabadib11bca622020-09-22 21:15:50235 // Returns all the Service Worker infos that is active for the extension with
236 // |extension_id|.
237 std::vector<WorkerId> GetServiceWorkersForExtension(
238 const ExtensionId& extension_id) const;
239
[email protected]6b54fda2014-07-22 02:13:47240 bool startup_background_hosts_created_for_test() const {
241 return startup_background_hosts_created_;
242 }
[email protected]b9f6ba32014-03-10 18:34:08243
Istiaque Ahmedd4b67ee2019-03-02 10:53:20244 std::vector<WorkerId> GetAllWorkersIdsForTesting();
245
[email protected]bc535ee52010-08-31 18:40:32246 protected:
reillyg0ea3fa902014-10-28 15:30:23247 static ProcessManager* Create(content::BrowserContext* context);
248
Reilly Grant58ea3832020-06-24 17:47:55249 // |context| is incognito pass the original context as |original_context|.
[email protected]6b54fda2014-07-22 02:13:47250 // Otherwise pass the same context for both. Pass the ExtensionRegistry for
251 // |context| as |registry|, or override it for testing.
[email protected]98b6d942013-11-10 00:34:07252 ProcessManager(content::BrowserContext* context,
[email protected]6b54fda2014-07-22 02:13:47253 content::BrowserContext* original_context,
254 ExtensionRegistry* registry);
[email protected]bc535ee52010-08-31 18:40:32255
rdevlin.cronin6ae04a012015-04-03 20:19:40256 // Not owned. Also used by IncognitoProcessManager.
257 ExtensionRegistry* extension_registry_;
258
259 private:
260 friend class ProcessManagerFactory;
261 friend class ProcessManagerTest;
262
limasdfe0f061b2015-02-27 00:35:06263 // ExtensionRegistryObserver:
264 void OnExtensionLoaded(content::BrowserContext* browser_context,
265 const Extension* extension) override;
266 void OnExtensionUnloaded(content::BrowserContext* browser_context,
267 const Extension* extension,
limasdf0deef2042017-05-03 19:17:17268 UnloadedExtensionReason reason) override;
limasdfe0f061b2015-02-27 00:35:06269
Istiaque Ahmedd4b67ee2019-03-02 10:53:20270 // content::RenderProcessHostObserver:
271 void RenderProcessExited(
272 content::RenderProcessHost* host,
273 const content::ChildProcessTerminationInfo& info) override;
274
Vasiliy Telezhnikov9980b402021-02-18 20:41:54275 // ExtensionHostObserver:
276 void OnExtensionHostDestroyed(ExtensionHost* host) override;
277 void OnExtensionHostShouldClose(ExtensionHost* host) override;
278
[email protected]103f19f2012-04-02 19:30:12279 // Extra information we keep for each extension's background page.
280 struct BackgroundPageData;
rdevlin.cronin6ae04a012015-04-03 20:19:40281 struct ExtensionRenderFrameData;
282 using BackgroundPageDataMap = std::map<ExtensionId, BackgroundPageData>;
283 using ExtensionRenderFrames =
284 std::map<content::RenderFrameHost*, ExtensionRenderFrameData>;
[email protected]3e194992011-10-20 05:39:10285
[email protected]6b54fda2014-07-22 02:13:47286 // Load all background pages once the profile data is ready and the pages
287 // should be loaded.
288 void CreateStartupBackgroundHosts();
289
[email protected]94de8cb2013-11-07 06:29:21290 // Called just after |host| is created so it can be registered in our lists.
[email protected]98b6d942013-11-10 00:34:07291 void OnBackgroundHostCreated(ExtensionHost* host);
[email protected]94de8cb2013-11-07 06:29:21292
[email protected]06024c62011-10-20 20:57:12293 // Close the given |host| iff it's a background page.
[email protected]98b6d942013-11-10 00:34:07294 void CloseBackgroundHost(ExtensionHost* host);
[email protected]06024c62011-10-20 20:57:12295
rdevlin.cronin6ae04a012015-04-03 20:19:40296 // If the frame isn't keeping the lazy background page alive, increments the
297 // keepalive count to do so.
298 void AcquireLazyKeepaliveCountForFrame(
299 content::RenderFrameHost* render_frame_host);
300
301 // If the frame is keeping the lazy background page alive, decrements the
302 // keepalive count to stop doing it.
303 void ReleaseLazyKeepaliveCountForFrame(
304 content::RenderFrameHost* render_frame_host);
305
[email protected]388770152013-12-03 01:25:32306 // Internal implementation of DecrementLazyKeepaliveCount with an
307 // |extension_id| known to have a lazy background page.
308 void DecrementLazyKeepaliveCount(const std::string& extension_id);
David Bertoni3e1e9fa2018-08-29 20:39:30309 void DecrementLazyKeepaliveCount(const std::string& extension_id,
310 Activity::Type activity_type,
311 const std::string& extra_data);
[email protected]388770152013-12-03 01:25:32312
[email protected]6baff0b52012-03-06 01:30:18313 // These are called when the extension transitions between idle and active.
314 // They control the process of closing the background page when idle.
[email protected]99c49b52012-05-02 01:50:20315 void OnLazyBackgroundPageIdle(const std::string& extension_id,
avic9cec102015-12-23 00:39:26316 uint64_t sequence_id);
[email protected]6baff0b52012-03-06 01:30:18317 void OnLazyBackgroundPageActive(const std::string& extension_id);
[email protected]0d475e072012-07-26 02:30:42318 void CloseLazyBackgroundPageNow(const std::string& extension_id,
avic9cec102015-12-23 00:39:26319 uint64_t sequence_id);
[email protected]6baff0b52012-03-06 01:30:18320
dgozman47679eb12016-10-17 17:30:18321 const Extension* GetExtensionForAgentHost(
322 content::DevToolsAgentHost* agent_host);
323
324 // content::DevToolsAgentHostObserver overrides.
325 void DevToolsAgentHostAttached(
326 content::DevToolsAgentHost* agent_host) override;
327 void DevToolsAgentHostDetached(
328 content::DevToolsAgentHost* agent_host) override;
[email protected]06024c62011-10-20 20:57:12329
rdevlin.cronin6ae04a012015-04-03 20:19:40330 // Unregister RenderFrameHosts and clear background page data for an extension
[email protected]5b3ee852013-09-26 06:33:10331 // which has been unloaded.
332 void UnregisterExtension(const std::string& extension_id);
333
[email protected]caffe702012-05-03 05:30:17334 // Clears background page data for this extension.
335 void ClearBackgroundPageData(const std::string& extension_id);
336
Gyuyoung Kimf271be42021-03-03 03:09:37337 // Handles a response to the SuspendExtension Mojo method, used for lazy
338 // background pages.
339 void OnSuspendAck(const std::string& extension_id);
340
rdevlin.cronin6ae04a012015-04-03 20:19:40341 // The set of ExtensionHosts running viewless background extensions.
342 ExtensionHostSet background_hosts_;
343
344 // A SiteInstance related to the SiteInstance for all extensions in
345 // this profile. We create it in such a way that a new
346 // browsing instance is created. This controls process grouping.
347 scoped_refptr<content::SiteInstance> site_instance_;
348
349 // The browser context associated with the |site_instance_|.
350 content::BrowserContext* browser_context_;
351
352 // Contains all active extension-related RenderFrameHost instances for all
[email protected]35e0e0792012-11-30 02:35:48353 // extensions. We also keep a cache of the host's view type, because that
354 // information is not accessible at registration/deregistration time.
rdevlin.cronin6ae04a012015-04-03 20:19:40355 ExtensionRenderFrames all_extension_frames_;
[email protected]35e0e0792012-11-30 02:35:48356
Istiaque Ahmedb744ecf2019-02-06 00:23:32357 // TaskRunner for interacting with ServiceWorkerContexts.
Matt Falkenhagend55b9282019-09-10 23:53:35358 // TODO(crbug.com/824858): This is unused when ServiceWorkerOnUI is enabled.
Istiaque Ahmedb744ecf2019-02-06 00:23:32359 scoped_refptr<base::SequencedTaskRunner> worker_task_runner_;
360
361 // Contains all active extension Service Worker information for all
362 // extensions.
363 WorkerIdSet all_extension_workers_;
364
[email protected]103f19f2012-04-02 19:30:12365 BackgroundPageDataMap background_page_data_;
366
[email protected]aa3dd492013-11-05 17:09:09367 // True if we have created the startup set of background hosts.
368 bool startup_background_hosts_created_;
369
Evan Stade22e3f9b2019-10-01 21:12:17370 base::ObserverList<ProcessManagerObserver> observer_list_;
[email protected]08d469b22014-03-31 00:51:24371
[email protected]77a538f2014-07-14 22:25:37372 // ID Counter used to set ProcessManager::BackgroundPageData close_sequence_id
373 // members. These IDs are tracked per extension in background_page_data_ and
374 // are used to verify that nothing has interrupted the process of closing a
375 // lazy background process.
376 //
377 // Any interruption obtains a new ID by incrementing
378 // last_background_close_sequence_id_ and storing it in background_page_data_
379 // for a particular extension. Callbacks and round-trip IPC messages store the
380 // value of the extension's close_sequence_id at the beginning of the process.
381 // Thus comparisons can be done to halt when IDs no longer match.
382 //
383 // This counter provides unique IDs even when BackgroundPageData objects are
384 // reset.
avic9cec102015-12-23 00:39:26385 uint64_t last_background_close_sequence_id_;
[email protected]77a538f2014-07-14 22:25:37386
rockote5703292015-09-28 23:23:09387 // Tracks pending network requests by opaque ID. This is used to ensure proper
388 // keepalive counting in response to request status updates; e.g., if an
389 // extension URLRequest is constructed and then destroyed without ever
390 // starting, we can receive a completion notification without a corresponding
391 // start notification. In that case we want to avoid decrementing keepalive.
naskod13fd292016-06-07 20:33:33392 std::map<int, ExtensionHost*> pending_network_requests_;
rockote5703292015-09-28 23:23:09393
Istiaque Ahmedd4b67ee2019-03-02 10:53:20394 // Observers of Service Worker RPH this ProcessManager manages.
395 ScopedObserver<content::RenderProcessHost, content::RenderProcessHostObserver>
Evan Stade922f3f1f2019-09-04 21:05:13396 process_observer_{this};
Istiaque Ahmedd4b67ee2019-03-02 10:53:20397 // Maps render render_process_id -> extension_id for all Service Workers this
398 // ProcessManager manages.
399 std::map<int, std::set<ExtensionId>> worker_process_to_extension_ids_;
400
[email protected]77a538f2014-07-14 22:25:37401 // Must be last member, see doc on WeakPtrFactory.
Jeremy Roman9fc2de62019-07-12 14:15:03402 base::WeakPtrFactory<ProcessManager> weak_ptr_factory_{this};
[email protected]7f474212013-11-05 04:26:16403
[email protected]98b6d942013-11-10 00:34:07404 DISALLOW_COPY_AND_ASSIGN(ProcessManager);
[email protected]481e1a42009-05-06 20:56:05405};
406
[email protected]98b6d942013-11-10 00:34:07407} // namespace extensions
408
409#endif // EXTENSIONS_BROWSER_PROCESS_MANAGER_H_