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

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

Issue 325173002: ServiceWorker: Confirm the liveness of the associated context before handling message (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix more Created 6 years, 6 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 | Annotate | Revision Log
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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 // Returns a handler for a request, the handler may return NULL if 87 // Returns a handler for a request, the handler may return NULL if
88 // the request doesn't require special handling. 88 // the request doesn't require special handling.
89 scoped_ptr<ServiceWorkerRequestHandler> CreateRequestHandler( 89 scoped_ptr<ServiceWorkerRequestHandler> CreateRequestHandler(
90 ResourceType::Type resource_type, 90 ResourceType::Type resource_type,
91 base::WeakPtr<webkit_blob::BlobStorageContext> blob_storage_context); 91 base::WeakPtr<webkit_blob::BlobStorageContext> blob_storage_context);
92 92
93 // Returns true if |version| has the same registration as active and waiting 93 // Returns true if |version| has the same registration as active and waiting
94 // versions. 94 // versions.
95 bool ValidateVersionForAssociation(ServiceWorkerVersion* version); 95 bool ValidateVersionForAssociation(ServiceWorkerVersion* version);
96 96
97 // Returns true if the context referred to by this host (i.e. |context_|) is
98 // still alive.
99 bool IsContextAlive();
100
97 // Dispatches message event to the document. 101 // Dispatches message event to the document.
98 void PostMessage(const base::string16& message, 102 void PostMessage(const base::string16& message,
99 const std::vector<int>& sent_message_port_ids); 103 const std::vector<int>& sent_message_port_ids);
100 104
101 private: 105 private:
102 // Creates a ServiceWorkerHandle to retain |version| and returns a 106 // Creates a ServiceWorkerHandle to retain |version| and returns a
103 // ServiceWorkerInfo with the handle ID to pass to the provider. The 107 // ServiceWorkerInfo with the handle ID to pass to the provider. The
104 // provider is responsible for releasing the handle. 108 // provider is responsible for releasing the handle.
105 ServiceWorkerObjectInfo CreateHandleAndPass(ServiceWorkerVersion* version); 109 ServiceWorkerObjectInfo CreateHandleAndPass(ServiceWorkerVersion* version);
106 110
107 const int process_id_; 111 const int process_id_;
108 const int provider_id_; 112 const int provider_id_;
109 GURL document_url_; 113 GURL document_url_;
110 scoped_refptr<ServiceWorkerVersion> active_version_; 114 scoped_refptr<ServiceWorkerVersion> active_version_;
111 scoped_refptr<ServiceWorkerVersion> waiting_version_; 115 scoped_refptr<ServiceWorkerVersion> waiting_version_;
112 scoped_refptr<ServiceWorkerVersion> running_hosted_version_; 116 scoped_refptr<ServiceWorkerVersion> running_hosted_version_;
113 base::WeakPtr<ServiceWorkerContextCore> context_; 117 base::WeakPtr<ServiceWorkerContextCore> context_;
114 ServiceWorkerDispatcherHost* dispatcher_host_; 118 ServiceWorkerDispatcherHost* dispatcher_host_;
115 119
116 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerProviderHost); 120 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerProviderHost);
117 }; 121 };
118 122
119 } // namespace content 123 } // namespace content
120 124
121 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_PROVIDER_HOST_H_ 125 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_PROVIDER_HOST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698