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 | 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 28 matching lines...) Expand all Loading... |
39 { | 39 { |
40 return adoptPtr(new PreloadRequest(initiatorName, initiatorPosition, res
ourceURL, baseURL, resourceType)); | 40 return adoptPtr(new PreloadRequest(initiatorName, initiatorPosition, res
ourceURL, baseURL, resourceType)); |
41 } | 41 } |
42 | 42 |
43 bool isSafeToSendToAnotherThread() const; | 43 bool isSafeToSendToAnotherThread() const; |
44 | 44 |
45 FetchRequest resourceRequest(Document*); | 45 FetchRequest resourceRequest(Document*); |
46 | 46 |
47 const String& charset() const { return m_charset; } | 47 const String& charset() const { return m_charset; } |
48 double discoveryTime() const { return m_discoveryTime; } | 48 double discoveryTime() const { return m_discoveryTime; } |
| 49 FetchRequest::DeferOption defer() const { return m_defer; } |
| 50 void setDefer(FetchRequest::DeferOption defer) { m_defer = defer; } |
49 void setCharset(const String& charset) { m_charset = charset.isolatedCopy();
} | 51 void setCharset(const String& charset) { m_charset = charset.isolatedCopy();
} |
50 void setCrossOriginEnabled(StoredCredentials allowCredentials) | 52 void setCrossOriginEnabled(StoredCredentials allowCredentials) |
51 { | 53 { |
52 m_isCORSEnabled = true; | 54 m_isCORSEnabled = true; |
53 m_allowCredentials = allowCredentials; | 55 m_allowCredentials = allowCredentials; |
54 } | 56 } |
55 | 57 |
56 Resource::Type resourceType() const { return m_resourceType; } | 58 Resource::Type resourceType() const { return m_resourceType; } |
57 | 59 |
58 private: | 60 private: |
59 PreloadRequest(const String& initiatorName, const TextPosition& initiatorPos
ition, const String& resourceURL, const KURL& baseURL, Resource::Type resourceTy
pe) | 61 PreloadRequest(const String& initiatorName, const TextPosition& initiatorPos
ition, const String& resourceURL, const KURL& baseURL, Resource::Type resourceTy
pe) |
60 : m_initiatorName(initiatorName) | 62 : m_initiatorName(initiatorName) |
61 , m_initiatorPosition(initiatorPosition) | 63 , m_initiatorPosition(initiatorPosition) |
62 , m_resourceURL(resourceURL.isolatedCopy()) | 64 , m_resourceURL(resourceURL.isolatedCopy()) |
63 , m_baseURL(baseURL.copy()) | 65 , m_baseURL(baseURL.copy()) |
64 , m_resourceType(resourceType) | 66 , m_resourceType(resourceType) |
65 , m_isCORSEnabled(false) | 67 , m_isCORSEnabled(false) |
66 , m_allowCredentials(DoNotAllowStoredCredentials) | 68 , m_allowCredentials(DoNotAllowStoredCredentials) |
67 , m_discoveryTime(monotonicallyIncreasingTime()) | 69 , m_discoveryTime(monotonicallyIncreasingTime()) |
| 70 , m_defer(FetchRequest::NoDefer) |
68 { | 71 { |
69 } | 72 } |
70 | 73 |
71 KURL completeURL(Document*); | 74 KURL completeURL(Document*); |
72 | 75 |
73 String m_initiatorName; | 76 String m_initiatorName; |
74 TextPosition m_initiatorPosition; | 77 TextPosition m_initiatorPosition; |
75 String m_resourceURL; | 78 String m_resourceURL; |
76 KURL m_baseURL; | 79 KURL m_baseURL; |
77 String m_charset; | 80 String m_charset; |
78 Resource::Type m_resourceType; | 81 Resource::Type m_resourceType; |
79 bool m_isCORSEnabled; | 82 bool m_isCORSEnabled; |
80 StoredCredentials m_allowCredentials; | 83 StoredCredentials m_allowCredentials; |
81 double m_discoveryTime; | 84 double m_discoveryTime; |
| 85 FetchRequest::DeferOption m_defer; |
82 }; | 86 }; |
83 | 87 |
84 typedef Vector<OwnPtr<PreloadRequest> > PreloadRequestStream; | 88 typedef Vector<OwnPtr<PreloadRequest> > PreloadRequestStream; |
85 | 89 |
86 class HTMLResourcePreloader FINAL : public NoBaseWillBeGarbageCollected<HTMLReso
urcePreloader> { | 90 class HTMLResourcePreloader FINAL : public NoBaseWillBeGarbageCollected<HTMLReso
urcePreloader> { |
87 WTF_MAKE_NONCOPYABLE(HTMLResourcePreloader); WTF_MAKE_FAST_ALLOCATED_WILL_BE
_REMOVED; | 91 WTF_MAKE_NONCOPYABLE(HTMLResourcePreloader); WTF_MAKE_FAST_ALLOCATED_WILL_BE
_REMOVED; |
88 public: | 92 public: |
89 static PassOwnPtrWillBeRawPtr<HTMLResourcePreloader> create(Document&); | 93 static PassOwnPtrWillBeRawPtr<HTMLResourcePreloader> create(Document&); |
90 void trace(Visitor*); | 94 void trace(Visitor*); |
91 | 95 |
92 void takeAndPreload(PreloadRequestStream&); | 96 void takeAndPreload(PreloadRequestStream&); |
93 void preload(PassOwnPtr<PreloadRequest>); | 97 void preload(PassOwnPtr<PreloadRequest>); |
94 | 98 |
95 private: | 99 private: |
96 explicit HTMLResourcePreloader(Document&); | 100 explicit HTMLResourcePreloader(Document&); |
97 | 101 |
98 RawPtrWillBeMember<Document> m_document; | 102 RawPtrWillBeMember<Document> m_document; |
99 }; | 103 }; |
100 | 104 |
101 } | 105 } |
102 | 106 |
103 #endif | 107 #endif |
OLD | NEW |