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

Side by Side Diff: content/renderer/service_worker/service_worker_script_context.h

Issue 992353003: Decouple Cache Storage messaging from Service Worker/Embedded Worker (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 5 years, 9 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 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_RENDERER_SERVICE_WORKER_SERVICE_WORKER_SCRIPT_CONTEXT_H_ 5 #ifndef CONTENT_RENDERER_SERVICE_WORKER_SERVICE_WORKER_SCRIPT_CONTEXT_H_
6 #define CONTENT_RENDERER_SERVICE_WORKER_SERVICE_WORKER_SCRIPT_CONTEXT_H_ 6 #define CONTENT_RENDERER_SERVICE_WORKER_SERVICE_WORKER_SCRIPT_CONTEXT_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/basictypes.h" 12 #include "base/basictypes.h"
13 #include "base/id_map.h" 13 #include "base/id_map.h"
14 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
15 #include "base/strings/string16.h" 15 #include "base/strings/string16.h"
16 #include "base/time/time.h" 16 #include "base/time/time.h"
17 #include "content/child/webmessageportchannel_impl.h" 17 #include "content/child/webmessageportchannel_impl.h"
18 #include "content/common/service_worker/service_worker_types.h" 18 #include "content/common/service_worker/service_worker_types.h"
19 #include "content/renderer/service_worker/service_worker_cache_storage_dispatche r.h" 19 #include "content/renderer/service_worker/service_worker_cache_storage_dispatche r.h"
20 #include "content/renderer/service_worker/webserviceworkercachestorage_impl.h"
20 #include "third_party/WebKit/public/platform/WebGeofencingEventType.h" 21 #include "third_party/WebKit/public/platform/WebGeofencingEventType.h"
21 #include "third_party/WebKit/public/platform/WebMessagePortChannel.h" 22 #include "third_party/WebKit/public/platform/WebMessagePortChannel.h"
23 #include "third_party/WebKit/public/platform/WebServiceWorkerCacheStorage.h"
22 #include "third_party/WebKit/public/platform/WebServiceWorkerClientsClaimCallbac ks.h" 24 #include "third_party/WebKit/public/platform/WebServiceWorkerClientsClaimCallbac ks.h"
23 #include "third_party/WebKit/public/platform/WebServiceWorkerClientsInfo.h" 25 #include "third_party/WebKit/public/platform/WebServiceWorkerClientsInfo.h"
24 #include "third_party/WebKit/public/platform/WebServiceWorkerError.h" 26 #include "third_party/WebKit/public/platform/WebServiceWorkerError.h"
25 #include "third_party/WebKit/public/platform/WebServiceWorkerEventResult.h" 27 #include "third_party/WebKit/public/platform/WebServiceWorkerEventResult.h"
26 #include "third_party/WebKit/public/platform/WebServiceWorkerSkipWaitingCallback s.h" 28 #include "third_party/WebKit/public/platform/WebServiceWorkerSkipWaitingCallback s.h"
27 29
28 namespace blink { 30 namespace blink {
29 struct WebCircularGeofencingRegion; 31 struct WebCircularGeofencingRegion;
30 struct WebCrossOriginServiceWorkerClient; 32 struct WebCrossOriginServiceWorkerClient;
31 struct WebServiceWorkerClientQueryOptions; 33 struct WebServiceWorkerClientQueryOptions;
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 void SkipWaiting(blink::WebServiceWorkerSkipWaitingCallbacks* callbacks); 95 void SkipWaiting(blink::WebServiceWorkerSkipWaitingCallbacks* callbacks);
94 void ClaimClients(blink::WebServiceWorkerClientsClaimCallbacks* callbacks); 96 void ClaimClients(blink::WebServiceWorkerClientsClaimCallbacks* callbacks);
95 97
96 // Send a message to the browser. Takes ownership of |message|. 98 // Send a message to the browser. Takes ownership of |message|.
97 void Send(IPC::Message* message); 99 void Send(IPC::Message* message);
98 100
99 // Get routing_id for sending message to the ServiceWorkerVersion 101 // Get routing_id for sending message to the ServiceWorkerVersion
100 // in the browser process. 102 // in the browser process.
101 int GetRoutingID() const; 103 int GetRoutingID() const;
102 104
103 blink::WebServiceWorkerCacheStorage* cache_storage() { 105 // TODO(jsbell): Remove when CacheStorage creation is moved. crbug.com/439389
104 return cache_storage_dispatcher_.get(); 106 blink::WebServiceWorkerCacheStorage* cache_storage() const {
107 return cache_storage_.get();
105 } 108 }
106 109
107 private: 110 private:
108 typedef IDMap<blink::WebServiceWorkerClientsCallbacks, IDMapOwnPointer> 111 typedef IDMap<blink::WebServiceWorkerClientsCallbacks, IDMapOwnPointer>
109 ClientsCallbacksMap; 112 ClientsCallbacksMap;
110 typedef IDMap<blink::WebServiceWorkerClientsClaimCallbacks, IDMapOwnPointer> 113 typedef IDMap<blink::WebServiceWorkerClientsClaimCallbacks, IDMapOwnPointer>
111 ClaimClientsCallbacksMap; 114 ClaimClientsCallbacksMap;
112 typedef IDMap<blink::WebServiceWorkerClientCallbacks, IDMapOwnPointer> 115 typedef IDMap<blink::WebServiceWorkerClientCallbacks, IDMapOwnPointer>
113 ClientCallbacksMap; 116 ClientCallbacksMap;
114 typedef IDMap<blink::WebServiceWorkerSkipWaitingCallbacks, IDMapOwnPointer> 117 typedef IDMap<blink::WebServiceWorkerSkipWaitingCallbacks, IDMapOwnPointer>
(...skipping 30 matching lines...) Expand all
145 void OnOpenWindowError(int request_id, const std::string& message); 148 void OnOpenWindowError(int request_id, const std::string& message);
146 void OnFocusClientResponse(int request_id, 149 void OnFocusClientResponse(int request_id,
147 const ServiceWorkerClientInfo& client); 150 const ServiceWorkerClientInfo& client);
148 void OnDidSkipWaiting(int request_id); 151 void OnDidSkipWaiting(int request_id);
149 void OnDidClaimClients(int request_id); 152 void OnDidClaimClients(int request_id);
150 void OnClaimClientsError(int request_id, 153 void OnClaimClientsError(int request_id,
151 blink::WebServiceWorkerError::ErrorType error_type, 154 blink::WebServiceWorkerError::ErrorType error_type,
152 const base::string16& message); 155 const base::string16& message);
153 void OnPing(); 156 void OnPing();
154 157
155 scoped_ptr<ServiceWorkerCacheStorageDispatcher> cache_storage_dispatcher_;
156
157 // Not owned; embedded_context_ owns this. 158 // Not owned; embedded_context_ owns this.
158 EmbeddedWorkerContextClient* embedded_context_; 159 EmbeddedWorkerContextClient* embedded_context_;
159 160
161 scoped_ptr<WebServiceWorkerCacheStorageImpl> cache_storage_;
162
160 // Not owned; this object is destroyed when proxy_ becomes invalid. 163 // Not owned; this object is destroyed when proxy_ becomes invalid.
161 blink::WebServiceWorkerContextProxy* proxy_; 164 blink::WebServiceWorkerContextProxy* proxy_;
162 165
163 // Used for incoming messages from the browser for which an outgoing response 166 // Used for incoming messages from the browser for which an outgoing response
164 // back to the browser is expected, the id must be sent back with the 167 // back to the browser is expected, the id must be sent back with the
165 // response. 168 // response.
166 int current_request_id_; 169 int current_request_id_;
167 170
168 // Pending callbacks for GetClientDocuments(). 171 // Pending callbacks for GetClientDocuments().
169 ClientsCallbacksMap pending_clients_callbacks_; 172 ClientsCallbacksMap pending_clients_callbacks_;
(...skipping 13 matching lines...) Expand all
183 std::map<int, base::TimeTicks> install_start_timings_; 186 std::map<int, base::TimeTicks> install_start_timings_;
184 std::map<int, base::TimeTicks> notification_click_start_timings_; 187 std::map<int, base::TimeTicks> notification_click_start_timings_;
185 std::map<int, base::TimeTicks> push_start_timings_; 188 std::map<int, base::TimeTicks> push_start_timings_;
186 189
187 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerScriptContext); 190 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerScriptContext);
188 }; 191 };
189 192
190 } // namespace content 193 } // namespace content
191 194
192 #endif // CONTENT_RENDERER_SERVICE_WORKER_SERVICE_WORKER_SCRIPT_CONTEXT_H_ 195 #endif // CONTENT_RENDERER_SERVICE_WORKER_SERVICE_WORKER_SCRIPT_CONTEXT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698