Skip to content

Commit

Permalink
[Launcher pop-in] Add skeleton class of BurnInRanker.
Browse files Browse the repository at this point in the history
This CL adds a skeleton class for a new BurnInRanker. Follow ups will
add method implementations.

Once implemented, this will be a lightweight ranker at the end of the
ranking stack. It will be responsible for two main tasks:

(1) Enforcing a "burn-in" period of some fixed number of milliseconds,
during which results are collected from providers but are not published
to the front-end. The purpose of this is to prevent the rapid and
jittery updating of the result list at the beginning of display.

(2) Tracking results as belonging to either the pre-burn-in period or
the post-burn-in period. Post-burn-in results will have special
handling (e.g. append-only within a category), with exact details TBD.

Test: builds
Bug: 1279686
Change-Id: I7c170ee3791256a1f3d7f0a20493e5ecf775cddf
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3336923
Reviewed-by: Rachel Wong <wrong@chromium.org>
Commit-Queue: Amanda Deacon <amandadeacon@chromium.org>
Cr-Commit-Position: refs/heads/main@{#951417}
  • Loading branch information
Amanda Deacon authored and Chromium LUCI CQ committed Dec 14, 2021
1 parent 5b2b0c2 commit e5754bb
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 0 deletions.
2 changes: 2 additions & 0 deletions chrome/browser/ui/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -1976,6 +1976,8 @@ static_library("ui") {
"app_list/search/os_settings_provider.h",
"app_list/search/ranking/answer_ranker.cc",
"app_list/search/ranking/answer_ranker.h",
"app_list/search/ranking/burn_in_ranker.cc",
"app_list/search/ranking/burn_in_ranker.h",
"app_list/search/ranking/category_item_ranker.cc",
"app_list/search/ranking/category_item_ranker.h",
"app_list/search/ranking/category_usage_ranker.cc",
Expand Down
14 changes: 14 additions & 0 deletions chrome/browser/ui/app_list/search/ranking/burn_in_ranker.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// Copyright 2021 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "chrome/browser/ui/app_list/search/ranking/burn_in_ranker.h"

namespace app_list {

void BurnInRanker::UpdateResultRanks(ResultsMap& results,
ProviderType provider) {
// TODO(crbug.com/1279686): Implement.
}

} // namespace app_list
39 changes: 39 additions & 0 deletions chrome/browser/ui/app_list/search/ranking/burn_in_ranker.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
// Copyright 2021 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CHROME_BROWSER_UI_APP_LIST_SEARCH_RANKING_BURN_IN_RANKER_H_
#define CHROME_BROWSER_UI_APP_LIST_SEARCH_RANKING_BURN_IN_RANKER_H_

#include "chrome/browser/ui/app_list/search/ranking/ranker.h"

namespace app_list {

// A ranker which implements a "burn-in" period for the updating of results.
//
// This ranker has two main tasks:
//
// 1) Delay the release of results until after the burn-in period has ended.
// The purpose of this is to prevent the rapid and jittery updating of the
// results list on initial display.
//
// 2) Mark each result as having arrived pre- or post-burn-in time.
// Post-burn-in results may undergo special handling (e.g. append-only),
// with exact details TBD.
//
// TODO(crbug.com/1279686): Update description when implemented.
class BurnInRanker : public Ranker {
public:
BurnInRanker() = default;
~BurnInRanker() override = default;

BurnInRanker(const BurnInRanker&) = delete;
BurnInRanker& operator=(const BurnInRanker&) = delete;

// Ranker:
void UpdateResultRanks(ResultsMap& results, ProviderType provider) override;
};

} // namespace app_list

#endif // CHROME_BROWSER_UI_APP_LIST_SEARCH_RANKING_BURN_IN_RANKER_H_
4 changes: 4 additions & 0 deletions chrome/browser/ui/app_list/search/ranking/ranker_delegate.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

#include "chrome/browser/ui/app_list/search/ranking/ranker_delegate.h"

#include "chrome/browser/ui/app_list/search/ranking/burn_in_ranker.h"
#include "chrome/browser/ui/app_list/search/ranking/filtering_ranker.h"
#include "chrome/browser/ui/app_list/search/ranking/ftrl_category_ranker.h"
#include "chrome/browser/ui/app_list/search/ranking/ftrl_result_ranker.h"
Expand Down Expand Up @@ -43,6 +44,9 @@ RankerDelegate::RankerDelegate(Profile* profile, SearchController* controller) {
AddRanker(std::make_unique<RemovedResultsRanker>(
PersistentProto<RemovedResultsProto>(
state_dir.AppendASCII("removed_results.pb"), kNoWriteDelay)));

// Burn-in period for results.
AddRanker(std::make_unique<BurnInRanker>());
}

RankerDelegate::~RankerDelegate() {}
Expand Down

0 comments on commit e5754bb

Please sign in to comment.