Commit 1361644c authored by Sylvain Defresne's avatar Sylvain Defresne Committed by Commit Bot

Convert ui/gfx away from base::Bind/base::Callback

base::Bind/base::Callback are deprecated in favor of either
base::BindOnce/base::OnceCallback or base::BindRepeating/
base::RepeatingCallback (depending on whether the callback
is invoked once or multiple time).

Convert all uses of base::Bind/base::Callback in ui/gfx
to the recommended methods/types.

Bug: 1007851
Change-Id: Iac0a7b8e9bb05a9f9c3f498bc43c078e0d7ee64e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1831862
Auto-Submit: Sylvain Defresne <sdefresne@chromium.org>
Commit-Queue: Alexei Svitkine <asvitkine@chromium.org>
Reviewed-by: default avatarAlexei Svitkine <asvitkine@chromium.org>
Cr-Commit-Position: refs/heads/master@{#701634}
parent a311fa66
...@@ -75,8 +75,9 @@ class CachedFontRenderParams { ...@@ -75,8 +75,9 @@ class CachedFontRenderParams {
params_->subpixel_rendering = GetSubpixelRenderingGeometry(); params_->subpixel_rendering = GetSubpixelRenderingGeometry();
} }
} }
singleton_hwnd_observer_ = std::make_unique<SingletonHwndObserver>( singleton_hwnd_observer_ =
base::Bind(&CachedFontRenderParams::OnWndProc, base::Unretained(this))); std::make_unique<SingletonHwndObserver>(base::BindRepeating(
&CachedFontRenderParams::OnWndProc, base::Unretained(this)));
return *params_; return *params_;
} }
......
...@@ -74,8 +74,8 @@ SysColorChangeObserver* SysColorChangeObserver::GetInstance() { ...@@ -74,8 +74,8 @@ SysColorChangeObserver* SysColorChangeObserver::GetInstance() {
SysColorChangeObserver::SysColorChangeObserver() SysColorChangeObserver::SysColorChangeObserver()
: singleton_hwnd_observer_(new SingletonHwndObserver( : singleton_hwnd_observer_(new SingletonHwndObserver(
base::Bind(&SysColorChangeObserver::OnWndProc, base::BindRepeating(&SysColorChangeObserver::OnWndProc,
base::Unretained(this)))) {} base::Unretained(this)))) {}
SysColorChangeObserver::~SysColorChangeObserver() {} SysColorChangeObserver::~SysColorChangeObserver() {}
......
...@@ -21,7 +21,7 @@ class SingletonHwnd; ...@@ -21,7 +21,7 @@ class SingletonHwnd;
// use a SingletonHwndHotKeyObserver instead for each hot key. // use a SingletonHwndHotKeyObserver instead for each hot key.
class GFX_EXPORT SingletonHwndObserver { class GFX_EXPORT SingletonHwndObserver {
public: public:
typedef base::Callback<void(HWND, UINT, WPARAM, LPARAM)> WndProc; using WndProc = base::RepeatingCallback<void(HWND, UINT, WPARAM, LPARAM)>;
explicit SingletonHwndObserver(const WndProc& wnd_proc); explicit SingletonHwndObserver(const WndProc& wnd_proc);
~SingletonHwndObserver(); ~SingletonHwndObserver();
......
...@@ -170,8 +170,8 @@ WindowImpl::~WindowImpl() { ...@@ -170,8 +170,8 @@ WindowImpl::~WindowImpl() {
// static // static
void WindowImpl::UnregisterClassesAtExit() { void WindowImpl::UnregisterClassesAtExit() {
base::AtExitManager::RegisterTask( base::AtExitManager::RegisterTask(
base::Bind(&ClassRegistrar::UnregisterClasses, base::BindOnce(&ClassRegistrar::UnregisterClasses,
base::Unretained(ClassRegistrar::GetInstance()))); base::Unretained(ClassRegistrar::GetInstance())));
} }
void WindowImpl::Init(HWND parent, const Rect& bounds) { void WindowImpl::Init(HWND parent, const Rect& bounds) {
......
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