OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_PROVIDER_HOST_H_ | 5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_PROVIDER_HOST_H_ |
6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_PROVIDER_HOST_H_ | 6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_PROVIDER_HOST_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
124 bool IsContextAlive(); | 124 bool IsContextAlive(); |
125 | 125 |
126 // Dispatches message event to the document. | 126 // Dispatches message event to the document. |
127 void PostMessage(const base::string16& message, | 127 void PostMessage(const base::string16& message, |
128 const std::vector<int>& sent_message_port_ids); | 128 const std::vector<int>& sent_message_port_ids); |
129 | 129 |
130 // Adds reference of this host's process to the |pattern|, the reference will | 130 // Adds reference of this host's process to the |pattern|, the reference will |
131 // be removed in destructor. | 131 // be removed in destructor. |
132 void AddScopedProcessReferenceToPattern(const GURL& pattern); | 132 void AddScopedProcessReferenceToPattern(const GURL& pattern); |
133 | 133 |
134 // Methods to support cross site navigations. | |
135 void PrepareForCrossSiteTransfer(); | |
136 void CompleteCrossSiteTransfer( | |
137 int new_process_id, | |
138 int new_provider_id, | |
139 ServiceWorkerDispatcherHost* displatcher_host); | |
falken
2014/11/11 08:38:57
spelling: displatcher (sounds painful :)
michaeln
2014/11/13 00:05:08
lol... but i absolutely prefer my spelling!
| |
140 ServiceWorkerDispatcherHost* dispatcher_host() { | |
141 return dispatcher_host_; | |
142 } | |
143 | |
134 private: | 144 private: |
135 friend class ServiceWorkerProviderHostTest; | 145 friend class ServiceWorkerProviderHostTest; |
136 friend class ServiceWorkerWriteToCacheJobTest; | 146 friend class ServiceWorkerWriteToCacheJobTest; |
137 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerContextRequestHandlerTest, | 147 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerContextRequestHandlerTest, |
138 UpdateBefore24Hours); | 148 UpdateBefore24Hours); |
139 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerContextRequestHandlerTest, | 149 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerContextRequestHandlerTest, |
140 UpdateAfter24Hours); | 150 UpdateAfter24Hours); |
141 | 151 |
142 // ServiceWorkerRegistration::Listener overrides. | 152 // ServiceWorkerRegistration::Listener overrides. |
143 void OnRegistrationFailed(ServiceWorkerRegistration* registration) override; | 153 void OnRegistrationFailed(ServiceWorkerRegistration* registration) override; |
144 | 154 |
145 // Sets the controller version field to |version| or if |version| is NULL, | 155 // Sets the controller version field to |version| or if |version| is NULL, |
146 // clears the field. | 156 // clears the field. |
147 void SetControllerVersionAttribute(ServiceWorkerVersion* version); | 157 void SetControllerVersionAttribute(ServiceWorkerVersion* version); |
148 | 158 |
149 // Creates a ServiceWorkerHandle to retain |version| and returns a | 159 // Creates a ServiceWorkerHandle to retain |version| and returns a |
150 // ServiceWorkerInfo with the handle ID to pass to the provider. The | 160 // ServiceWorkerInfo with the handle ID to pass to the provider. The |
151 // provider is responsible for releasing the handle. | 161 // provider is responsible for releasing the handle. |
152 ServiceWorkerObjectInfo CreateHandleAndPass(ServiceWorkerVersion* version); | 162 ServiceWorkerObjectInfo CreateHandleAndPass(ServiceWorkerVersion* version); |
153 | 163 |
154 // Increase/decrease this host's process reference for |pattern|. | 164 // Increase/decrease this host's process reference for |pattern|. |
155 void IncreaseProcessReference(const GURL& pattern); | 165 void IncreaseProcessReference(const GURL& pattern); |
156 void DecreaseProcessReference(const GURL& pattern); | 166 void DecreaseProcessReference(const GURL& pattern); |
157 | 167 |
158 const int process_id_; | 168 int process_id_; |
159 const int provider_id_; | 169 int provider_id_; |
160 GURL document_url_; | 170 GURL document_url_; |
161 GURL topmost_frame_url_; | 171 GURL topmost_frame_url_; |
162 | 172 |
163 std::vector<GURL> associated_patterns_; | 173 std::vector<GURL> associated_patterns_; |
164 scoped_refptr<ServiceWorkerRegistration> associated_registration_; | 174 scoped_refptr<ServiceWorkerRegistration> associated_registration_; |
165 | 175 |
166 scoped_refptr<ServiceWorkerVersion> controlling_version_; | 176 scoped_refptr<ServiceWorkerVersion> controlling_version_; |
167 scoped_refptr<ServiceWorkerVersion> running_hosted_version_; | 177 scoped_refptr<ServiceWorkerVersion> running_hosted_version_; |
168 base::WeakPtr<ServiceWorkerContextCore> context_; | 178 base::WeakPtr<ServiceWorkerContextCore> context_; |
169 ServiceWorkerDispatcherHost* dispatcher_host_; | 179 ServiceWorkerDispatcherHost* dispatcher_host_; |
170 bool allow_association_; | 180 bool allow_association_; |
171 | 181 |
172 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerProviderHost); | 182 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerProviderHost); |
173 }; | 183 }; |
174 | 184 |
175 } // namespace content | 185 } // namespace content |
176 | 186 |
177 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_PROVIDER_HOST_H_ | 187 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_PROVIDER_HOST_H_ |
OLD | NEW |