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

Side by Side Diff: content/child/service_worker/service_worker_network_provider.h

Issue 183993004: Tease apart ServiceWorkerNetworkProvider from other stuff. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 | Annotate | Revision Log
OLDNEW
(Empty)
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
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 class ThreadSafeSender;
15
16 // A unique provider_id is generated for each instance.
17 // Instanced prior to the main resource load being started and remains
18 // allocated until after the last subresoure load has occured.
19 // This is used to track the lifetime of a Document to create
20 // and dispose the ServiceWorkerProviderHost in the browser process
21 // to match its lifetime. Each request coming from the Document is
22 // tagged with this id in willSendRequest.
23 // tl;dr
24 // Its a scoped integer that sends an ipc upon ctor'tion and dtor'tion.
25 class ServiceWorkerNetworkProvider : public base::SupportsUserData::Data {
26 public:
27 // Ownership is trasferred to the DocumentState.
28 static void AttachToDocumentState(
29 base::SupportsUserData* document_state,
30 scoped_ptr<ServiceWorkerNetworkProvider> network_provider);
31
32 static ServiceWorkerNetworkProvider* FromDocumentState(
33 base::SupportsUserData* document_state);
34
35 ServiceWorkerNetworkProvider(ThreadSafeSender* thread_safe_sender);
36 virtual ~ServiceWorkerNetworkProvider();
37
38 int provider_id() const { return provider_id_; }
39
40 private:
41 const int provider_id_;
42 scoped_refptr<ThreadSafeSender> thread_safe_sender_;
43
44 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerNetworkProvider);
45 };
46
47 } // namespace content
48
49 #endif // CONTENT_CHILD_SERVICE_WORKER_WEB_SERVICE_WORKER_PROVIDER_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698