OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 30 matching lines...) Expand all Loading... |
41 #include "platform/loader/fetch/ResourceRequest.h" | 41 #include "platform/loader/fetch/ResourceRequest.h" |
42 #include "platform/weborigin/SecurityViolationReportingPolicy.h" | 42 #include "platform/weborigin/SecurityViolationReportingPolicy.h" |
43 #include "wtf/Forward.h" | 43 #include "wtf/Forward.h" |
44 #include "wtf/Noncopyable.h" | 44 #include "wtf/Noncopyable.h" |
45 | 45 |
46 namespace blink { | 46 namespace blink { |
47 | 47 |
48 class ClientHintsPreferences; | 48 class ClientHintsPreferences; |
49 class KURL; | 49 class KURL; |
50 class MHTMLArchive; | 50 class MHTMLArchive; |
| 51 class PlatformInstrumentationAgents; |
51 class ResourceError; | 52 class ResourceError; |
52 class ResourceResponse; | 53 class ResourceResponse; |
53 class ResourceTimingInfo; | 54 class ResourceTimingInfo; |
54 class WebTaskRunner; | 55 class WebTaskRunner; |
55 enum class WebCachePolicy; | 56 enum class WebCachePolicy; |
56 | 57 |
57 enum FetchResourceType { FetchMainResource, FetchSubresource }; | 58 enum FetchResourceType { FetchMainResource, FetchSubresource }; |
58 | 59 |
59 // The FetchContext is an interface for performing context specific processing | 60 // The FetchContext is an interface for performing context specific processing |
60 // in response to events in the ResourceFetcher. The ResourceFetcher or its job | 61 // in response to events in the ResourceFetcher. The ResourceFetcher or its job |
61 // class, ResourceLoader, may call the methods on a FetchContext. | 62 // class, ResourceLoader, may call the methods on a FetchContext. |
62 // | 63 // |
63 // Any processing that depends on components outside platform/loader/fetch/ | 64 // Any processing that depends on components outside platform/loader/fetch/ |
64 // should be implemented on a subclass of this interface, and then exposed to | 65 // should be implemented on a subclass of this interface, and then exposed to |
65 // the ResourceFetcher via this interface. | 66 // the ResourceFetcher via this interface. |
66 class PLATFORM_EXPORT FetchContext | 67 class PLATFORM_EXPORT FetchContext |
67 : public GarbageCollectedFinalized<FetchContext> { | 68 : public GarbageCollectedFinalized<FetchContext> { |
68 WTF_MAKE_NONCOPYABLE(FetchContext); | 69 WTF_MAKE_NONCOPYABLE(FetchContext); |
69 | 70 |
70 public: | 71 public: |
71 enum LogMessageType { LogErrorMessage, LogWarningMessage }; | 72 enum LogMessageType { LogErrorMessage, LogWarningMessage }; |
72 | 73 |
73 static FetchContext& nullInstance(); | 74 static FetchContext& nullInstance(); |
74 | 75 |
75 virtual ~FetchContext() {} | 76 virtual ~FetchContext() {} |
76 DEFINE_INLINE_VIRTUAL_TRACE() {} | 77 |
| 78 DECLARE_VIRTUAL_TRACE(); |
77 | 79 |
78 virtual bool isLiveContext() { return false; } | 80 virtual bool isLiveContext() { return false; } |
79 | 81 |
80 virtual void addAdditionalRequestHeaders(ResourceRequest&, FetchResourceType); | 82 virtual void addAdditionalRequestHeaders(ResourceRequest&, FetchResourceType); |
81 virtual CachePolicy getCachePolicy() const; | 83 virtual CachePolicy getCachePolicy() const; |
82 // Returns the cache policy for the resource. ResourceRequest is not passed as | 84 // Returns the cache policy for the resource. ResourceRequest is not passed as |
83 // a const reference as a header needs to be added for doc.write blocking | 85 // a const reference as a header needs to be added for doc.write blocking |
84 // intervention. | 86 // intervention. |
85 virtual WebCachePolicy resourceRequestCachePolicy( | 87 virtual WebCachePolicy resourceRequestCachePolicy( |
86 ResourceRequest&, | 88 ResourceRequest&, |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 | 183 |
182 virtual MHTMLArchive* archive() const { return nullptr; } | 184 virtual MHTMLArchive* archive() const { return nullptr; } |
183 | 185 |
184 virtual ResourceLoadPriority modifyPriorityForExperiments( | 186 virtual ResourceLoadPriority modifyPriorityForExperiments( |
185 ResourceLoadPriority priority) { | 187 ResourceLoadPriority priority) { |
186 return priority; | 188 return priority; |
187 } | 189 } |
188 | 190 |
189 virtual RefPtr<WebTaskRunner> loadingTaskRunner() const { return nullptr; } | 191 virtual RefPtr<WebTaskRunner> loadingTaskRunner() const { return nullptr; } |
190 | 192 |
| 193 PlatformInstrumentationAgents* instrumentingAgents() const { |
| 194 return m_instrumentingAgents; |
| 195 } |
| 196 |
191 protected: | 197 protected: |
192 FetchContext() {} | 198 FetchContext(); |
| 199 |
| 200 private: |
| 201 Member<PlatformInstrumentationAgents> m_instrumentingAgents; |
193 }; | 202 }; |
194 | 203 |
195 } // namespace blink | 204 } // namespace blink |
196 | 205 |
197 #endif | 206 #endif |
OLD | NEW |