OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CONTENT_CHILD_SERVICE_WORKER_SERVICE_WORKER_NETWORK_PROVIDER_IMPL_H_ | |
6 #define CONTENT_CHILD_SERVICE_WORKER_SERVICE_WORKER_NETWORK_PROVIDER_IMPL_H_ | |
7 | |
8 #include "base/compiler_specific.h" | |
9 #include "base/memory/scoped_ptr.h" | |
10 #include "base/supports_user_data.h" | |
11 | |
12 namespace content { | |
13 | |
14 // A unique provider_id is generated for each instance. | |
15 // Instanced prior to the main resource load being started and remains | |
Charlie Reis
2014/03/04 23:02:17
Instantiated
(Sorry, I had trouble reading this wi
michaeln
2014/03/04 23:53:46
Done.
| |
16 // allocated until after the last subresoure load has occured. | |
Charlie Reis
2014/03/04 23:02:17
subresource, occurred
michaeln
2014/03/04 23:53:46
Done.
| |
17 // This is used to track the lifetime of a Document to create | |
18 // and dispose the ServiceWorkerProviderHost in the browser process | |
Charlie Reis
2014/03/04 23:02:17
Presumably the browser process also disposes of th
michaeln
2014/03/04 23:53:46
oh, we hadn't thought of that ;)
JK, yes, cleanup
| |
19 // to match its lifetime. Each request coming from the Document is | |
20 // tagged with this id in willSendRequest. | |
21 // tl;dr | |
22 // Its a scoped integer that sends an ipc upon ctor'tion and dtor'tion. | |
Charlie Reis
2014/03/04 23:02:17
It's
Also, you might say either "via ctor/dtor" o
michaeln
2014/03/04 23:53:46
Done (but... i kinda liked that pun)
| |
23 class ServiceWorkerNetworkProvider : public base::SupportsUserData::Data { | |
24 public: | |
25 // Ownership is trasferred to the DocumentState. | |
Charlie Reis
2014/03/04 23:02:17
transferred
michaeln
2014/03/04 23:53:46
Done.
| |
26 static void AttachToDocumentState( | |
27 base::SupportsUserData* document_state, | |
28 scoped_ptr<ServiceWorkerNetworkProvider> network_provider); | |
29 | |
30 static ServiceWorkerNetworkProvider* FromDocumentState( | |
31 base::SupportsUserData* document_state); | |
32 | |
33 ServiceWorkerNetworkProvider(); | |
34 virtual ~ServiceWorkerNetworkProvider(); | |
35 | |
36 int provider_id() const { return provider_id_; } | |
37 | |
38 private: | |
39 const int provider_id_; | |
40 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerNetworkProvider); | |
41 }; | |
42 | |
43 } // namespace content | |
44 | |
45 #endif // CONTENT_CHILD_SERVICE_WORKER_WEB_SERVICE_WORKER_PROVIDER_IMPL_H_ | |
OLD | NEW |