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

Unified Diff: content/renderer/service_worker/worker_fetch_context_impl.h

Issue 2816403002: test all
Patch Set: fix sharedworker Created 3 years, 8 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/renderer/service_worker/worker_fetch_context_impl.h
diff --git a/content/renderer/service_worker/worker_fetch_context_impl.h b/content/renderer/service_worker/worker_fetch_context_impl.h
new file mode 100644
index 0000000000000000000000000000000000000000..17ea92b6f39aab9f5daed4bbf0f861af86837976
--- /dev/null
+++ b/content/renderer/service_worker/worker_fetch_context_impl.h
@@ -0,0 +1,88 @@
+// Copyright 2017 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_RENDERER_SERVICE_WORKER_WORKER_FETCH_CONTEXT_IMPL_H_
+#define CONTENT_RENDERER_SERVICE_WORKER_WORKER_FETCH_CONTEXT_IMPL_H_
+
+#include "content/common/service_worker/service_worker_types.h"
+#include "content/common/worker_url_loader_factory_provider.mojom.h"
+#include "ipc/ipc_message.h"
+#include "mojo/public/cpp/bindings/associated_binding.h"
+#include "third_party/WebKit/public/platform/WebWorkerFetchContext.h"
+
+namespace base {
+class SingleThreadTaskRunner;
+} // namespace base
+
+namespace blink {
+class WebURL;
+class WebWorkerFetchContext;
+} // namespace blink
+
+namespace IPC {
+class Message;
+} // namespace IPC
+
+namespace content {
+
+class ResourceDispatcher;
+class ThreadSafeSender;
+
+class WorkerFetchContextImpl : public blink::WebWorkerFetchContext,
+ public mojom::ServiceWorkerWorkerClient {
+ public:
+ explicit WorkerFetchContextImpl(
+ mojom::WorkerURLLoaderFactoryProviderPtrInfo provider_info);
+ ~WorkerFetchContextImpl() override;
+
+ // blink::WebWorkerFetchContext implementation:
+ void InitializeOnWorkerThread(base::SingleThreadTaskRunner*) override;
+ blink::WebURLLoader* CreateURLLoader() override;
+ void WillSendRequest(blink::WebURLRequest&) override;
+ bool IsControlledByServiceWorker() const override;
+ int64_t ServiceWorkerID() const override;
+ void DidRunContentWithCertificateErrors(const blink::WebURL& url) override;
+ void DidDisplayContentWithCertificateErrors(
+ const blink::WebURL& url) override;
+ void SetAppCacheHostID(int id) override;
+ void SetDataSaverEnabled(bool flag) override;
+ void SetStrictMixedContentCheckingEnabled(bool enabled) override;
+
+ // Sets the fetch context status of the parent frame.
+ void SetParentFrameID(int id);
+ void SetServiceWorkerProviderID(int id);
+ void SetIsSecureContext(bool flag);
+ void SetIsControlledByServiceWorker(bool flag);
+
+ // mojom::ServiceWorkerWorkerClient implementation:
+ void SetControllerServiceWorker(int64_t controller_version_id) override;
+
+ private:
+ bool Send(IPC::Message* message);
+
+ mojom::WorkerURLLoaderFactoryProviderPtrInfo provider_info_;
+ scoped_refptr<ThreadSafeSender> thread_safe_sender_;
+ int appcache_host_id_ = 0;
+ int parent_frame_id_ = MSG_ROUTING_NONE;
+ int service_worker_provider_id_ = kInvalidServiceWorkerProviderId;
+ bool is_secure_context_ = false;
+ bool is_controlled_by_service_worker_ = false;
+ bool data_saver_enabled_ = false;
+ bool strict_mixed_content_checking_enabled_ = false;
+
+ // Initialized on the worker thread when InitializeOnWorkerThread() is called.
+ std::unique_ptr<ResourceDispatcher> resource_dispatcher_;
+ std::unique_ptr<mojo::AssociatedBinding<mojom::ServiceWorkerWorkerClient>>
+ binding_;
+ mojom::WorkerURLLoaderFactoryProviderPtr provider_;
+ mojom::URLLoaderFactoryAssociatedPtr url_loader_factory_;
+
+ // Updated when mojom::ServiceWorkerWorkerClient::SetControllerServiceWorker()
+ // is called from the browser process via mojo IPC.
+ int controller_version_id_ = kInvalidServiceWorkerVersionId;
+};
+
+} // namespace content
+
+#endif // CONTENT_RENDERER_SERVICE_WORKER_WORKER_FETCH_CONTEXT_IMPL_H_

Powered by Google App Engine
This is Rietveld 408576698