Page Speed Optimization Libraries
1.13.35.1
|
#include "rewrite_options.h"
Classes | |
struct | AlternateOriginDomainSpec |
Public Member Functions | |
ExperimentSpec (const StringPiece &spec, const RewriteOptions *options, MessageHandler *handler) | |
ExperimentSpec (int id) | |
virtual ExperimentSpec * | Clone () |
Return a ExperimentSpec with all the same information as this one. | |
bool | is_valid () const |
int | id () const |
Accessors. | |
int | percent () const |
const GoogleString & | ga_id () const |
int | slot () const |
RewriteLevel | rewrite_level () const |
FilterSet | enabled_filters () const |
FilterSet | disabled_filters () const |
OptionSet | filter_options () const |
bool | matches_device_type (UserAgentMatcher::DeviceType type) const |
bool | use_default () const |
GoogleString | ToString () const |
void | ApplyAlternateOriginsToDomainLawyer (DomainLawyer *domain_lawyer, MessageHandler *handler) const |
Mutate the origin domains in DomainLawyer with alternate_origin_domains_. | |
Protected Types | |
typedef std::bitset < net_instaweb::UserAgentMatcher::kEndOfDeviceType > | DeviceTypeBitSet |
Protected Member Functions | |
void | Merge (const ExperimentSpec &spec) |
Static Protected Member Functions | |
static bool | ParseDeviceTypeBitSet (const StringPiece &in, DeviceTypeBitSet *out, MessageHandler *handler) |
static bool | LooksLikeValidHost (const StringPiece &s) |
static bool | ParseAlternateOriginDomain (const StringPiece &in, AlternateOriginDomainSpec *out, MessageHandler *handler) |
static void | CombineQuotedHostPort (StringPieceVector *vec, size_t first_pos, GoogleString *combined_container) |
static GoogleString | QuoteHostPort (const GoogleString &in) |
This class is a separate subset of options for running an experiment. These options can be specified by a spec string that looks like: "id=<number greater than 0>;level=<rewrite level>="">;enabled= <comma-separated-list of filters to enable>;disabled= <comma-separated-list of filters to disable>;options= <comma-separated-list of option=value pairs to set>.
net_instaweb::RewriteOptions::ExperimentSpec::ExperimentSpec | ( | const StringPiece & | spec, |
const RewriteOptions * | options, | ||
MessageHandler * | handler | ||
) |
Creates a ExperimentSpec parsed from spec. If spec doesn't have an id, then id_ will be set to experiment::kExperimentNotSet. These ExperimentSpecs will then be rejected by AddExperimentSpec().
|
explicit |
Creates a ExperimentSpec with id_=id. All other variables are initialized to 0. This is primarily used for setting up the control and for cloning.
|
staticprotected |
Combine consecutive entries in a StringPieceVector such that [ a, b, "host, port" ] can be turned into [ a, b, host:port ]. Inspects vec[first_pos] and vec[first_pos + 1]. If they appear to be a quoted tuple, will replace vec[first_pos] with a combined value and vec[first_pos + 1] will be removed, ie: vec will reduce in size by 1. combined_container is used as the underlying storage for the combined string, if necessary.
|
staticprotected |
Simple check that 's' is not obviously an invalid host. Used to avoid problems when a port number is accidentally placed in a host field.
|
protected |
Merges a spec into this. This follows the same semantics as RewriteOptions. Specifically, filter/options list get unioned, and vars get overwritten, except ID. In the event of a conflict, e.g. preserve vs extend_cache, *this will take precedence.
|
staticprotected |
Parses the string after an 'alternate_origin_domain' experiment option, returning if it was successfull. If it returns false, the spec is invalid and should be discarded.
|
staticprotected |
Returns a copy of the input string that will be surrounded by double quotes if the input string contains a colon. This is used to turn host:port into "host:port" when printing an ExperimentSpec.