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

Side by Side Diff: content/browser/service_worker/service_worker_provider_host.h

Issue 558873003: Better coordinate what's responsible for associating a registration to a document. During navigatio… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 months 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 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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 // Returns a handler for a request, the handler may return NULL if 92 // Returns a handler for a request, the handler may return NULL if
93 // the request doesn't require special handling. 93 // the request doesn't require special handling.
94 scoped_ptr<ServiceWorkerRequestHandler> CreateRequestHandler( 94 scoped_ptr<ServiceWorkerRequestHandler> CreateRequestHandler(
95 ResourceType resource_type, 95 ResourceType resource_type,
96 base::WeakPtr<storage::BlobStorageContext> blob_storage_context, 96 base::WeakPtr<storage::BlobStorageContext> blob_storage_context,
97 scoped_refptr<ResourceRequestBody> body); 97 scoped_refptr<ResourceRequestBody> body);
98 98
99 // Returns true if |registration| can be associated with this provider. 99 // Returns true if |registration| can be associated with this provider.
100 bool CanAssociateRegistration(ServiceWorkerRegistration* registration); 100 bool CanAssociateRegistration(ServiceWorkerRegistration* registration);
101 101
102 // For use by the ServiceWorkerControlleeRequestHandler to disallow
103 // new registration association while a navigation is occurring and
104 // an existing registration is being looked for.
105 void SetAllowAssociation(bool allow) { allow_association_ = allow; }
106
102 // Returns true if the context referred to by this host (i.e. |context_|) is 107 // Returns true if the context referred to by this host (i.e. |context_|) is
103 // still alive. 108 // still alive.
104 bool IsContextAlive(); 109 bool IsContextAlive();
105 110
106 // Dispatches message event to the document. 111 // Dispatches message event to the document.
107 void PostMessage(const base::string16& message, 112 void PostMessage(const base::string16& message,
108 const std::vector<int>& sent_message_port_ids); 113 const std::vector<int>& sent_message_port_ids);
109 114
110 // Adds reference of this host's process to the |pattern|, the reference will 115 // Adds reference of this host's process to the |pattern|, the reference will
111 // be removed in destructor. 116 // be removed in destructor.
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 std::vector<GURL> associated_patterns_; 151 std::vector<GURL> associated_patterns_;
147 scoped_refptr<ServiceWorkerRegistration> associated_registration_; 152 scoped_refptr<ServiceWorkerRegistration> associated_registration_;
148 153
149 scoped_refptr<ServiceWorkerVersion> controlling_version_; 154 scoped_refptr<ServiceWorkerVersion> controlling_version_;
150 scoped_refptr<ServiceWorkerVersion> active_version_; 155 scoped_refptr<ServiceWorkerVersion> active_version_;
151 scoped_refptr<ServiceWorkerVersion> waiting_version_; 156 scoped_refptr<ServiceWorkerVersion> waiting_version_;
152 scoped_refptr<ServiceWorkerVersion> installing_version_; 157 scoped_refptr<ServiceWorkerVersion> installing_version_;
153 scoped_refptr<ServiceWorkerVersion> running_hosted_version_; 158 scoped_refptr<ServiceWorkerVersion> running_hosted_version_;
154 base::WeakPtr<ServiceWorkerContextCore> context_; 159 base::WeakPtr<ServiceWorkerContextCore> context_;
155 ServiceWorkerDispatcherHost* dispatcher_host_; 160 ServiceWorkerDispatcherHost* dispatcher_host_;
161 bool allow_association_;
156 162
157 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerProviderHost); 163 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerProviderHost);
158 }; 164 };
159 165
160 } // namespace content 166 } // namespace content
161 167
162 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_PROVIDER_HOST_H_ 168 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_PROVIDER_HOST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698