Commit 775cda27 authored by Findit's avatar Findit

Revert "Setup chrome://internals/query-tiles."

This reverts commit 7981cdda.

Reason for revert:

Findit (https://goo.gl/kROfz5) identified CL at revision 780087 as the
culprit for failures in the build cycles as shown on:
https://analysis.chromium.org/waterfall/culprit?key=ag9zfmZpbmRpdC1mb3ItbWVyRAsSDVdmU3VzcGVjdGVkQ0wiMWNocm9taXVtLzc5ODFjZGRhM2U0Mzk4OTg1YTUwNTNhN2I3NDkyZjhjYTE4OGQ2MzAM

Sample Failed Build: https://ci.chromium.org/b/8877108097544019312

Sample Failed Step: compile

Original change's description:
> Setup chrome://internals/query-tiles.
> 
> - Setup chrome://internals for future merge.
> - Complete the front end code for chrome://internals/query-tiles.
> 
> Bug: 1066556
> Change-Id: I51529f6e11dd37e15df2b7a3da1864dbbc5da58b
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2247544
> Commit-Queue: Hesen Zhang <hesen@chromium.org>
> Reviewed-by: dpapad <dpapad@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#780087}


Change-Id: I454c0693ef4898dda3a2dc8c7d3386beb84d930f
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 1066556
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2253207
Cr-Commit-Position: refs/heads/master@{#780099}
parent 4752fef3
......@@ -79,9 +79,6 @@ This file specifies browser resources for developer-facing chrome:// pages
<include name="IDR_FEED_INTERNALS_CSS" file="resources\feed_internals\feed_internals.css" allowexternalscript="true" type="BINDATA" />
<include name="IDR_FEED_INTERNALS_JS" file="resources\feed_internals\feed_internals.js" type="BINDATA" />
<include name="IDR_FEED_INTERNALS_MOJO_JS" file="${root_gen_dir}\chrome\browser\ui\webui\feed_internals\feed_internals.mojom-lite.js" use_base_dir="false" type="BINDATA" />
<include name="IDR_QUERY_TILES_INTERNALS_HTML" file="resources\internals\query_tiles\query_tiles_internals.html" type="BINDATA" />
<include name="IDR_QUERY_TILES_INTERNALS_JS" file="resources\internals\query_tiles\query_tiles_internals.js" type="BINDATA" />
<include name="IDR_QUERY_TILES_INTERNALS_BROWSER_PROXY_JS" file="resources\internals\query_tiles\query_tiles_internals_browser_proxy.js" type="BINDATA" />
<include name="IDR_SNIPPETS_INTERNALS_HTML" file="resources\snippets_internals\snippets_internals.html" allowexternalscript="true" type="BINDATA" />
<include name="IDR_SNIPPETS_INTERNALS_CSS" file="resources\snippets_internals\snippets_internals.css" type="BINDATA" />
<include name="IDR_SNIPPETS_INTERNALS_JS" file="resources\snippets_internals\snippets_internals.js" type="BINDATA" />
......
......@@ -68,7 +68,6 @@ if (enable_js_type_check) {
deps += [
"explore_sites_internals:closure_compile",
"feed_internals:closure_compile",
"internals/query_tiles:closure_compile",
"offline_pages:closure_compile",
"snippets_internals:closure_compile",
"webapks:closure_compile",
......
# Copyright 2020 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.
import("//third_party/closure_compiler/compile_js.gni")
js_type_check("closure_compile") {
uses_js_modules = true
deps = [
":query_tiles_internals",
":query_tiles_internals_browser_proxy",
]
}
js_library("query_tiles_internals") {
deps = [
":query_tiles_internals_browser_proxy",
"//ui/webui/resources/js:cr.m",
"//ui/webui/resources/js:util.m",
]
}
js_library("query_tiles_internals_browser_proxy") {
deps = [ "//ui/webui/resources/js:cr.m" ]
}
<!doctype html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title>Query Tiles Internals</title>
<meta name="viewport" content="width=device-width">
<link rel="stylesheet" href="chrome://resources/css/text_defaults.css">
</head>
<body>
<h1>Query Tiles Internals</h1>
<h4>Fetcher Controller</h4>
<div>
<button id="start-fetch">Start fetch</button>
</div>
<h4>Database Controller</h4>
<div>
<button id="purge-db">Purge database</button>
</div>
<h4>Service State</h4>
<div>
Fetcher status: <span id="fetcher-status"></span>
Database status: <span id="group-status"></span>
</div>
<h4>Tile data</h4>
Group info: <span id="group-info"></span>
Tile proto: <span id="tile-proto"></span>
<div>
</div>
<script type="module" src="query_tiles_internals.js"></script>
</body>
</html>
// Copyright 2020 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.
import {addWebUIListener} from 'chrome://resources/js/cr.m.js';
import {$} from 'chrome://resources/js/util.m.js';
import {QueryTilesInternalsBrowserProxy, QueryTilesInternalsBrowserProxyImpl, ServiceStatus, TileData} from './query_tiles_internals_browser_proxy.js';
/**
* @param {!ServiceStatus} serviceStatus The current status of the tile
* service.
*/
function onServiceStatusChanged(serviceStatus) {
$('group-status').textContent = serviceStatus.groupStatus;
$('fetcher-status').textContent = serviceStatus.fetcherStatus;
}
/**
* @param {!TileData} tileData The raw data persisted in database.
*/
function onTileDataAvailable(tileData) {
$('group-info').textContent = serviceData.groupInfo;
$('tile-proto').textContent = tileData.tileProto;
}
function initialize() {
/** @type {!QueryTilesInternalsBrowserProxy} */
const browserProxy = QueryTilesInternalsBrowserProxyImpl.getInstance();
// Register all event listeners.
addWebUIListener('service-status-changed', onServiceStatusChanged);
addWebUIListener('tile-data-available', onTileDataAvailable);
$('start-fetch').onclick = function() {
browserProxy.startFetch();
};
$('purge-db').onclick = function() {
browserProxy.purgeDb();
};
// Kick off requests for the current system state.
browserProxy.getServiceStatus().then(onServiceStatusChanged);
browserProxy.getTileData().then(onTileDataAvailable);
}
document.addEventListener('DOMContentLoaded', initialize);
// Copyright 2020 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.
import {addSingletonGetter, sendWithPromise} from 'chrome://resources/js/cr.m.js';
/**
* @typedef {{
* fetcherStatus: string,
* groupStatus: string,
* }}
*/
export let ServiceStatus;
/**
* @typedef {{
* groupInfo: string,
* tilesProto: string,
* }}
*/
export let TileData;
/** @interface */
export class QueryTilesInternalsBrowserProxy {
/**
* Start fetch right now.
*/
startFetch() {}
/**
* Delete everything in the database.
*/
purgeDb() {}
/**
* Get the current status of the TileService.
* @return {!Promise<ServiceStatus>} A promise firing when the service
* status is fetched.
*/
getServiceStatus() {}
/**
* Get raw data from TileService database.
* @return {!Promise<TileData>} A promise firing when the raw data
* is fetched.
*/
getTileData() {}
}
/**
* @implements {QueryTilesInternalsBrowserProxy}
*/
export class QueryTilesInternalsBrowserProxyImpl {
/** @override */
startFetch() {
return chrome.send('startFetch');
}
/** @override */
purgeDb() {
return chrome.send('purgeDb');
}
/** @override */
getServiceStatus() {
return sendWithPromise('getServiceStatus');
}
/** @override */
getTileData() {
return sendWithPromise('getTileData');
}
}
addSingletonGetter(QueryTilesInternalsBrowserProxyImpl);
......@@ -602,7 +602,6 @@ static_library("ui") {
"//chrome/browser/ui/webui/explore_sites_internals:mojo_bindings",
"//chrome/browser/ui/webui/snippets_internals:mojo_bindings",
"//components/browser_ui/util/android",
"//components/query_tiles",
"//components/security_state/content/android",
]
if (enable_feed_in_chrome) {
......@@ -770,10 +769,6 @@ static_library("ui") {
"webui/explore_sites_internals/explore_sites_internals_page_handler.h",
"webui/explore_sites_internals/explore_sites_internals_ui.cc",
"webui/explore_sites_internals/explore_sites_internals_ui.h",
"webui/internals/internals_ui.cc",
"webui/internals/internals_ui.h",
"webui/internals/query_tiles/query_tiles_internals_ui_message_handler.cc",
"webui/internals/query_tiles/query_tiles_internals_ui_message_handler.h",
"webui/offline/offline_internals_ui.cc",
"webui/offline/offline_internals_ui.h",
"webui/offline/offline_internals_ui_message_handler.cc",
......
......@@ -122,7 +122,6 @@
#if defined(OS_ANDROID)
#include "chrome/browser/ui/webui/explore_sites_internals/explore_sites_internals_ui.h"
#include "chrome/browser/ui/webui/internals/internals_ui.h"
#include "chrome/browser/ui/webui/offline/offline_internals_ui.h"
#include "chrome/browser/ui/webui/snippets_internals/snippets_internals_ui.h"
#include "chrome/browser/ui/webui/webapks_ui.h"
......@@ -674,8 +673,6 @@ WebUIFactoryFunction GetWebUIFactoryFunction(WebUI* web_ui,
if (url.host_piece() == chrome::kChromeUIExploreSitesInternalsHost &&
!profile->IsOffTheRecord())
return &NewWebUI<explore_sites::ExploreSitesInternalsUI>;
if (url.host_piece() == chrome::kChromeUIInternalsHost)
return &NewWebUI<InternalsUI>;
if (url.host_piece() == chrome::kChromeUIOfflineInternalsHost)
return &NewWebUI<OfflineInternalsUI>;
if (url.host_piece() == chrome::kChromeUISnippetsInternalsHost &&
......
// Copyright 2020 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/webui/internals/internals_ui.h"
#include "chrome/browser/ui/webui/internals/query_tiles/query_tiles_internals_ui_message_handler.h"
#include "chrome/common/url_constants.h"
#include "chrome/grit/dev_ui_browser_resources.h"
#include "content/public/browser/web_ui.h"
#include "content/public/browser/web_ui_controller.h"
#include "content/public/browser/web_ui_data_source.h"
InternalsUI::InternalsUI(content::WebUI* web_ui)
: content::WebUIController(web_ui) {
profile_ = Profile::FromWebUI(web_ui);
source_ = content::WebUIDataSource::Create(chrome::kChromeUIInternalsHost);
// Add your sub-URL internals WebUI here.
AddQueryTilesInternals(web_ui);
content::WebUIDataSource::Add(profile_, source_);
}
InternalsUI::~InternalsUI() = default;
void InternalsUI::AddQueryTilesInternals(content::WebUI* web_ui) {
source_->AddResourcePath("query_tiles_internals.js",
IDR_QUERY_TILES_INTERNALS_JS);
source_->AddResourcePath("query_tiles_internals_browser_proxy.js",
IDR_QUERY_TILES_INTERNALS_BROWSER_PROXY_JS);
source_->AddResourcePath("query-tiles", IDR_QUERY_TILES_INTERNALS_HTML);
web_ui->AddMessageHandler(
std::make_unique<QueryTilesInternalsUIMessageHandler>(profile_));
}
// Copyright 2020 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_WEBUI_INTERNALS_INTERNALS_UI_H_
#define CHROME_BROWSER_UI_WEBUI_INTERNALS_INTERNALS_UI_H_
#include "chrome/browser/profiles/profile.h"
#include "content/public/browser/web_ui_controller.h"
#include "content/public/browser/web_ui_data_source.h"
namespace content {
class WebUI;
} // namespace content
// Client could put debug WebUI as sub-URL under chrome://internals/.
// e.g. chrome://internals/your-feature.
class InternalsUI : public content::WebUIController {
public:
explicit InternalsUI(content::WebUI* web_ui);
~InternalsUI() override;
private:
// Add resources and message handler for chrome://internals/query-tiles.
void AddQueryTilesInternals(content::WebUI* web_ui);
Profile* profile_;
content::WebUIDataSource* source_;
};
#endif // CHROME_BROWSER_UI_WEBUI_INTERNALS_INTERNALS_UI_H_
// Copyright 2020 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/webui/internals/query_tiles/query_tiles_internals_ui_message_handler.h"
#include <memory>
#include <string>
#include <utility>
#include "base/bind.h"
#include "base/values.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_key.h"
#include "chrome/browser/query_tiles/tile_service_factory.h"
#include "content/public/browser/web_ui.h"
QueryTilesInternalsUIMessageHandler::QueryTilesInternalsUIMessageHandler(
Profile* profile)
: tile_service_(query_tiles::TileServiceFactory::GetForKey(
profile->GetProfileKey())) {
DCHECK(tile_service_);
}
QueryTilesInternalsUIMessageHandler::~QueryTilesInternalsUIMessageHandler() =
default;
void QueryTilesInternalsUIMessageHandler::RegisterMessages() {
web_ui()->RegisterMessageCallback(
"startFetch", base::BindRepeating(
&QueryTilesInternalsUIMessageHandler::HandleStartFetch,
base::Unretained(this)));
web_ui()->RegisterMessageCallback(
"purgeDb",
base::BindRepeating(&QueryTilesInternalsUIMessageHandler::HandlePurgeDb,
base::Unretained(this)));
web_ui()->RegisterMessageCallback(
"getServiceStatus",
base::Bind(&QueryTilesInternalsUIMessageHandler::HandleGetServiceStatus,
weak_ptr_factory_.GetWeakPtr()));
web_ui()->RegisterMessageCallback(
"getTileData",
base::Bind(&QueryTilesInternalsUIMessageHandler::HandleGetTileData,
weak_ptr_factory_.GetWeakPtr()));
}
void QueryTilesInternalsUIMessageHandler::HandleGetTileData(
const base::ListValue* args) {
NOTIMPLEMENTED();
}
void QueryTilesInternalsUIMessageHandler::HandleGetServiceStatus(
const base::ListValue* args) {
NOTIMPLEMENTED();
}
void QueryTilesInternalsUIMessageHandler::HandleStartFetch(
const base::ListValue* args) {
NOTIMPLEMENTED();
}
void QueryTilesInternalsUIMessageHandler::HandlePurgeDb(
const base::ListValue* args) {
NOTIMPLEMENTED();
}
// Copyright 2020 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_WEBUI_INTERNALS_QUERY_TILES_QUERY_TILES_INTERNALS_UI_MESSAGE_HANDLER_H_
#define CHROME_BROWSER_UI_WEBUI_INTERNALS_QUERY_TILES_QUERY_TILES_INTERNALS_UI_MESSAGE_HANDLER_H_
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
#include "content/public/browser/web_ui_message_handler.h"
namespace base {
class ListValue;
} // namespace base
class Profile;
namespace query_tiles {
class TileService;
}
class QueryTilesInternalsUIMessageHandler
: public content::WebUIMessageHandler {
public:
explicit QueryTilesInternalsUIMessageHandler(Profile* profile);
~QueryTilesInternalsUIMessageHandler() override;
// content::WebUIMessageHandler implementation.
void RegisterMessages() override;
private:
void HandleGetServiceStatus(const base::ListValue* args);
void HandleGetTileData(const base::ListValue* args);
void HandleStartFetch(const base::ListValue* args);
void HandlePurgeDb(const base::ListValue* args);
query_tiles::TileService* tile_service_;
base::WeakPtrFactory<QueryTilesInternalsUIMessageHandler> weak_ptr_factory_{
this};
};
#endif // CHROME_BROWSER_UI_WEBUI_INTERNALS_QUERY_TILES_QUERY_TILES_INTERNALS_UI_MESSAGE_HANDLER_H_
......@@ -177,7 +177,6 @@ const char kChromeUIWelcomeWin10Host[] = "welcome-win10";
#if defined(OS_ANDROID)
const char kChromeUIExploreSitesInternalsHost[] = "explore-sites-internals";
const char kChromeUIInternalsHost[] = "internals";
const char kChromeUIJavaCrashURL[] = "chrome://java-crash/";
const char kChromeUINativeBookmarksURL[] = "chrome-native://bookmarks/";
const char kChromeUINativeExploreURL[] = "chrome-native://explore";
......
......@@ -179,7 +179,6 @@ extern const char kChromeUIWelcomeWin10Host[];
#if defined(OS_ANDROID)
extern const char kChromeUIExploreSitesInternalsHost[];
extern const char kChromeUIInternalsHost[];
extern const char kChromeUIJavaCrashURL[];
extern const char kChromeUINativeBookmarksURL[];
extern const char kChromeUINativeExploreURL[];
......
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