Page Speed Optimization Libraries
1.13.35.1
|
#include "dependency_tracker.h"
Public Member Functions | |
DependencyTracker (RewriteDriver *driver) | |
Note: you must also call SetServerContext on this before operation. | |
void | SetServerContext (ServerContext *server_context) |
This needs to be called to help initialize locking. | |
void | Start () |
Must be called when parsing pages, after pcache has read in. | |
void | FinishedParsing () |
int | RegisterDependencyCandidate () |
void | ReportDependencyCandidate (int id, const Dependency *dep) |
const Dependencies * | read_in_info () const |
This is temporary, nicer API coming later. | |
Helper for keeping track of what resources a page depends on — it helps decode information saved in property cache, and to assemble information collected from the actual page to update it.
The Register/Report methods are thread-safe.
void net_instaweb::DependencyTracker::FinishedParsing | ( | ) |
Must be called after the last flush window has been processed, so we know no further processing.
int net_instaweb::DependencyTracker::RegisterDependencyCandidate | ( | ) |
Notices the tracker that some filter may be trying to compute a dependency asynchronously. This returns an ID which should then be passed to ReportDependencyCandidate();
void net_instaweb::DependencyTracker::ReportDependencyCandidate | ( | int | id, |
const Dependency * | dep | ||
) |
Reports result of a dependency computation. You must call ReportDependencyCandidate() for every RegisterDependencyCandidate() call, but it can report that the lead didn't checkout by setting dep to nullptr.
'id' must be the result of the corresponding RegisterDependencyCandidate() call. 'dep' is the dependency summary for the resource in question, and may be nullptr if there doesn't seem to be something we want to push there (e.g. it got removed due to combining). *dep will be copied in, so only needs to be alive for the duration of the call.