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

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

Issue 2072613002: Make ResourceLoadPriority calculation simpler (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 5 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 12 matching lines...) Expand all
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */ 24 */
25 25
26 #include "core/fetch/FetchRequest.h" 26 #include "core/fetch/FetchRequest.h"
27 27
28 #include "core/fetch/CrossOriginAccessControl.h" 28 #include "core/fetch/CrossOriginAccessControl.h"
29 #include "core/fetch/ResourceFetcher.h" 29 #include "core/fetch/ResourceFetcher.h"
30 30
31 namespace blink { 31 namespace blink {
32 32
33 FetchRequest::FetchRequest(const ResourceRequest& resourceRequest, const AtomicS tring& initiator, const String& charset, ResourceLoadPriority priority) 33 FetchRequest::FetchRequest(const ResourceRequest& resourceRequest, const AtomicS tring& initiator, const String& charset)
34 : m_resourceRequest(resourceRequest) 34 : m_resourceRequest(resourceRequest)
35 , m_charset(charset) 35 , m_charset(charset)
36 , m_options(ResourceFetcher::defaultResourceOptions()) 36 , m_options(ResourceFetcher::defaultResourceOptions())
37 , m_priority(priority)
38 , m_forPreload(false) 37 , m_forPreload(false)
39 , m_linkPreload(false) 38 , m_linkPreload(false)
40 , m_preloadDiscoveryTime(0.0) 39 , m_preloadDiscoveryTime(0.0)
41 , m_defer(NoDefer) 40 , m_defer(NoDefer)
42 , m_originRestriction(UseDefaultOriginRestrictionForType) 41 , m_originRestriction(UseDefaultOriginRestrictionForType)
43 { 42 {
44 m_options.initiatorInfo.name = initiator; 43 m_options.initiatorInfo.name = initiator;
45 } 44 }
46 45
47 FetchRequest::FetchRequest(const ResourceRequest& resourceRequest, const AtomicS tring& initiator, const ResourceLoaderOptions& options) 46 FetchRequest::FetchRequest(const ResourceRequest& resourceRequest, const AtomicS tring& initiator, const ResourceLoaderOptions& options)
48 : m_resourceRequest(resourceRequest) 47 : m_resourceRequest(resourceRequest)
49 , m_options(options) 48 , m_options(options)
50 , m_priority(ResourceLoadPriorityUnresolved)
51 , m_forPreload(false) 49 , m_forPreload(false)
52 , m_linkPreload(false) 50 , m_linkPreload(false)
53 , m_preloadDiscoveryTime(0.0) 51 , m_preloadDiscoveryTime(0.0)
54 , m_defer(NoDefer) 52 , m_defer(NoDefer)
55 , m_originRestriction(UseDefaultOriginRestrictionForType) 53 , m_originRestriction(UseDefaultOriginRestrictionForType)
56 { 54 {
57 m_options.initiatorInfo.name = initiator; 55 m_options.initiatorInfo.name = initiator;
58 } 56 }
59 57
60 FetchRequest::FetchRequest(const ResourceRequest& resourceRequest, const FetchIn itiatorInfo& initiator) 58 FetchRequest::FetchRequest(const ResourceRequest& resourceRequest, const FetchIn itiatorInfo& initiator)
61 : m_resourceRequest(resourceRequest) 59 : m_resourceRequest(resourceRequest)
62 , m_options(ResourceFetcher::defaultResourceOptions()) 60 , m_options(ResourceFetcher::defaultResourceOptions())
63 , m_priority(ResourceLoadPriorityUnresolved)
64 , m_forPreload(false) 61 , m_forPreload(false)
65 , m_linkPreload(false) 62 , m_linkPreload(false)
66 , m_preloadDiscoveryTime(0.0) 63 , m_preloadDiscoveryTime(0.0)
67 , m_defer(NoDefer) 64 , m_defer(NoDefer)
68 , m_originRestriction(UseDefaultOriginRestrictionForType) 65 , m_originRestriction(UseDefaultOriginRestrictionForType)
69 { 66 {
70 m_options.initiatorInfo = initiator; 67 m_options.initiatorInfo = initiator;
71 } 68 }
72 69
73 FetchRequest::~FetchRequest() 70 FetchRequest::~FetchRequest()
(...skipping 26 matching lines...) Expand all
100 m_resourceWidth.isSet = true; 97 m_resourceWidth.isSet = true;
101 } 98 }
102 } 99 }
103 100
104 void FetchRequest::setForPreload(bool forPreload, double discoveryTime) 101 void FetchRequest::setForPreload(bool forPreload, double discoveryTime)
105 { 102 {
106 m_forPreload = forPreload; 103 m_forPreload = forPreload;
107 m_preloadDiscoveryTime = discoveryTime; 104 m_preloadDiscoveryTime = discoveryTime;
108 } 105 }
109 106
107 void FetchRequest::makeSynchronous()
108 {
109 // Synchronous requests should always be max priority, lest they hang the re nderer.
110 m_resourceRequest.setPriority(ResourceLoadPriorityHighest);
111 m_resourceRequest.setTimeoutInterval(10);
112 m_options.synchronousPolicy = RequestSynchronously;
113 }
114
110 } // namespace blink 115 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/fetch/FetchRequest.h ('k') | third_party/WebKit/Source/core/fetch/RawResource.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698