| 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 bool isBeforeBody() const { return m_isBeforeBody; } |
| 50 void setIsBeforeBody(const bool isBeforeBody) { m_isBeforeBody = isBeforeBod
y; } |
| 51 bool execAsync() const { return m_execAsync; } |
| 52 void setExecAsync(const bool execAsync) { m_execAsync = execAsync; } |
| 49 void setCharset(const String& charset) { m_charset = charset.isolatedCopy();
} | 53 void setCharset(const String& charset) { m_charset = charset.isolatedCopy();
} |
| 50 void setCrossOriginEnabled(StoredCredentials allowCredentials) | 54 void setCrossOriginEnabled(StoredCredentials allowCredentials) |
| 51 { | 55 { |
| 52 m_isCORSEnabled = true; | 56 m_isCORSEnabled = true; |
| 53 m_allowCredentials = allowCredentials; | 57 m_allowCredentials = allowCredentials; |
| 54 } | 58 } |
| 55 | 59 |
| 56 Resource::Type resourceType() const { return m_resourceType; } | 60 Resource::Type resourceType() const { return m_resourceType; } |
| 57 | 61 |
| 58 private: | 62 private: |
| 59 PreloadRequest(const String& initiatorName, const TextPosition& initiatorPos
ition, const String& resourceURL, const KURL& baseURL, Resource::Type resourceTy
pe) | 63 PreloadRequest(const String& initiatorName, const TextPosition& initiatorPos
ition, const String& resourceURL, const KURL& baseURL, Resource::Type resourceTy
pe) |
| 60 : m_initiatorName(initiatorName) | 64 : m_initiatorName(initiatorName) |
| 61 , m_initiatorPosition(initiatorPosition) | 65 , m_initiatorPosition(initiatorPosition) |
| 62 , m_resourceURL(resourceURL.isolatedCopy()) | 66 , m_resourceURL(resourceURL.isolatedCopy()) |
| 63 , m_baseURL(baseURL.copy()) | 67 , m_baseURL(baseURL.copy()) |
| 64 , m_resourceType(resourceType) | 68 , m_resourceType(resourceType) |
| 65 , m_isCORSEnabled(false) | 69 , m_isCORSEnabled(false) |
| 66 , m_allowCredentials(DoNotAllowStoredCredentials) | 70 , m_allowCredentials(DoNotAllowStoredCredentials) |
| 67 , m_discoveryTime(monotonicallyIncreasingTime()) | 71 , m_discoveryTime(monotonicallyIncreasingTime()) |
| 72 , m_isBeforeBody(false) |
| 73 , m_execAsync(false) |
| 68 { | 74 { |
| 69 } | 75 } |
| 70 | 76 |
| 71 KURL completeURL(Document*); | 77 KURL completeURL(Document*); |
| 72 | 78 |
| 73 String m_initiatorName; | 79 String m_initiatorName; |
| 74 TextPosition m_initiatorPosition; | 80 TextPosition m_initiatorPosition; |
| 75 String m_resourceURL; | 81 String m_resourceURL; |
| 76 KURL m_baseURL; | 82 KURL m_baseURL; |
| 77 String m_charset; | 83 String m_charset; |
| 78 Resource::Type m_resourceType; | 84 Resource::Type m_resourceType; |
| 79 bool m_isCORSEnabled; | 85 bool m_isCORSEnabled; |
| 80 StoredCredentials m_allowCredentials; | 86 StoredCredentials m_allowCredentials; |
| 81 double m_discoveryTime; | 87 double m_discoveryTime; |
| 88 bool m_isBeforeBody; |
| 89 bool m_execAsync; |
| 82 }; | 90 }; |
| 83 | 91 |
| 84 typedef Vector<OwnPtr<PreloadRequest> > PreloadRequestStream; | 92 typedef Vector<OwnPtr<PreloadRequest> > PreloadRequestStream; |
| 85 | 93 |
| 86 class HTMLResourcePreloader FINAL : public NoBaseWillBeGarbageCollected<HTMLReso
urcePreloader> { | 94 class HTMLResourcePreloader FINAL : public NoBaseWillBeGarbageCollected<HTMLReso
urcePreloader> { |
| 87 WTF_MAKE_NONCOPYABLE(HTMLResourcePreloader); WTF_MAKE_FAST_ALLOCATED_WILL_BE
_REMOVED; | 95 WTF_MAKE_NONCOPYABLE(HTMLResourcePreloader); WTF_MAKE_FAST_ALLOCATED_WILL_BE
_REMOVED; |
| 88 public: | 96 public: |
| 89 static PassOwnPtrWillBeRawPtr<HTMLResourcePreloader> create(Document&); | 97 static PassOwnPtrWillBeRawPtr<HTMLResourcePreloader> create(Document&); |
| 90 void trace(Visitor*); | 98 void trace(Visitor*); |
| 91 | 99 |
| 92 void takeAndPreload(PreloadRequestStream&); | 100 void takeAndPreload(PreloadRequestStream&); |
| 93 void preload(PassOwnPtr<PreloadRequest>); | 101 void preload(PassOwnPtr<PreloadRequest>); |
| 94 | 102 |
| 95 private: | 103 private: |
| 96 explicit HTMLResourcePreloader(Document&); | 104 explicit HTMLResourcePreloader(Document&); |
| 97 | 105 |
| 98 RawPtrWillBeMember<Document> m_document; | 106 RawPtrWillBeMember<Document> m_document; |
| 99 }; | 107 }; |
| 100 | 108 |
| 101 } | 109 } |
| 102 | 110 |
| 103 #endif | 111 #endif |
| OLD | NEW |