| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
| 4 * (C) 2000 Simon Hausmann <hausmann@kde.org> | 4 * (C) 2000 Simon Hausmann <hausmann@kde.org> |
| 5 * Copyright (C) 2003, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv
ed. | 5 * Copyright (C) 2003, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv
ed. |
| 6 * (C) 2006 Graham Dennis (graham.dennis@gmail.com) | 6 * (C) 2006 Graham Dennis (graham.dennis@gmail.com) |
| 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 25 matching lines...) Expand all Loading... |
| 36 #include "core/html/parser/HTMLParserIdioms.h" | 36 #include "core/html/parser/HTMLParserIdioms.h" |
| 37 #include "core/loader/FrameLoadRequest.h" | 37 #include "core/loader/FrameLoadRequest.h" |
| 38 #include "core/loader/FrameLoader.h" | 38 #include "core/loader/FrameLoader.h" |
| 39 #include "core/loader/FrameLoaderClient.h" | 39 #include "core/loader/FrameLoaderClient.h" |
| 40 #include "core/loader/FrameLoaderTypes.h" | 40 #include "core/loader/FrameLoaderTypes.h" |
| 41 #include "core/loader/PingLoader.h" | 41 #include "core/loader/PingLoader.h" |
| 42 #include "core/page/Chrome.h" | 42 #include "core/page/Chrome.h" |
| 43 #include "core/page/ChromeClient.h" | 43 #include "core/page/ChromeClient.h" |
| 44 #include "core/page/Page.h" | 44 #include "core/page/Page.h" |
| 45 #include "core/page/Settings.h" | 45 #include "core/page/Settings.h" |
| 46 #include "core/platform/HistogramSupport.h" | |
| 47 #include "core/rendering/RenderImage.h" | 46 #include "core/rendering/RenderImage.h" |
| 48 #include "core/svg/graphics/SVGImage.h" | 47 #include "core/svg/graphics/SVGImage.h" |
| 49 #include "platform/PlatformMouseEvent.h" | 48 #include "platform/PlatformMouseEvent.h" |
| 50 #include "platform/network/DNS.h" | 49 #include "platform/network/DNS.h" |
| 51 #include "platform/network/ResourceRequest.h" | 50 #include "platform/network/ResourceRequest.h" |
| 52 #include "public/platform/Platform.h" | 51 #include "public/platform/Platform.h" |
| 53 #include "public/platform/WebPrescientNetworking.h" | 52 #include "public/platform/WebPrescientNetworking.h" |
| 54 #include "public/platform/WebURL.h" | 53 #include "public/platform/WebURL.h" |
| 55 #include "weborigin/KnownPorts.h" | 54 #include "weborigin/KnownPorts.h" |
| 56 #include "weborigin/SecurityOrigin.h" | 55 #include "weborigin/SecurityOrigin.h" |
| (...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 580 handleGestureTapUnconfirmed(event); | 579 handleGestureTapUnconfirmed(event); |
| 581 else if (isLinkClick(event)) | 580 else if (isLinkClick(event)) |
| 582 handleClick(event); | 581 handleClick(event); |
| 583 } | 582 } |
| 584 | 583 |
| 585 void HTMLAnchorElement::PrefetchEventHandler::handleMouseOver(Event* event) | 584 void HTMLAnchorElement::PrefetchEventHandler::handleMouseOver(Event* event) |
| 586 { | 585 { |
| 587 if (m_mouseOverTimestamp == 0.0) { | 586 if (m_mouseOverTimestamp == 0.0) { |
| 588 m_mouseOverTimestamp = event->timeStamp(); | 587 m_mouseOverTimestamp = event->timeStamp(); |
| 589 | 588 |
| 590 HistogramSupport::histogramEnumeration("MouseEventPrefetch.MouseOvers",
0, 2); | 589 WebKit::Platform::current()->histogramEnumeration("MouseEventPrefetch.Mo
useOvers", 0, 2); |
| 591 | 590 |
| 592 prefetch(WebKit::WebPreconnectMotivationLinkMouseOver); | 591 prefetch(WebKit::WebPreconnectMotivationLinkMouseOver); |
| 593 } | 592 } |
| 594 } | 593 } |
| 595 | 594 |
| 596 void HTMLAnchorElement::PrefetchEventHandler::handleMouseOut(Event* event) | 595 void HTMLAnchorElement::PrefetchEventHandler::handleMouseOut(Event* event) |
| 597 { | 596 { |
| 598 if (m_mouseOverTimestamp > 0.0) { | 597 if (m_mouseOverTimestamp > 0.0) { |
| 599 double mouseOverDuration = convertDOMTimeStampToSeconds(event->timeStamp
() - m_mouseOverTimestamp); | 598 double mouseOverDuration = convertDOMTimeStampToSeconds(event->timeStamp
() - m_mouseOverTimestamp); |
| 600 HistogramSupport::histogramCustomCounts("MouseEventPrefetch.MouseOverDur
ation_NoClick", mouseOverDuration * 1000, 0, 10000, 100); | 599 WebKit::Platform::current()->histogramCustomCounts("MouseEventPrefetch.M
ouseOverDuration_NoClick", mouseOverDuration * 1000, 0, 10000, 100); |
| 601 | 600 |
| 602 m_mouseOverTimestamp = 0.0; | 601 m_mouseOverTimestamp = 0.0; |
| 603 } | 602 } |
| 604 } | 603 } |
| 605 | 604 |
| 606 void HTMLAnchorElement::PrefetchEventHandler::handleLeftMouseDown(Event* event) | 605 void HTMLAnchorElement::PrefetchEventHandler::handleLeftMouseDown(Event* event) |
| 607 { | 606 { |
| 608 m_mouseDownTimestamp = event->timeStamp(); | 607 m_mouseDownTimestamp = event->timeStamp(); |
| 609 | 608 |
| 610 HistogramSupport::histogramEnumeration("MouseEventPrefetch.MouseDowns", 0, 2
); | 609 WebKit::Platform::current()->histogramEnumeration("MouseEventPrefetch.MouseD
owns", 0, 2); |
| 611 | 610 |
| 612 prefetch(WebKit::WebPreconnectMotivationLinkMouseDown); | 611 prefetch(WebKit::WebPreconnectMotivationLinkMouseDown); |
| 613 } | 612 } |
| 614 | 613 |
| 615 void HTMLAnchorElement::PrefetchEventHandler::handleGestureTapUnconfirmed(Event*
event) | 614 void HTMLAnchorElement::PrefetchEventHandler::handleGestureTapUnconfirmed(Event*
event) |
| 616 { | 615 { |
| 617 m_hadTapUnconfirmed = true; | 616 m_hadTapUnconfirmed = true; |
| 618 | 617 |
| 619 HistogramSupport::histogramEnumeration("MouseEventPrefetch.TapUnconfirmeds",
0, 2); | 618 WebKit::Platform::current()->histogramEnumeration("MouseEventPrefetch.TapUnc
onfirmeds", 0, 2); |
| 620 | 619 |
| 621 prefetch(WebKit::WebPreconnectMotivationLinkTapUnconfirmed); | 620 prefetch(WebKit::WebPreconnectMotivationLinkTapUnconfirmed); |
| 622 } | 621 } |
| 623 | 622 |
| 624 void HTMLAnchorElement::PrefetchEventHandler::handleGestureShowPress(Event* even
t) | 623 void HTMLAnchorElement::PrefetchEventHandler::handleGestureShowPress(Event* even
t) |
| 625 { | 624 { |
| 626 m_tapDownTimestamp = event->timeStamp(); | 625 m_tapDownTimestamp = event->timeStamp(); |
| 627 | 626 |
| 628 HistogramSupport::histogramEnumeration("MouseEventPrefetch.TapDowns", 0, 2); | 627 WebKit::Platform::current()->histogramEnumeration("MouseEventPrefetch.TapDow
ns", 0, 2); |
| 629 | 628 |
| 630 prefetch(WebKit::WebPreconnectMotivationLinkTapDown); | 629 prefetch(WebKit::WebPreconnectMotivationLinkTapDown); |
| 631 } | 630 } |
| 632 | 631 |
| 633 void HTMLAnchorElement::PrefetchEventHandler::handleClick(Event* event) | 632 void HTMLAnchorElement::PrefetchEventHandler::handleClick(Event* event) |
| 634 { | 633 { |
| 635 bool capturedMouseOver = (m_mouseOverTimestamp > 0.0); | 634 bool capturedMouseOver = (m_mouseOverTimestamp > 0.0); |
| 636 if (capturedMouseOver) { | 635 if (capturedMouseOver) { |
| 637 double mouseOverDuration = convertDOMTimeStampToSeconds(event->timeStamp
() - m_mouseOverTimestamp); | 636 double mouseOverDuration = convertDOMTimeStampToSeconds(event->timeStamp
() - m_mouseOverTimestamp); |
| 638 | 637 |
| 639 HistogramSupport::histogramCustomCounts("MouseEventPrefetch.MouseOverDur
ation_Click", mouseOverDuration * 1000, 0, 10000, 100); | 638 WebKit::Platform::current()->histogramCustomCounts("MouseEventPrefetch.M
ouseOverDuration_Click", mouseOverDuration * 1000, 0, 10000, 100); |
| 640 } | 639 } |
| 641 | 640 |
| 642 bool capturedMouseDown = (m_mouseDownTimestamp > 0.0); | 641 bool capturedMouseDown = (m_mouseDownTimestamp > 0.0); |
| 643 HistogramSupport::histogramEnumeration("MouseEventPrefetch.MouseDownFollowed
ByClick", capturedMouseDown, 2); | 642 WebKit::Platform::current()->histogramEnumeration("MouseEventPrefetch.MouseD
ownFollowedByClick", capturedMouseDown, 2); |
| 644 | 643 |
| 645 if (capturedMouseDown) { | 644 if (capturedMouseDown) { |
| 646 double mouseDownDuration = convertDOMTimeStampToSeconds(event->timeStamp
() - m_mouseDownTimestamp); | 645 double mouseDownDuration = convertDOMTimeStampToSeconds(event->timeStamp
() - m_mouseDownTimestamp); |
| 647 | 646 |
| 648 HistogramSupport::histogramCustomCounts("MouseEventPrefetch.MouseDownDur
ation_Click", mouseDownDuration * 1000, 0, 10000, 100); | 647 WebKit::Platform::current()->histogramCustomCounts("MouseEventPrefetch.M
ouseDownDuration_Click", mouseDownDuration * 1000, 0, 10000, 100); |
| 649 } | 648 } |
| 650 | 649 |
| 651 bool capturedTapDown = (m_tapDownTimestamp > 0.0); | 650 bool capturedTapDown = (m_tapDownTimestamp > 0.0); |
| 652 if (capturedTapDown) { | 651 if (capturedTapDown) { |
| 653 double tapDownDuration = convertDOMTimeStampToSeconds(event->timeStamp()
- m_tapDownTimestamp); | 652 double tapDownDuration = convertDOMTimeStampToSeconds(event->timeStamp()
- m_tapDownTimestamp); |
| 654 | 653 |
| 655 HistogramSupport::histogramCustomCounts("MouseEventPrefetch.TapDownDurat
ion_Click", tapDownDuration * 1000, 0, 10000, 100); | 654 WebKit::Platform::current()->histogramCustomCounts("MouseEventPrefetch.T
apDownDuration_Click", tapDownDuration * 1000, 0, 10000, 100); |
| 656 } | 655 } |
| 657 | 656 |
| 658 int flags = (m_hadTapUnconfirmed ? 2 : 0) | (capturedTapDown ? 1 : 0); | 657 int flags = (m_hadTapUnconfirmed ? 2 : 0) | (capturedTapDown ? 1 : 0); |
| 659 HistogramSupport::histogramEnumeration("MouseEventPrefetch.PreTapEventsFollo
wedByClick", flags, 4); | 658 WebKit::Platform::current()->histogramEnumeration("MouseEventPrefetch.PreTap
EventsFollowedByClick", flags, 4); |
| 660 } | 659 } |
| 661 | 660 |
| 662 bool HTMLAnchorElement::PrefetchEventHandler::shouldPrefetch(const KURL& url) | 661 bool HTMLAnchorElement::PrefetchEventHandler::shouldPrefetch(const KURL& url) |
| 663 { | 662 { |
| 664 if (m_hadHREFChanged) | 663 if (m_hadHREFChanged) |
| 665 return false; | 664 return false; |
| 666 | 665 |
| 667 if (m_anchorElement->hasEventListeners(EventTypeNames::click)) | 666 if (m_anchorElement->hasEventListeners(EventTypeNames::click)) |
| 668 return false; | 667 return false; |
| 669 | 668 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 703 preconnectToURL(url, motivation); | 702 preconnectToURL(url, motivation); |
| 704 m_hasIssuedPreconnect = true; | 703 m_hasIssuedPreconnect = true; |
| 705 } | 704 } |
| 706 | 705 |
| 707 bool HTMLAnchorElement::isInteractiveContent() const | 706 bool HTMLAnchorElement::isInteractiveContent() const |
| 708 { | 707 { |
| 709 return true; | 708 return true; |
| 710 } | 709 } |
| 711 | 710 |
| 712 } | 711 } |
| OLD | NEW |