| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_SERVICE_WORKER_SERVICE_WORKER_PROCESS_MANAGER_H_ | 5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_PROCESS_MANAGER_H_ |
| 6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_PROCESS_MANAGER_H_ | 6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_PROCESS_MANAGER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 | 79 |
| 80 // Adds/removes process reference for the |pattern|, the process with highest | 80 // Adds/removes process reference for the |pattern|, the process with highest |
| 81 // references count will be chosen to start a worker. | 81 // references count will be chosen to start a worker. |
| 82 void AddProcessReferenceToPattern(const GURL& pattern, int process_id); | 82 void AddProcessReferenceToPattern(const GURL& pattern, int process_id); |
| 83 void RemoveProcessReferenceFromPattern(const GURL& pattern, int process_id); | 83 void RemoveProcessReferenceFromPattern(const GURL& pattern, int process_id); |
| 84 | 84 |
| 85 // Returns true if the |pattern| has at least one process to run. | 85 // Returns true if the |pattern| has at least one process to run. |
| 86 bool PatternHasProcessToRun(const GURL& pattern) const; | 86 bool PatternHasProcessToRun(const GURL& pattern) const; |
| 87 | 87 |
| 88 private: | 88 private: |
| 89 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerProcessManagerTestP, SortProcess); | 89 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerProcessManagerTest, SortProcess); |
| 90 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerProcessManagerTestP, | 90 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerProcessManagerTest, |
| 91 FindAvailableProcess); | 91 FindAvailableProcess); |
| 92 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerProcessManagerTestP, | 92 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerProcessManagerTest, |
| 93 AllocateWorkerProcess_FindAvailableProcess); | 93 AllocateWorkerProcess_FindAvailableProcess); |
| 94 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerProcessManagerTestP, | 94 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerProcessManagerTest, |
| 95 AllocateWorkerProcess_InShutdown); | 95 AllocateWorkerProcess_InShutdown); |
| 96 | 96 |
| 97 // Information about the process for an EmbeddedWorkerInstance. | 97 // Information about the process for an EmbeddedWorkerInstance. |
| 98 struct ProcessInfo { | 98 struct ProcessInfo { |
| 99 explicit ProcessInfo(const scoped_refptr<SiteInstance>& site_instance); | 99 explicit ProcessInfo(const scoped_refptr<SiteInstance>& site_instance); |
| 100 explicit ProcessInfo(int process_id); | 100 explicit ProcessInfo(int process_id); |
| 101 ProcessInfo(const ProcessInfo& other); | 101 ProcessInfo(const ProcessInfo& other); |
| 102 ~ProcessInfo(); | 102 ~ProcessInfo(); |
| 103 | 103 |
| 104 // Stores the SiteInstance the Worker lives inside. This needs to outlive | 104 // Stores the SiteInstance the Worker lives inside. This needs to outlive |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 | 163 |
| 164 namespace std { | 164 namespace std { |
| 165 // Specialized to post the deletion to the UI thread. | 165 // Specialized to post the deletion to the UI thread. |
| 166 template <> | 166 template <> |
| 167 struct CONTENT_EXPORT default_delete<content::ServiceWorkerProcessManager> { | 167 struct CONTENT_EXPORT default_delete<content::ServiceWorkerProcessManager> { |
| 168 void operator()(content::ServiceWorkerProcessManager* ptr) const; | 168 void operator()(content::ServiceWorkerProcessManager* ptr) const; |
| 169 }; | 169 }; |
| 170 } // namespace std | 170 } // namespace std |
| 171 | 171 |
| 172 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_PROCESS_MANAGER_H_ | 172 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_PROCESS_MANAGER_H_ |
| OLD | NEW |