Page Speed Optimization Libraries
1.8.31.3
|
#include "beacon_critical_line_info_finder.h"
Public Member Functions | |
BeaconCriticalLineInfoFinder (const PropertyCache::Cohort *cohort, NonceGenerator *nonce_generator) | |
virtual BeaconMetadata | PrepareForBeaconInsertion (RewriteDriver *driver) |
Static Public Member Functions | |
static void | WriteXPathsToPropertyCacheFromBeacon (const StringSet &xpaths_set, StringPiece nonce, const PropertyCache *cache, const PropertyCache::Cohort *cohort, AbstractPropertyPage *page, MessageHandler *message_handler, Timer *timer) |
Static Public Attributes | |
static const char | kBeaconCriticalLineInfoPropertyName [] |
Protected Member Functions | |
virtual void | UpdateInDriver (RewriteDriver *driver) |
Updates the critical line information in the driver. |
This class provides beacon support in mod_pagespeed for the xpaths used by split_html. It does this by using the CriticalKey infrastructure also used by critical images and critical CSS selectors to populate the critical_line_info member in RewriteDriver and used by the base implementation.
TODO(jud): Currently, this implementation just looks at the support value for an individual node to decide if it is below-the-fold or not. It should also combine the support values of a node's parent elements to decide if it's critical. The impact of missing this feature is that some nodes on or near the fold may not be properly considered at BTF, depending on the layout of the page. For example, consider if there is div[1] with a child node div[1]/span[a]. These nodes are close to the fold - clients with a larger screen consider just span[a] below-the-fold, while clients with smaller screens have both div[1] and span[a] below-the-fold. Both screen sizes however have span[a] as below-the-fold. The current implementation won't consider either node to be below-the-fold, since neither will receive enough support. When this
TODO is fixed though, span[a] will be considered below-the-fold, since the support value for div[1] will be added to the support value for span[a].
virtual BeaconMetadata net_instaweb::BeaconCriticalLineInfoFinder::PrepareForBeaconInsertion | ( | RewriteDriver * | driver | ) | [virtual] |
Check property cache state and prepare to insert beacon. Returns the metadata with result.status == kDoNotBeacon if no beaconing should occur, and result.nonce contains the nonce if required (default implementation always beacons without a nonce).
Reimplemented from net_instaweb::CriticalLineInfoFinder.
static void net_instaweb::BeaconCriticalLineInfoFinder::WriteXPathsToPropertyCacheFromBeacon | ( | const StringSet & | xpaths_set, |
StringPiece | nonce, | ||
const PropertyCache * | cache, | ||
const PropertyCache::Cohort * | cohort, | ||
AbstractPropertyPage * | page, | ||
MessageHandler * | message_handler, | ||
Timer * | timer | ||
) | [static] |
Write the xpaths sent from the split_html_beacon to the property cache. This is a static method, because when the beacon is handled in ServerContext, the RewriteDriver for the original request is long gone.