| 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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 } | 78 } |
| 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 void FindAvailableProcessAndCallbackOnUI(const GURL& pattern, |
| 89 const base::Callback<void(int)>); |
| 90 |
| 88 private: | 91 private: |
| 89 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerProcessManagerTest, SortProcess); | 92 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerProcessManagerTest, SortProcess); |
| 90 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerProcessManagerTest, | 93 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerProcessManagerTest, |
| 91 FindAvailableProcess); | 94 FindAvailableProcess); |
| 92 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerProcessManagerTest, | 95 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerProcessManagerTest, |
| 93 AllocateWorkerProcess_FindAvailableProcess); | 96 AllocateWorkerProcess_FindAvailableProcess); |
| 94 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerProcessManagerTest, | 97 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerProcessManagerTest, |
| 95 AllocateWorkerProcess_InShutdown); | 98 AllocateWorkerProcess_InShutdown); |
| 96 | 99 |
| 97 // Information about the process for an EmbeddedWorkerInstance. | 100 // Information about the process for an EmbeddedWorkerInstance. |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 | 166 |
| 164 namespace std { | 167 namespace std { |
| 165 // Specialized to post the deletion to the UI thread. | 168 // Specialized to post the deletion to the UI thread. |
| 166 template <> | 169 template <> |
| 167 struct CONTENT_EXPORT default_delete<content::ServiceWorkerProcessManager> { | 170 struct CONTENT_EXPORT default_delete<content::ServiceWorkerProcessManager> { |
| 168 void operator()(content::ServiceWorkerProcessManager* ptr) const; | 171 void operator()(content::ServiceWorkerProcessManager* ptr) const; |
| 169 }; | 172 }; |
| 170 } // namespace std | 173 } // namespace std |
| 171 | 174 |
| 172 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_PROCESS_MANAGER_H_ | 175 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_PROCESS_MANAGER_H_ |
| OLD | NEW |