Commit 69b685d4 authored by Sophie Chang's avatar Sophie Chang Committed by Commit Bot

Send up supported key representations so we get host-keyed hints

Bug: 1110487
Change-Id: I78eab25150fd7424f06a3d9b6f244ad00e214b86
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2333821
Commit-Queue: Sophie Chang <sophiechang@chromium.org>
Reviewed-by: default avatarMichael Crouse <mcrouse@chromium.org>
Cr-Commit-Position: refs/heads/master@{#795333}
parent e5d9ec5b
......@@ -1239,7 +1239,7 @@ TEST_F(OptimizationGuideHintsManagerTest,
optimization_guide::proto::Configuration config;
optimization_guide::proto::Hint* hint1 = config.add_hints();
hint1->set_key("somedomain.org");
hint1->set_key_representation(optimization_guide::proto::HOST_SUFFIX);
hint1->set_key_representation(optimization_guide::proto::HOST);
hint1->set_version("someversion");
optimization_guide::proto::Optimization* opt1 =
hint1->add_whitelisted_optimizations();
......
......@@ -318,7 +318,6 @@ bool HintCache::ProcessAndCacheHints(
: clock_->Now() + features::URLKeyedHintValidCacheDuration();
switch (hint.key_representation()) {
case proto::HOST_SUFFIX:
case proto::HOST:
host_keyed_cache_.Put(
hint_key,
......@@ -336,6 +335,7 @@ bool HintCache::ProcessAndCacheHints(
std::make_unique<MemoryHint>(expiry_time, std::move(hint)));
}
break;
case proto::HOST_SUFFIX:
case proto::REPRESENTATION_UNSPECIFIED:
NOTREACHED();
break;
......
......@@ -957,7 +957,7 @@ TEST_P(HintCacheTest,
proto::Hint hint;
hint.set_key("whatever.com");
hint.set_key_representation(proto::HOST_SUFFIX);
hint.set_key_representation(proto::HOST);
hint.add_whitelisted_optimizations()->set_optimization_type(
optimization_guide::proto::DEFER_ALL_SCRIPT);
......
......@@ -194,8 +194,8 @@ bool HintsFetcher::FetchOptimizationGuideServiceHints(
request_context_ = request_context;
proto::GetHintsRequest get_hints_request;
// TODO(crbug/1110487): Add supported key representations once server supports
// sending HOST-keyed hints.
get_hints_request.add_supported_key_representations(proto::HOST);
get_hints_request.add_supported_key_representations(proto::FULL_URL);
for (const auto& optimization_type : optimization_types)
get_hints_request.add_supported_optimizations(optimization_type);
......
......@@ -73,12 +73,6 @@ message GetHintsResponse {
// representation combination. These hints are intended to apply to a full
// page. It is expected that the client will use the Hint record with the
// most specific key that matches the main frame URL.
//
// Note, this list may contain multiple hints that apply to a page. For
// example, if there are hints for (HOST_SUFFIX,cnn.com) and
// (HOST_SUFFIX,sports.cnn.com), these may both apply to
// sports.cnn.com/foo. In this case, the client is expected to use the
// hints from (HOST_SUFFIX,sports.cnn.com).
repeated Hint hints = 1;
// The maximum duration in which the hints, or lack of hints, provided in
......@@ -155,7 +149,7 @@ enum KeyRepresentation {
//
// Example: A host suffix of example.com would match pages with host
// sports.example.com, but not fooexample.com.
HOST_SUFFIX = 1;
HOST_SUFFIX = 1 [deprecated = true];
// The full URL to match.
//
// This will be an exact match of a page load URL, including query params and
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment