| OLD | NEW |
| 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 21 matching lines...) Expand all Loading... |
| 32 #include "platform/Histogram.h" | 32 #include "platform/Histogram.h" |
| 33 #include "public/platform/Platform.h" | 33 #include "public/platform/Platform.h" |
| 34 | 34 |
| 35 namespace blink { | 35 namespace blink { |
| 36 | 36 |
| 37 inline HTMLResourcePreloader::HTMLResourcePreloader(Document& document) | 37 inline HTMLResourcePreloader::HTMLResourcePreloader(Document& document) |
| 38 : m_document(document) | 38 : m_document(document) |
| 39 { | 39 { |
| 40 } | 40 } |
| 41 | 41 |
| 42 PassOwnPtrWillBeRawPtr<HTMLResourcePreloader> HTMLResourcePreloader::create(Docu
ment& document) | 42 RawPtr<HTMLResourcePreloader> HTMLResourcePreloader::create(Document& document) |
| 43 { | 43 { |
| 44 return adoptPtrWillBeNoop(new HTMLResourcePreloader(document)); | 44 return new HTMLResourcePreloader(document); |
| 45 } | 45 } |
| 46 | 46 |
| 47 DEFINE_TRACE(HTMLResourcePreloader) | 47 DEFINE_TRACE(HTMLResourcePreloader) |
| 48 { | 48 { |
| 49 visitor->trace(m_document); | 49 visitor->trace(m_document); |
| 50 } | 50 } |
| 51 | 51 |
| 52 static void preconnectHost(PreloadRequest* request, const NetworkHintsInterface&
networkHintsInterface) | 52 static void preconnectHost(PreloadRequest* request, const NetworkHintsInterface&
networkHintsInterface) |
| 53 { | 53 { |
| 54 ASSERT(request); | 54 ASSERT(request); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 76 if (preload->resourceType() == Resource::Script || preload->resourceType() =
= Resource::CSSStyleSheet || preload->resourceType() == Resource::ImportResource
) | 76 if (preload->resourceType() == Resource::Script || preload->resourceType() =
= Resource::CSSStyleSheet || preload->resourceType() == Resource::ImportResource
) |
| 77 request.setCharset(preload->charset().isEmpty() ? m_document->characterS
et().getString() : preload->charset()); | 77 request.setCharset(preload->charset().isEmpty() ? m_document->characterS
et().getString() : preload->charset()); |
| 78 request.setForPreload(true); | 78 request.setForPreload(true); |
| 79 int duration = static_cast<int>(1000 * (monotonicallyIncreasingTime() - prel
oad->discoveryTime())); | 79 int duration = static_cast<int>(1000 * (monotonicallyIncreasingTime() - prel
oad->discoveryTime())); |
| 80 DEFINE_STATIC_LOCAL(CustomCountHistogram, preloadDelayHistogram, ("WebCore.P
reloadDelayMs", 0, 2000, 20)); | 80 DEFINE_STATIC_LOCAL(CustomCountHistogram, preloadDelayHistogram, ("WebCore.P
reloadDelayMs", 0, 2000, 20)); |
| 81 preloadDelayHistogram.count(duration); | 81 preloadDelayHistogram.count(duration); |
| 82 m_document->loader()->startPreload(preload->resourceType(), request); | 82 m_document->loader()->startPreload(preload->resourceType(), request); |
| 83 } | 83 } |
| 84 | 84 |
| 85 } // namespace blink | 85 } // namespace blink |
| OLD | NEW |