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

Side by Side Diff: Source/core/html/parser/HTMLResourcePreloader.h

Issue 201813002: Enable Media query evaluation in the preload scanner (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix Debug crash. Values based MediaValues::create Created 6 years, 9 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) 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 17 matching lines...) Expand all
28 28
29 #include "core/fetch/FetchRequest.h" 29 #include "core/fetch/FetchRequest.h"
30 #include "core/fetch/Resource.h" 30 #include "core/fetch/Resource.h"
31 #include "wtf/CurrentTime.h" 31 #include "wtf/CurrentTime.h"
32 #include "wtf/text/TextPosition.h" 32 #include "wtf/text/TextPosition.h"
33 33
34 namespace WebCore { 34 namespace WebCore {
35 35
36 class PreloadRequest { 36 class PreloadRequest {
37 public: 37 public:
38 static PassOwnPtr<PreloadRequest> create(const String& initiatorName, const TextPosition& initiatorPosition, const String& resourceURL, const KURL& baseURL, Resource::Type resourceType, const String& mediaAttribute)
39 {
40 return adoptPtr(new PreloadRequest(initiatorName, initiatorPosition, res ourceURL, baseURL, resourceType, mediaAttribute));
41 }
42
43 static PassOwnPtr<PreloadRequest> create(const String& initiatorName, const TextPosition& initiatorPosition, const String& resourceURL, const KURL& baseURL, Resource::Type resourceType) 38 static PassOwnPtr<PreloadRequest> create(const String& initiatorName, const TextPosition& initiatorPosition, const String& resourceURL, const KURL& baseURL, Resource::Type resourceType)
44 { 39 {
45 return adoptPtr(new PreloadRequest(initiatorName, initiatorPosition, res ourceURL, baseURL, resourceType, "")); 40 return adoptPtr(new PreloadRequest(initiatorName, initiatorPosition, res ourceURL, baseURL, resourceType));
46 } 41 }
47 42
48 bool isSafeToSendToAnotherThread() const; 43 bool isSafeToSendToAnotherThread() const;
49 44
50 FetchRequest resourceRequest(Document*); 45 FetchRequest resourceRequest(Document*);
51 46
52 const String& charset() const { return m_charset; } 47 const String& charset() const { return m_charset; }
53 const String& media() const { return m_mediaAttribute; }
54 double discoveryTime() const { return m_discoveryTime; } 48 double discoveryTime() const { return m_discoveryTime; }
55 void setCharset(const String& charset) { m_charset = charset.isolatedCopy(); } 49 void setCharset(const String& charset) { m_charset = charset.isolatedCopy(); }
56 void setCrossOriginEnabled(StoredCredentials allowCredentials) 50 void setCrossOriginEnabled(StoredCredentials allowCredentials)
57 { 51 {
58 m_isCORSEnabled = true; 52 m_isCORSEnabled = true;
59 m_allowCredentials = allowCredentials; 53 m_allowCredentials = allowCredentials;
60 } 54 }
61 55
62 Resource::Type resourceType() const { return m_resourceType; } 56 Resource::Type resourceType() const { return m_resourceType; }
63 57
64 private: 58 private:
65 PreloadRequest(const String& initiatorName, const TextPosition& initiatorPos ition, const String& resourceURL, const KURL& baseURL, Resource::Type resourceTy pe, const String& mediaAttribute) 59 PreloadRequest(const String& initiatorName, const TextPosition& initiatorPos ition, const String& resourceURL, const KURL& baseURL, Resource::Type resourceTy pe)
66 : m_initiatorName(initiatorName) 60 : m_initiatorName(initiatorName)
67 , m_initiatorPosition(initiatorPosition) 61 , m_initiatorPosition(initiatorPosition)
68 , m_resourceURL(resourceURL.isolatedCopy()) 62 , m_resourceURL(resourceURL.isolatedCopy())
69 , m_baseURL(baseURL.copy()) 63 , m_baseURL(baseURL.copy())
70 , m_resourceType(resourceType) 64 , m_resourceType(resourceType)
71 , m_mediaAttribute(mediaAttribute.isolatedCopy())
72 , m_isCORSEnabled(false) 65 , m_isCORSEnabled(false)
73 , m_allowCredentials(DoNotAllowStoredCredentials) 66 , m_allowCredentials(DoNotAllowStoredCredentials)
74 , m_discoveryTime(monotonicallyIncreasingTime()) 67 , m_discoveryTime(monotonicallyIncreasingTime())
75 { 68 {
76 } 69 }
77 70
78 KURL completeURL(Document*); 71 KURL completeURL(Document*);
79 72
80 String m_initiatorName; 73 String m_initiatorName;
81 TextPosition m_initiatorPosition; 74 TextPosition m_initiatorPosition;
82 String m_resourceURL; 75 String m_resourceURL;
83 KURL m_baseURL; 76 KURL m_baseURL;
84 String m_charset; 77 String m_charset;
85 Resource::Type m_resourceType; 78 Resource::Type m_resourceType;
86 String m_mediaAttribute;
87 bool m_isCORSEnabled; 79 bool m_isCORSEnabled;
88 StoredCredentials m_allowCredentials; 80 StoredCredentials m_allowCredentials;
89 double m_discoveryTime; 81 double m_discoveryTime;
90 }; 82 };
91 83
92 typedef Vector<OwnPtr<PreloadRequest> > PreloadRequestStream; 84 typedef Vector<OwnPtr<PreloadRequest> > PreloadRequestStream;
93 85
94 class HTMLResourcePreloader { 86 class HTMLResourcePreloader {
95 WTF_MAKE_NONCOPYABLE(HTMLResourcePreloader); WTF_MAKE_FAST_ALLOCATED; 87 WTF_MAKE_NONCOPYABLE(HTMLResourcePreloader); WTF_MAKE_FAST_ALLOCATED;
96 public: 88 public:
97 explicit HTMLResourcePreloader(Document* document) 89 explicit HTMLResourcePreloader(Document* document)
98 : m_document(document) 90 : m_document(document)
99 { 91 {
100 } 92 }
101 93
102 void takeAndPreload(PreloadRequestStream&); 94 void takeAndPreload(PreloadRequestStream&);
103 void preload(PassOwnPtr<PreloadRequest>); 95 void preload(PassOwnPtr<PreloadRequest>);
104 96
105 private: 97 private:
106 Document* m_document; 98 Document* m_document;
107 }; 99 };
108 100
109 } 101 }
110 102
111 #endif 103 #endif
OLDNEW
« no previous file with comments | « Source/core/html/parser/HTMLPreloadScanner.cpp ('k') | Source/core/html/parser/HTMLResourcePreloader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698