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

Side by Side Diff: third_party/WebKit/Source/core/fetch/FetchRequest.h

Issue 2072613002: Make ResourceLoadPriority calculation simpler (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Drop a default arg Created 4 years, 6 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 /* 1 /*
2 * Copyright (C) 2012 Google, Inc. All rights reserved. 2 * Copyright (C) 2012 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 14 matching lines...) Expand all
25 25
26 #ifndef FetchRequest_h 26 #ifndef FetchRequest_h
27 #define FetchRequest_h 27 #define FetchRequest_h
28 28
29 #include "core/CoreExport.h" 29 #include "core/CoreExport.h"
30 #include "core/fetch/ClientHintsPreferences.h" 30 #include "core/fetch/ClientHintsPreferences.h"
31 #include "core/fetch/FetchInitiatorInfo.h" 31 #include "core/fetch/FetchInitiatorInfo.h"
32 #include "core/fetch/IntegrityMetadata.h" 32 #include "core/fetch/IntegrityMetadata.h"
33 #include "core/fetch/ResourceLoaderOptions.h" 33 #include "core/fetch/ResourceLoaderOptions.h"
34 #include "platform/CrossOriginAttributeValue.h" 34 #include "platform/CrossOriginAttributeValue.h"
35 #include "platform/network/ResourceLoadPriority.h"
36 #include "platform/network/ResourceRequest.h" 35 #include "platform/network/ResourceRequest.h"
37 #include "wtf/Allocator.h" 36 #include "wtf/Allocator.h"
38 #include "wtf/text/AtomicString.h" 37 #include "wtf/text/AtomicString.h"
39 38
40 namespace blink { 39 namespace blink {
41 class SecurityOrigin; 40 class SecurityOrigin;
42 41
43 class CORE_EXPORT FetchRequest { 42 class CORE_EXPORT FetchRequest {
44 STACK_ALLOCATED(); 43 STACK_ALLOCATED();
45 public: 44 public:
46 enum DeferOption { NoDefer, LazyLoad }; 45 enum DeferOption { NoDefer, LazyLoad };
47 enum OriginRestriction { UseDefaultOriginRestrictionForType, RestrictToSameO rigin, NoOriginRestriction }; 46 enum OriginRestriction { UseDefaultOriginRestrictionForType, RestrictToSameO rigin, NoOriginRestriction };
48 47
49 struct ResourceWidth { 48 struct ResourceWidth {
50 DISALLOW_NEW(); 49 DISALLOW_NEW();
51 float width; 50 float width;
52 bool isSet; 51 bool isSet;
53 52
54 ResourceWidth() 53 ResourceWidth()
55 : width(0) 54 : width(0)
56 , isSet(false) 55 , isSet(false)
57 { 56 {
58 } 57 }
59 }; 58 };
60 59
61 explicit FetchRequest(const ResourceRequest&, const AtomicString& initiator, const String& charset = String(), ResourceLoadPriority = ResourceLoadPriorityUn resolved); 60 explicit FetchRequest(const ResourceRequest&, const AtomicString& initiator, const String& charset = String());
kinuko 2016/06/17 05:40:47 nit: this probably no need to be explicit
Nate Chapin 2016/06/17 18:38:16 Done.
62 FetchRequest(const ResourceRequest&, const AtomicString& initiator, const Re sourceLoaderOptions&); 61 FetchRequest(const ResourceRequest&, const AtomicString& initiator, const Re sourceLoaderOptions&);
63 FetchRequest(const ResourceRequest&, const FetchInitiatorInfo&); 62 FetchRequest(const ResourceRequest&, const FetchInitiatorInfo&);
64 ~FetchRequest(); 63 ~FetchRequest();
65 64
66 ResourceRequest& mutableResourceRequest() { return m_resourceRequest; } 65 ResourceRequest& mutableResourceRequest() { return m_resourceRequest; }
67 const ResourceRequest& resourceRequest() const { return m_resourceRequest; } 66 const ResourceRequest& resourceRequest() const { return m_resourceRequest; }
68 const KURL& url() const { return m_resourceRequest.url(); } 67 const KURL& url() const { return m_resourceRequest.url(); }
69 68
70 const String& charset() const { return m_charset; } 69 const String& charset() const { return m_charset; }
71 void setCharset(const String& charset) { m_charset = charset; } 70 void setCharset(const String& charset) { m_charset = charset; }
72 71
73 const ResourceLoaderOptions& options() const { return m_options; } 72 const ResourceLoaderOptions& options() const { return m_options; }
74 void setOptions(const ResourceLoaderOptions& options) { m_options = options; }
75
76 ResourceLoadPriority priority() const { return m_priority; }
77 void setPriority(ResourceLoadPriority priority) { m_priority = priority; }
78 73
79 DeferOption defer() const { return m_defer; } 74 DeferOption defer() const { return m_defer; }
80 void setDefer(DeferOption defer) { m_defer = defer; } 75 void setDefer(DeferOption defer) { m_defer = defer; }
81 76
82 ResourceWidth getResourceWidth() const { return m_resourceWidth; } 77 ResourceWidth getResourceWidth() const { return m_resourceWidth; }
83 void setResourceWidth(ResourceWidth); 78 void setResourceWidth(ResourceWidth);
84 79
85 ClientHintsPreferences& clientHintsPreferences() { return m_clientHintPrefer ences; } 80 ClientHintsPreferences& clientHintsPreferences() { return m_clientHintPrefer ences; }
86 81
87 bool forPreload() const { return m_forPreload; } 82 bool forPreload() const { return m_forPreload; }
88 void setForPreload(bool forPreload, double discoveryTime = 0); 83 void setForPreload(bool forPreload, double discoveryTime = 0);
89 84
90 double preloadDiscoveryTime() { return m_preloadDiscoveryTime; } 85 double preloadDiscoveryTime() { return m_preloadDiscoveryTime; }
91 86
92 bool isLinkPreload() { return m_linkPreload; } 87 bool isLinkPreload() { return m_linkPreload; }
93 void setLinkPreload(bool isLinkPreload) { m_linkPreload = isLinkPreload; } 88 void setLinkPreload(bool isLinkPreload) { m_linkPreload = isLinkPreload; }
94 89
95 void setContentSecurityCheck(ContentSecurityPolicyDisposition contentSecurit yPolicyOption) { m_options.contentSecurityPolicyOption = contentSecurityPolicyOp tion; } 90 void setContentSecurityCheck(ContentSecurityPolicyDisposition contentSecurit yPolicyOption) { m_options.contentSecurityPolicyOption = contentSecurityPolicyOp tion; }
96 void setCrossOriginAccessControl(SecurityOrigin*, CrossOriginAttributeValue) ; 91 void setCrossOriginAccessControl(SecurityOrigin*, CrossOriginAttributeValue) ;
97 OriginRestriction getOriginRestriction() const { return m_originRestriction; } 92 OriginRestriction getOriginRestriction() const { return m_originRestriction; }
98 void setOriginRestriction(OriginRestriction restriction) { m_originRestricti on = restriction; } 93 void setOriginRestriction(OriginRestriction restriction) { m_originRestricti on = restriction; }
99 const IntegrityMetadataSet& integrityMetadata() const { return m_integrityMe tadata; } 94 const IntegrityMetadataSet& integrityMetadata() const { return m_integrityMe tadata; }
100 void setIntegrityMetadata(const IntegrityMetadataSet& metadata) { m_integrit yMetadata = metadata; } 95 void setIntegrityMetadata(const IntegrityMetadataSet& metadata) { m_integrit yMetadata = metadata; }
101 96
102 String contentSecurityPolicyNonce() const { return m_options.contentSecurity PolicyNonce; } 97 String contentSecurityPolicyNonce() const { return m_options.contentSecurity PolicyNonce; }
103 void setContentSecurityPolicyNonce(const String& nonce) { m_options.contentS ecurityPolicyNonce = nonce; } 98 void setContentSecurityPolicyNonce(const String& nonce) { m_options.contentS ecurityPolicyNonce = nonce; }
104 99
100 void makeSynchronous();
101
105 private: 102 private:
106 ResourceRequest m_resourceRequest; 103 ResourceRequest m_resourceRequest;
107 String m_charset; 104 String m_charset;
108 ResourceLoaderOptions m_options; 105 ResourceLoaderOptions m_options;
109 ResourceLoadPriority m_priority;
110 bool m_forPreload; 106 bool m_forPreload;
111 bool m_linkPreload; 107 bool m_linkPreload;
112 double m_preloadDiscoveryTime; 108 double m_preloadDiscoveryTime;
113 DeferOption m_defer; 109 DeferOption m_defer;
114 OriginRestriction m_originRestriction; 110 OriginRestriction m_originRestriction;
115 ResourceWidth m_resourceWidth; 111 ResourceWidth m_resourceWidth;
116 ClientHintsPreferences m_clientHintPreferences; 112 ClientHintsPreferences m_clientHintPreferences;
117 IntegrityMetadataSet m_integrityMetadata; 113 IntegrityMetadataSet m_integrityMetadata;
118 }; 114 };
119 115
120 } // namespace blink 116 } // namespace blink
121 117
122 #endif 118 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698