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

Side by Side Diff: third_party/WebKit/Source/core/loader/DocumentLoader.cpp

Issue 2423683002: Add Blink support for showing image placeholders using range requests. (Closed)
Patch Set: Addressed comments and fixed bugs Created 4 years, 2 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) 2006, 2007, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
3 * Copyright (C) 2011 Google Inc. All rights reserved. 3 * Copyright (C) 2011 Google Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 void DocumentLoader::setSubresourceFilter( 156 void DocumentLoader::setSubresourceFilter(
157 std::unique_ptr<WebDocumentSubresourceFilter> subresourceFilter) { 157 std::unique_ptr<WebDocumentSubresourceFilter> subresourceFilter) {
158 m_subresourceFilter = std::move(subresourceFilter); 158 m_subresourceFilter = std::move(subresourceFilter);
159 } 159 }
160 160
161 Resource* DocumentLoader::startPreload(Resource::Type type, 161 Resource* DocumentLoader::startPreload(Resource::Type type,
162 FetchRequest& request) { 162 FetchRequest& request) {
163 Resource* resource = nullptr; 163 Resource* resource = nullptr;
164 switch (type) { 164 switch (type) {
165 case Resource::Image: 165 case Resource::Image:
166 request.setPlaceholderImageRequestType(
167 m_frame && m_frame->settings() &&
168 m_frame->settings()->fetchImagePlaceholders()
169 ? FetchRequest::AllowPlaceholder
170 : FetchRequest::DisallowPlaceholder);
171
166 resource = ImageResource::fetch(request, fetcher()); 172 resource = ImageResource::fetch(request, fetcher());
167 break; 173 break;
168 case Resource::Script: 174 case Resource::Script:
169 resource = ScriptResource::fetch(request, fetcher()); 175 resource = ScriptResource::fetch(request, fetcher());
170 break; 176 break;
171 case Resource::CSSStyleSheet: 177 case Resource::CSSStyleSheet:
172 resource = CSSStyleSheetResource::fetch(request, fetcher()); 178 resource = CSSStyleSheetResource::fetch(request, fetcher());
173 break; 179 break;
174 case Resource::Font: 180 case Resource::Font:
175 resource = FontResource::fetch(request, fetcher()); 181 resource = FontResource::fetch(request, fetcher());
(...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after
761 m_writer ? m_writer->encoding() : emptyAtom, true, 767 m_writer ? m_writer->encoding() : emptyAtom, true,
762 ForceSynchronousParsing); 768 ForceSynchronousParsing);
763 if (!source.isNull()) 769 if (!source.isNull())
764 m_writer->appendReplacingData(source); 770 m_writer->appendReplacingData(source);
765 endWriting(m_writer.get()); 771 endWriting(m_writer.get());
766 } 772 }
767 773
768 DEFINE_WEAK_IDENTIFIER_MAP(DocumentLoader); 774 DEFINE_WEAK_IDENTIFIER_MAP(DocumentLoader);
769 775
770 } // namespace blink 776 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698