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

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

Issue 1686483002: Oilpan: Remove most WillBe types from the code base (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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) 1998 Lars Knoll (knoll@mpi-hd.mpg.de) 2 Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de)
3 Copyright (C) 2001 Dirk Mueller (mueller@kde.org) 3 Copyright (C) 2001 Dirk Mueller (mueller@kde.org)
4 Copyright (C) 2002 Waldo Bastian (bastian@kde.org) 4 Copyright (C) 2002 Waldo Bastian (bastian@kde.org)
5 Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) 5 Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
6 Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. 6 Copyright (C) 2004, 2005, 2006 Apple Computer, Inc.
7 7
8 This library is free software; you can redistribute it and/or 8 This library is free software; you can redistribute it and/or
9 modify it under the terms of the GNU Library General Public 9 modify it under the terms of the GNU Library General Public
10 License as published by the Free Software Foundation; either 10 License as published by the Free Software Foundation; either
(...skipping 19 matching lines...) Expand all
30 #include "core/fetch/FetchRequest.h" 30 #include "core/fetch/FetchRequest.h"
31 #include "core/fetch/MemoryCache.h" 31 #include "core/fetch/MemoryCache.h"
32 #include "core/fetch/ResourceClientOrObserverWalker.h" 32 #include "core/fetch/ResourceClientOrObserverWalker.h"
33 #include "core/fetch/ResourceFetcher.h" 33 #include "core/fetch/ResourceFetcher.h"
34 #include "core/fetch/StyleSheetResourceClient.h" 34 #include "core/fetch/StyleSheetResourceClient.h"
35 #include "platform/SharedBuffer.h" 35 #include "platform/SharedBuffer.h"
36 #include "wtf/CurrentTime.h" 36 #include "wtf/CurrentTime.h"
37 37
38 namespace blink { 38 namespace blink {
39 39
40 PassRefPtrWillBeRawPtr<CSSStyleSheetResource> CSSStyleSheetResource::fetch(Fetch Request& request, ResourceFetcher* fetcher) 40 RawPtr<CSSStyleSheetResource> CSSStyleSheetResource::fetch(FetchRequest& request , ResourceFetcher* fetcher)
41 { 41 {
42 ASSERT(request.resourceRequest().frameType() == WebURLRequest::FrameTypeNone ); 42 ASSERT(request.resourceRequest().frameType() == WebURLRequest::FrameTypeNone );
43 request.mutableResourceRequest().setRequestContext(WebURLRequest::RequestCon textStyle); 43 request.mutableResourceRequest().setRequestContext(WebURLRequest::RequestCon textStyle);
44 return toCSSStyleSheetResource(fetcher->requestResource(request, CSSStyleShe etResourceFactory())); 44 return toCSSStyleSheetResource(fetcher->requestResource(request, CSSStyleShe etResourceFactory()));
45 } 45 }
46 46
47 PassRefPtrWillBeRawPtr<CSSStyleSheetResource> CSSStyleSheetResource::createForTe st(const ResourceRequest& request, const String& charset) 47 RawPtr<CSSStyleSheetResource> CSSStyleSheetResource::createForTest(const Resourc eRequest& request, const String& charset)
48 { 48 {
49 return adoptRefWillBeNoop(new CSSStyleSheetResource(request, ResourceLoaderO ptions(), charset)); 49 return new CSSStyleSheetResource(request, ResourceLoaderOptions(), charset);
50 } 50 }
51 51
52 CSSStyleSheetResource::CSSStyleSheetResource(const ResourceRequest& resourceRequ est, const ResourceLoaderOptions& options, const String& charset) 52 CSSStyleSheetResource::CSSStyleSheetResource(const ResourceRequest& resourceRequ est, const ResourceLoaderOptions& options, const String& charset)
53 : StyleSheetResource(resourceRequest, CSSStyleSheet, options, "text/css", ch arset) 53 : StyleSheetResource(resourceRequest, CSSStyleSheet, options, "text/css", ch arset)
54 { 54 {
55 DEFINE_STATIC_LOCAL(const AtomicString, acceptCSS, ("text/css,*/*;q=0.1", At omicString::ConstructFromLiteral)); 55 DEFINE_STATIC_LOCAL(const AtomicString, acceptCSS, ("text/css,*/*;q=0.1", At omicString::ConstructFromLiteral));
56 56
57 // Prefer text/css but accept any type (dell.com serves a stylesheet 57 // Prefer text/css but accept any type (dell.com serves a stylesheet
58 // as text/html; see <http://bugs.webkit.org/show_bug.cgi?id=11451>). 58 // as text/html; see <http://bugs.webkit.org/show_bug.cgi?id=11451>).
59 setAccept(acceptCSS); 59 setAccept(acceptCSS);
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 // This implementation should be observationally equivalent. 143 // This implementation should be observationally equivalent.
144 // 144 //
145 // This code defaults to allowing the stylesheet for non-HTTP protocols so 145 // This code defaults to allowing the stylesheet for non-HTTP protocols so
146 // folks can use standards mode for local HTML documents. 146 // folks can use standards mode for local HTML documents.
147 if (mimeTypeCheck == MIMETypeCheck::Lax) 147 if (mimeTypeCheck == MIMETypeCheck::Lax)
148 return true; 148 return true;
149 AtomicString contentType = httpContentType(); 149 AtomicString contentType = httpContentType();
150 return contentType.isEmpty() || equalIgnoringCase(contentType, "text/css") | | equalIgnoringCase(contentType, "application/x-unknown-content-type"); 150 return contentType.isEmpty() || equalIgnoringCase(contentType, "text/css") | | equalIgnoringCase(contentType, "application/x-unknown-content-type");
151 } 151 }
152 152
153 PassRefPtrWillBeRawPtr<StyleSheetContents> CSSStyleSheetResource::restoreParsedS tyleSheet(const CSSParserContext& context) 153 RawPtr<StyleSheetContents> CSSStyleSheetResource::restoreParsedStyleSheet(const CSSParserContext& context)
154 { 154 {
155 if (!m_parsedStyleSheetCache) 155 if (!m_parsedStyleSheetCache)
156 return nullptr; 156 return nullptr;
157 if (m_parsedStyleSheetCache->hasFailedOrCanceledSubresources()) { 157 if (m_parsedStyleSheetCache->hasFailedOrCanceledSubresources()) {
158 m_parsedStyleSheetCache->removedFromMemoryCache(); 158 m_parsedStyleSheetCache->removedFromMemoryCache();
159 m_parsedStyleSheetCache.clear(); 159 m_parsedStyleSheetCache.clear();
160 return nullptr; 160 return nullptr;
161 } 161 }
162 162
163 ASSERT(m_parsedStyleSheetCache->isCacheable()); 163 ASSERT(m_parsedStyleSheetCache->isCacheable());
164 ASSERT(m_parsedStyleSheetCache->isInMemoryCache()); 164 ASSERT(m_parsedStyleSheetCache->isInMemoryCache());
165 165
166 // Contexts must be identical so we know we would get the same exact result if we parsed again. 166 // Contexts must be identical so we know we would get the same exact result if we parsed again.
167 if (m_parsedStyleSheetCache->parserContext() != context) 167 if (m_parsedStyleSheetCache->parserContext() != context)
168 return nullptr; 168 return nullptr;
169 169
170 didAccessDecodedData(); 170 didAccessDecodedData();
171 171
172 return m_parsedStyleSheetCache; 172 return m_parsedStyleSheetCache;
173 } 173 }
174 174
175 void CSSStyleSheetResource::saveParsedStyleSheet(PassRefPtrWillBeRawPtr<StyleShe etContents> sheet) 175 void CSSStyleSheetResource::saveParsedStyleSheet(RawPtr<StyleSheetContents> shee t)
176 { 176 {
177 ASSERT(sheet && sheet->isCacheable()); 177 ASSERT(sheet && sheet->isCacheable());
178 178
179 if (m_parsedStyleSheetCache) 179 if (m_parsedStyleSheetCache)
180 m_parsedStyleSheetCache->removedFromMemoryCache(); 180 m_parsedStyleSheetCache->removedFromMemoryCache();
181 m_parsedStyleSheetCache = sheet; 181 m_parsedStyleSheetCache = sheet;
182 182
183 setDecodedSize(m_parsedStyleSheetCache->estimatedSizeInBytes()); 183 setDecodedSize(m_parsedStyleSheetCache->estimatedSizeInBytes());
184 184
185 // Check if this stylesheet resource didn't conflict with 185 // Check if this stylesheet resource didn't conflict with
186 // another resource and has indeed been added to the cache. 186 // another resource and has indeed been added to the cache.
187 if (memoryCache()->contains(this)) 187 if (memoryCache()->contains(this))
188 m_parsedStyleSheetCache->addedToMemoryCache(); 188 m_parsedStyleSheetCache->addedToMemoryCache();
189 } 189 }
190 190
191 } // namespace blink 191 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698