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

Side by Side Diff: third_party/WebKit/Source/core/html/parser/CSSPreloadScanner.cpp

Issue 2381193004: Use sheetText() instead of decodedText() in the CSS preload scanner (Closed)
Patch Set: rebase 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) 2008, 2010 Apple Inc. All Rights Reserved. 2 * Copyright (C) 2008, 2010 Apple Inc. All Rights Reserved.
3 * Copyright (C) 2009 Torch Mobile, Inc. http://www.torchmobile.com/ 3 * Copyright (C) 2009 Torch Mobile, Inc. http://www.torchmobile.com/
4 * Copyright (C) 2010 Google Inc. All Rights Reserved. 4 * Copyright (C) 2010 Google Inc. All Rights Reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
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 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 283
284 void CSSPreloaderResourceClient::scanCSS( 284 void CSSPreloaderResourceClient::scanCSS(
285 const CSSStyleSheetResource* resource) { 285 const CSSStyleSheetResource* resource) {
286 DCHECK(m_preloader); 286 DCHECK(m_preloader);
287 // Passing an empty SegmentedString here results in PreloadRequest with no 287 // Passing an empty SegmentedString here results in PreloadRequest with no
288 // file/line information. 288 // file/line information.
289 // TODO(csharrison): If this becomes an issue the CSSPreloadScanner may be 289 // TODO(csharrison): If this becomes an issue the CSSPreloadScanner may be
290 // augmented to take care of this case without performing an additional 290 // augmented to take care of this case without performing an additional
291 // copy. 291 // copy.
292 double startTime = monotonicallyIncreasingTimeMS(); 292 double startTime = monotonicallyIncreasingTimeMS();
293 const String& chunk = resource->decodedText(); 293 const String& chunk = resource->sheetText();
294 if (chunk.isNull()) 294 if (chunk.isNull())
295 return; 295 return;
296 CSSPreloadScanner cssPreloadScanner; 296 CSSPreloadScanner cssPreloadScanner;
297 PreloadRequestStream preloads; 297 PreloadRequestStream preloads;
298 cssPreloadScanner.scan(chunk, SegmentedString(), preloads, 298 cssPreloadScanner.scan(chunk, SegmentedString(), preloads,
299 resource->response().url()); 299 resource->response().url());
300 DEFINE_STATIC_LOCAL(CustomCountHistogram, cssScanTimeHistogram, 300 DEFINE_STATIC_LOCAL(CustomCountHistogram, cssScanTimeHistogram,
301 ("PreloadScanner.ExternalCSS.ScanTime", 1, 1000000, 50)); 301 ("PreloadScanner.ExternalCSS.ScanTime", 1, 1000000, 50));
302 cssScanTimeHistogram.count((monotonicallyIncreasingTimeMS() - startTime) * 302 cssScanTimeHistogram.count((monotonicallyIncreasingTimeMS() - startTime) *
303 1000); 303 1000);
(...skipping 16 matching lines...) Expand all
320 currentPreloadCount); 320 currentPreloadCount);
321 } 321 }
322 } 322 }
323 323
324 DEFINE_TRACE(CSSPreloaderResourceClient) { 324 DEFINE_TRACE(CSSPreloaderResourceClient) {
325 visitor->trace(m_preloader); 325 visitor->trace(m_preloader);
326 ResourceOwner<CSSStyleSheetResource>::trace(visitor); 326 ResourceOwner<CSSStyleSheetResource>::trace(visitor);
327 } 327 }
328 328
329 } // namespace blink 329 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698