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

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

Issue 18328028: Enable MQ evaluation off the main thread (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@threaded_mqe_rebase
Patch Set: Created 7 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) 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 16 matching lines...) Expand all
27 #define HTMLResourcePreloader_h 27 #define HTMLResourcePreloader_h
28 28
29 #include "core/loader/cache/CachedResource.h" 29 #include "core/loader/cache/CachedResource.h"
30 #include "core/loader/cache/CachedResourceRequest.h" 30 #include "core/loader/cache/CachedResourceRequest.h"
31 #include "wtf/text/TextPosition.h" 31 #include "wtf/text/TextPosition.h"
32 32
33 namespace WebCore { 33 namespace WebCore {
34 34
35 class PreloadRequest { 35 class PreloadRequest {
36 public: 36 public:
37 static PassOwnPtr<PreloadRequest> create(const String& initiatorName, const TextPosition& initiatorPosition, const String& resourceURL, const KURL& baseURL, CachedResource::Type resourceType, const String& mediaAttribute)
38 {
39 return adoptPtr(new PreloadRequest(initiatorName, initiatorPosition, res ourceURL, baseURL, resourceType, mediaAttribute));
40 }
41 37
42 static PassOwnPtr<PreloadRequest> create(const String& initiatorName, const TextPosition& initiatorPosition, const String& resourceURL, const KURL& baseURL, CachedResource::Type resourceType) 38 static PassOwnPtr<PreloadRequest> create(const String& initiatorName, const TextPosition& initiatorPosition, const String& resourceURL, const KURL& baseURL, CachedResource::Type resourceType)
43 { 39 {
44 return adoptPtr(new PreloadRequest(initiatorName, initiatorPosition, res ourceURL, baseURL, resourceType, "")); 40 return adoptPtr(new PreloadRequest(initiatorName, initiatorPosition, res ourceURL, baseURL, resourceType));
45 } 41 }
46 42
47 bool isSafeToSendToAnotherThread() const; 43 bool isSafeToSendToAnotherThread() const;
48 44
49 CachedResourceRequest resourceRequest(Document*); 45 CachedResourceRequest resourceRequest(Document*);
50 46
51 const String& charset() const { return m_charset; } 47 const String& charset() const { return m_charset; }
52 const String& media() const { return m_mediaAttribute; }
53 void setCharset(const String& charset) { m_charset = charset.isolatedCopy(); } 48 void setCharset(const String& charset) { m_charset = charset.isolatedCopy(); }
54 void setCrossOriginModeAllowsCookies(bool allowsCookies) { m_crossOriginMode AllowsCookies = allowsCookies; } 49 void setCrossOriginModeAllowsCookies(bool allowsCookies) { m_crossOriginMode AllowsCookies = allowsCookies; }
55 CachedResource::Type resourceType() const { return m_resourceType; } 50 CachedResource::Type resourceType() const { return m_resourceType; }
56 51
57 private: 52 private:
58 PreloadRequest(const String& initiatorName, const TextPosition& initiatorPos ition, const String& resourceURL, const KURL& baseURL, CachedResource::Type reso urceType, const String& mediaAttribute) 53 PreloadRequest(const String& initiatorName, const TextPosition& initiatorPos ition, const String& resourceURL, const KURL& baseURL, CachedResource::Type reso urceType)
59 : m_initiatorName(initiatorName.isolatedCopy()) 54 : m_initiatorName(initiatorName.isolatedCopy())
60 , m_initiatorPosition(initiatorPosition) 55 , m_initiatorPosition(initiatorPosition)
61 , m_resourceURL(resourceURL.isolatedCopy()) 56 , m_resourceURL(resourceURL.isolatedCopy())
62 , m_baseURL(baseURL.copy()) 57 , m_baseURL(baseURL.copy())
63 , m_resourceType(resourceType) 58 , m_resourceType(resourceType)
64 , m_mediaAttribute(mediaAttribute.isolatedCopy())
65 , m_crossOriginModeAllowsCookies(false) 59 , m_crossOriginModeAllowsCookies(false)
66 { 60 {
67 } 61 }
68 62
69 KURL completeURL(Document*); 63 KURL completeURL(Document*);
70 64
71 String m_initiatorName; 65 String m_initiatorName;
72 TextPosition m_initiatorPosition; 66 TextPosition m_initiatorPosition;
73 String m_resourceURL; 67 String m_resourceURL;
74 KURL m_baseURL; 68 KURL m_baseURL;
75 String m_charset; 69 String m_charset;
76 CachedResource::Type m_resourceType; 70 CachedResource::Type m_resourceType;
77 String m_mediaAttribute;
78 bool m_crossOriginModeAllowsCookies; 71 bool m_crossOriginModeAllowsCookies;
79 }; 72 };
80 73
81 typedef Vector<OwnPtr<PreloadRequest> > PreloadRequestStream; 74 typedef Vector<OwnPtr<PreloadRequest> > PreloadRequestStream;
82 75
83 class HTMLResourcePreloader { 76 class HTMLResourcePreloader {
84 WTF_MAKE_NONCOPYABLE(HTMLResourcePreloader); WTF_MAKE_FAST_ALLOCATED; 77 WTF_MAKE_NONCOPYABLE(HTMLResourcePreloader); WTF_MAKE_FAST_ALLOCATED;
85 public: 78 public:
86 explicit HTMLResourcePreloader(Document* document) 79 explicit HTMLResourcePreloader(Document* document)
87 : m_document(document) 80 : m_document(document)
88 , m_weakFactory(this) 81 , m_weakFactory(this)
89 { 82 {
90 } 83 }
91 84
92 void takeAndPreload(PreloadRequestStream&); 85 void takeAndPreload(PreloadRequestStream&);
93 void preload(PassOwnPtr<PreloadRequest>); 86 void preload(PassOwnPtr<PreloadRequest>);
94 87
95 WeakPtr<HTMLResourcePreloader> createWeakPtr() { return m_weakFactory.create WeakPtr(); } 88 WeakPtr<HTMLResourcePreloader> createWeakPtr() { return m_weakFactory.create WeakPtr(); }
96 89
97 private: 90 private:
98 Document* m_document; 91 Document* m_document;
99 WeakPtrFactory<HTMLResourcePreloader> m_weakFactory; 92 WeakPtrFactory<HTMLResourcePreloader> m_weakFactory;
100 }; 93 };
101 94
102 } 95 }
103 96
104 #endif 97 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698