tests: Convert usage of base::Bind to Once or Repeating (see issue #3140)

This commit is contained in:
Marshall Greenblatt
2021-06-19 15:54:45 -04:00
parent ed1840ddb5
commit 529b91bc6e
90 changed files with 1430 additions and 1332 deletions

View File

@@ -276,7 +276,7 @@ ClientHandler::ClientHandler(Delegate* delegate,
void ClientHandler::DetachDelegate() {
if (!CURRENTLY_ON_MAIN_THREAD()) {
// Execute this method on the main thread.
MAIN_POST_CLOSURE(base::Bind(&ClientHandler::DetachDelegate, this));
MAIN_POST_CLOSURE(base::BindOnce(&ClientHandler::DetachDelegate, this));
return;
}
@@ -717,11 +717,12 @@ bool ClientHandler::OnOpenURLFromTab(
target_disposition == WOD_NEW_FOREGROUND_TAB) {
// Handle middle-click and ctrl + left-click by opening the URL in a new
// browser window.
RootWindowConfig config;
config.with_controls = true;
config.with_osr = is_osr();
config.url = target_url;
MainContext::Get()->GetRootWindowManager()->CreateRootWindow(config);
auto config = std::make_unique<RootWindowConfig>();
config->with_controls = true;
config->with_osr = is_osr();
config->url = target_url;
MainContext::Get()->GetRootWindowManager()->CreateRootWindow(
std::move(config));
return true;
}
@@ -935,8 +936,8 @@ void ClientHandler::ShowDevTools(CefRefPtr<CefBrowser> browser,
const CefPoint& inspect_element_at) {
if (!CefCurrentlyOn(TID_UI)) {
// Execute this method on the UI thread.
CefPostTask(TID_UI, base::Bind(&ClientHandler::ShowDevTools, this, browser,
inspect_element_at));
CefPostTask(TID_UI, base::BindOnce(&ClientHandler::ShowDevTools, this,
browser, inspect_element_at));
return;
}
@@ -1015,18 +1016,19 @@ void ClientHandler::ShowSSLInformation(CefRefPtr<CefBrowser> browser) {
ss << "</body></html>";
RootWindowConfig config;
config.with_controls = false;
config.with_osr = is_osr();
config.url = test_runner::GetDataURI(ss.str(), "text/html");
MainContext::Get()->GetRootWindowManager()->CreateRootWindow(config);
auto config = std::make_unique<RootWindowConfig>();
config->with_controls = false;
config->with_osr = is_osr();
config->url = test_runner::GetDataURI(ss.str(), "text/html");
MainContext::Get()->GetRootWindowManager()->CreateRootWindow(
std::move(config));
}
void ClientHandler::SetStringResource(const std::string& page,
const std::string& data) {
if (!CefCurrentlyOn(TID_IO)) {
CefPostTask(TID_IO, base::Bind(&ClientHandler::SetStringResource, this,
page, data));
CefPostTask(TID_IO, base::BindOnce(&ClientHandler::SetStringResource, this,
page, data));
return;
}
@@ -1053,7 +1055,7 @@ void ClientHandler::NotifyBrowserCreated(CefRefPtr<CefBrowser> browser) {
if (!CURRENTLY_ON_MAIN_THREAD()) {
// Execute this method on the main thread.
MAIN_POST_CLOSURE(
base::Bind(&ClientHandler::NotifyBrowserCreated, this, browser));
base::BindOnce(&ClientHandler::NotifyBrowserCreated, this, browser));
return;
}
@@ -1065,7 +1067,7 @@ void ClientHandler::NotifyBrowserClosing(CefRefPtr<CefBrowser> browser) {
if (!CURRENTLY_ON_MAIN_THREAD()) {
// Execute this method on the main thread.
MAIN_POST_CLOSURE(
base::Bind(&ClientHandler::NotifyBrowserClosing, this, browser));
base::BindOnce(&ClientHandler::NotifyBrowserClosing, this, browser));
return;
}
@@ -1077,7 +1079,7 @@ void ClientHandler::NotifyBrowserClosed(CefRefPtr<CefBrowser> browser) {
if (!CURRENTLY_ON_MAIN_THREAD()) {
// Execute this method on the main thread.
MAIN_POST_CLOSURE(
base::Bind(&ClientHandler::NotifyBrowserClosed, this, browser));
base::BindOnce(&ClientHandler::NotifyBrowserClosed, this, browser));
return;
}
@@ -1088,7 +1090,7 @@ void ClientHandler::NotifyBrowserClosed(CefRefPtr<CefBrowser> browser) {
void ClientHandler::NotifyAddress(const CefString& url) {
if (!CURRENTLY_ON_MAIN_THREAD()) {
// Execute this method on the main thread.
MAIN_POST_CLOSURE(base::Bind(&ClientHandler::NotifyAddress, this, url));
MAIN_POST_CLOSURE(base::BindOnce(&ClientHandler::NotifyAddress, this, url));
return;
}
@@ -1099,7 +1101,7 @@ void ClientHandler::NotifyAddress(const CefString& url) {
void ClientHandler::NotifyTitle(const CefString& title) {
if (!CURRENTLY_ON_MAIN_THREAD()) {
// Execute this method on the main thread.
MAIN_POST_CLOSURE(base::Bind(&ClientHandler::NotifyTitle, this, title));
MAIN_POST_CLOSURE(base::BindOnce(&ClientHandler::NotifyTitle, this, title));
return;
}
@@ -1110,7 +1112,8 @@ void ClientHandler::NotifyTitle(const CefString& title) {
void ClientHandler::NotifyFavicon(CefRefPtr<CefImage> image) {
if (!CURRENTLY_ON_MAIN_THREAD()) {
// Execute this method on the main thread.
MAIN_POST_CLOSURE(base::Bind(&ClientHandler::NotifyFavicon, this, image));
MAIN_POST_CLOSURE(
base::BindOnce(&ClientHandler::NotifyFavicon, this, image));
return;
}
@@ -1122,7 +1125,7 @@ void ClientHandler::NotifyFullscreen(bool fullscreen) {
if (!CURRENTLY_ON_MAIN_THREAD()) {
// Execute this method on the main thread.
MAIN_POST_CLOSURE(
base::Bind(&ClientHandler::NotifyFullscreen, this, fullscreen));
base::BindOnce(&ClientHandler::NotifyFullscreen, this, fullscreen));
return;
}
@@ -1134,7 +1137,7 @@ void ClientHandler::NotifyAutoResize(const CefSize& new_size) {
if (!CURRENTLY_ON_MAIN_THREAD()) {
// Execute this method on the main thread.
MAIN_POST_CLOSURE(
base::Bind(&ClientHandler::NotifyAutoResize, this, new_size));
base::BindOnce(&ClientHandler::NotifyAutoResize, this, new_size));
return;
}
@@ -1147,8 +1150,8 @@ void ClientHandler::NotifyLoadingState(bool isLoading,
bool canGoForward) {
if (!CURRENTLY_ON_MAIN_THREAD()) {
// Execute this method on the main thread.
MAIN_POST_CLOSURE(base::Bind(&ClientHandler::NotifyLoadingState, this,
isLoading, canGoBack, canGoForward));
MAIN_POST_CLOSURE(base::BindOnce(&ClientHandler::NotifyLoadingState, this,
isLoading, canGoBack, canGoForward));
return;
}
@@ -1161,7 +1164,7 @@ void ClientHandler::NotifyDraggableRegions(
if (!CURRENTLY_ON_MAIN_THREAD()) {
// Execute this method on the main thread.
MAIN_POST_CLOSURE(
base::Bind(&ClientHandler::NotifyDraggableRegions, this, regions));
base::BindOnce(&ClientHandler::NotifyDraggableRegions, this, regions));
return;
}
@@ -1172,7 +1175,8 @@ void ClientHandler::NotifyDraggableRegions(
void ClientHandler::NotifyTakeFocus(bool next) {
if (!CURRENTLY_ON_MAIN_THREAD()) {
// Execute this method on the main thread.
MAIN_POST_CLOSURE(base::Bind(&ClientHandler::NotifyTakeFocus, this, next));
MAIN_POST_CLOSURE(
base::BindOnce(&ClientHandler::NotifyTakeFocus, this, next));
return;
}