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

Unified 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, 10 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 side-by-side diff with in-line comments
Download patch
Index: content/child/service_worker/service_worker_network_provider.h
diff --git a/content/child/service_worker/service_worker_network_provider.h b/content/child/service_worker/service_worker_network_provider.h
new file mode 100644
index 0000000000000000000000000000000000000000..67da8eeece72466a4465116d19e01be120dbedc7
--- /dev/null
+++ b/content/child/service_worker/service_worker_network_provider.h
@@ -0,0 +1,45 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CONTENT_CHILD_SERVICE_WORKER_SERVICE_WORKER_NETWORK_PROVIDER_IMPL_H_
+#define CONTENT_CHILD_SERVICE_WORKER_SERVICE_WORKER_NETWORK_PROVIDER_IMPL_H_
+
+#include "base/compiler_specific.h"
+#include "base/memory/scoped_ptr.h"
+#include "base/supports_user_data.h"
+
+namespace content {
+
+// A unique provider_id is generated for each instance.
+// 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.
+// 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.
+// This is used to track the lifetime of a Document to create
+// 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
+// to match its lifetime. Each request coming from the Document is
+// tagged with this id in willSendRequest.
+// tl;dr
+// 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)
+class ServiceWorkerNetworkProvider : public base::SupportsUserData::Data {
+ public:
+ // Ownership is trasferred to the DocumentState.
Charlie Reis 2014/03/04 23:02:17 transferred
michaeln 2014/03/04 23:53:46 Done.
+ static void AttachToDocumentState(
+ base::SupportsUserData* document_state,
+ scoped_ptr<ServiceWorkerNetworkProvider> network_provider);
+
+ static ServiceWorkerNetworkProvider* FromDocumentState(
+ base::SupportsUserData* document_state);
+
+ ServiceWorkerNetworkProvider();
+ virtual ~ServiceWorkerNetworkProvider();
+
+ int provider_id() const { return provider_id_; }
+
+ private:
+ const int provider_id_;
+ DISALLOW_COPY_AND_ASSIGN(ServiceWorkerNetworkProvider);
+};
+
+} // namespace content
+
+#endif // CONTENT_CHILD_SERVICE_WORKER_WEB_SERVICE_WORKER_PROVIDER_IMPL_H_

Powered by Google App Engine
This is Rietveld 408576698