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

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

Issue 2542183002: Don't remove CSSPreloaderResourceClient for unused speculative markup preloads (Closed)
Patch Set: yhirano review Created 4 years 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
« no previous file with comments | « third_party/WebKit/LayoutTests/TestExpectations ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 m_preloader->takeAndPreload(preloads); 313 m_preloader->takeAndPreload(preloads);
314 DEFINE_STATIC_LOCAL( 314 DEFINE_STATIC_LOCAL(
315 CustomCountHistogram, cssImportHistogram, 315 CustomCountHistogram, cssImportHistogram,
316 ("PreloadScanner.ExternalCSS.PreloadCount", 1, 100, 50)); 316 ("PreloadScanner.ExternalCSS.PreloadCount", 1, 100, 50));
317 cssImportHistogram.count(m_preloader->countPreloads() - 317 cssImportHistogram.count(m_preloader->countPreloads() -
318 currentPreloadCount); 318 currentPreloadCount);
319 } 319 }
320 } 320 }
321 321
322 void CSSPreloaderResourceClient::clearResource() { 322 void CSSPreloaderResourceClient::clearResource() {
323 // Do not remove the client for unused, speculative markup preloads. This will
324 // trigger cancellation of the request and potential removal from memory
325 // cache. Link preloads are an exception because they support dynamic removal
326 // cancelling the request (and have their own passive resource client).
327 // Note: Speculative preloads which remain unused for their lifetime will
328 // never have this client removed. This should be fine because we only hold
329 // weak references to the resource.
330 if (m_resource && m_resource->isUnusedPreload() &&
331 !m_resource->isLinkPreload()) {
332 return;
333 }
334
323 if (m_resource) 335 if (m_resource)
324 m_resource->removeClient(this); 336 m_resource->removeClient(this);
325 m_resource.clear(); 337 m_resource.clear();
326 } 338 }
327 339
328 DEFINE_TRACE(CSSPreloaderResourceClient) { 340 DEFINE_TRACE(CSSPreloaderResourceClient) {
329 visitor->trace(m_preloader); 341 visitor->trace(m_preloader);
330 visitor->trace(m_resource); 342 visitor->trace(m_resource);
331 StyleSheetResourceClient::trace(visitor); 343 StyleSheetResourceClient::trace(visitor);
332 } 344 }
333 345
334 } // namespace blink 346 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/TestExpectations ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698