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

Side by Side Diff: third_party/WebKit/Source/core/loader/WorkerFetchContext.h

Issue 2880733002: Partially implement WorkerFetchContext and WorkerThreadableLoadingContext and add virtual tests (Closed)
Patch Set: Created 3 years, 7 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 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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 WorkerFetchContext_h 5 #ifndef WorkerFetchContext_h
6 #define WorkerFetchContext_h 6 #define WorkerFetchContext_h
7 7
8 #include <memory> 8 #include <memory>
9 #include "core/CoreExport.h" 9 #include "core/CoreExport.h"
10 #include "platform/loader/fetch/FetchContext.h" 10 #include "core/loader/BaseFetchContext.h"
11 #include "platform/wtf/Forward.h" 11 #include "platform/wtf/Forward.h"
12 12
13 namespace blink { 13 namespace blink {
14 14
15 class WorkerClients; 15 class ResourceFetcher;
16 class WebTaskRunner;
16 class WebURLLoader; 17 class WebURLLoader;
17 class WebWorkerFetchContext; 18 class WebWorkerFetchContext;
18 class WorkerGlobalScope; 19 class WorkerGlobalScope;
20 class WorkerClients;
19 21
20 CORE_EXPORT void ProvideWorkerFetchContextToWorker( 22 CORE_EXPORT void ProvideWorkerFetchContextToWorker(
21 WorkerClients*, 23 WorkerClients*,
22 std::unique_ptr<WebWorkerFetchContext>); 24 std::unique_ptr<WebWorkerFetchContext>);
23 25
24 // The WorkerFetchContext is a FetchContext for workers (dedicated, shared and 26 // The WorkerFetchContext is a FetchContext for workers (dedicated, shared and
25 // service workers). This class is used only when off-main-thread-fetch is 27 // service workers). This class is used only when off-main-thread-fetch is
26 // enabled, and is still under development. 28 // enabled, and is still under development.
27 // TODO(horo): Implement all methods of FetchContext. crbug.com/443374 29 // TODO(horo): Implement all methods of FetchContext. crbug.com/443374
28 class WorkerFetchContext final : public FetchContext { 30 class WorkerFetchContext final : public BaseFetchContext {
29 public: 31 public:
30 static WorkerFetchContext* Create(WorkerGlobalScope&); 32 static WorkerFetchContext* Create(WorkerGlobalScope&);
31 virtual ~WorkerFetchContext(); 33 virtual ~WorkerFetchContext();
32 34
35 ResourceFetcher* GetResourceFetcher();
36
37 // BaseFetchContext implementation:
38 ContentSettingsClient* GetContentSettingsClient() const;
39 Settings* GetSettings() const;
40 SubresourceFilter* GetSubresourceFilter() const;
41 SecurityContext* GetParentSecurityContext() const;
42 bool ShouldBlockRequestByInspector(const ResourceRequest&) const;
43 void DispatchDidBlockRequest(const ResourceRequest&,
44 const FetchInitiatorInfo&,
45 ResourceRequestBlockedReason) const;
46 void ReportLocalLoadFailed(const KURL&) const;
47 bool ShouldBypassMainWorldCSP() const;
48 bool IsSVGImageChromeClient() const;
49 void CountUsage(UseCounter::Feature) const;
50 void CountDeprecation(UseCounter::Feature) const;
51 bool ShouldBlockFetchByMixedContentCheck(
52 const ResourceRequest&,
53 const KURL&,
54 SecurityViolationReportingPolicy) const;
55
33 // FetchContext implementation: 56 // FetchContext implementation:
34 // TODO(horo): Implement more methods. 57 // TODO(horo): Implement more methods.
35 std::unique_ptr<WebURLLoader> CreateURLLoader() override; 58 std::unique_ptr<WebURLLoader> CreateURLLoader() override;
36 void PrepareRequest(ResourceRequest&, RedirectType) override; 59 void PrepareRequest(ResourceRequest&, RedirectType) override;
37 bool IsControlledByServiceWorker() const override; 60 bool IsControlledByServiceWorker() const override;
61 RefPtr<WebTaskRunner> LoadingTaskRunner() const override;
62
63 DECLARE_VIRTUAL_TRACE();
38 64
39 private: 65 private:
40 explicit WorkerFetchContext(std::unique_ptr<WebWorkerFetchContext>); 66 explicit WorkerFetchContext(WorkerGlobalScope&,
kinuko 2017/05/12 08:41:45 no need of explicit
horo 2017/05/12 09:06:02 Done.
67 std::unique_ptr<WebWorkerFetchContext>);
41 68
69 Member<WorkerGlobalScope> worker_global_scope_;
42 std::unique_ptr<WebWorkerFetchContext> web_context_; 70 std::unique_ptr<WebWorkerFetchContext> web_context_;
71 Member<ResourceFetcher> resource_fetcher_;
72 RefPtr<WebTaskRunner> loading_task_runner_;
43 }; 73 };
44 74
45 } // namespace blink 75 } // namespace blink
46 76
47 #endif // WorkerFetchContext_h 77 #endif // WorkerFetchContext_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698