Commit 0d298d15 authored by Sylvain Defresne's avatar Sylvain Defresne Committed by Commit Bot

Convert remoting/ios to use Bind() for blocks

With https://crrev.com/c/1070158, base::Bind() supports
block so convert uses of base::BindBlockArc() to instead
use base::BindOnce() or base::BindRepeating().

Bug: 701275
Change-Id: Ib251d93328858adfee6ccaddafebaa91124a8a24
Reviewed-on: https://chromium-review.googlesource.com/1087060Reviewed-by: default avatarLambros Lambrou <lambroslambrou@chromium.org>
Commit-Queue: Sylvain Defresne <sdefresne@chromium.org>
Cr-Commit-Position: refs/heads/master@{#564833}
parent b458e958
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
#include <SystemConfiguration/SystemConfiguration.h> #include <SystemConfiguration/SystemConfiguration.h>
#include <netinet/in.h> #include <netinet/in.h>
#import "base/mac/bind_objc_block.h" #import "base/bind.h"
#import "ios/third_party/material_components_ios/src/components/AnimationTiming/src/MaterialAnimationTiming.h" #import "ios/third_party/material_components_ios/src/components/AnimationTiming/src/MaterialAnimationTiming.h"
#import "ios/third_party/material_components_ios/src/components/AppBar/src/MaterialAppBar.h" #import "ios/third_party/material_components_ios/src/components/AppBar/src/MaterialAppBar.h"
#import "ios/third_party/material_components_ios/src/components/Dialogs/src/MaterialDialogs.h" #import "ios/third_party/material_components_ios/src/components/Dialogs/src/MaterialDialogs.h"
...@@ -206,11 +206,11 @@ using remoting::HostListService; ...@@ -206,11 +206,11 @@ using remoting::HostListService;
__weak __typeof(self) weakSelf = self; __weak __typeof(self) weakSelf = self;
_hostListStateSubscription = _hostListStateSubscription =
_hostListService->RegisterHostListStateCallback(base::BindBlockArc(^{ _hostListService->RegisterHostListStateCallback(base::BindRepeating(^{
[weakSelf hostListStateDidChange]; [weakSelf hostListStateDidChange];
})); }));
_hostListFetchFailureSubscription = _hostListFetchFailureSubscription =
_hostListService->RegisterFetchFailureCallback(base::BindBlockArc(^{ _hostListService->RegisterFetchFailureCallback(base::BindRepeating(^{
[weakSelf hostListFetchDidFail]; [weakSelf hostListFetchDidFail];
})); }));
} }
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
#import "remoting/ios/display/gl_display_handler.h" #import "remoting/ios/display/gl_display_handler.h"
#import "base/mac/bind_objc_block.h" #import "base/bind.h"
#import "remoting/client/display/sys_opengl.h" #import "remoting/client/display/sys_opengl.h"
#import "remoting/ios/display/eagl_view.h" #import "remoting/ios/display/eagl_view.h"
#import "remoting/ios/display/gl_demo_screen.h" #import "remoting/ios/display/gl_demo_screen.h"
...@@ -177,7 +177,7 @@ void Core::OnFrameRendered() { ...@@ -177,7 +177,7 @@ void Core::OnFrameRendered() {
// block to dereference |this|, which is thread unsafe because it doesn't // block to dereference |this|, which is thread unsafe because it doesn't
// support ARC. // support ARC.
__weak id<GlDisplayHandlerDelegate> handler_delegate = handler_delegate_; __weak id<GlDisplayHandlerDelegate> handler_delegate = handler_delegate_;
runtime_->ui_task_runner()->PostTask(FROM_HERE, base::BindBlockArc(^{ runtime_->ui_task_runner()->PostTask(FROM_HERE, base::BindOnce(^{
[handler_delegate rendererTicked]; [handler_delegate rendererTicked];
})); }));
} }
...@@ -186,7 +186,7 @@ void Core::OnSizeChanged(int width, int height) { ...@@ -186,7 +186,7 @@ void Core::OnSizeChanged(int width, int height) {
DCHECK(runtime_->display_task_runner()->BelongsToCurrentThread()); DCHECK(runtime_->display_task_runner()->BelongsToCurrentThread());
__weak id<GlDisplayHandlerDelegate> handler_delegate = handler_delegate_; __weak id<GlDisplayHandlerDelegate> handler_delegate = handler_delegate_;
runtime_->ui_task_runner()->PostTask( runtime_->ui_task_runner()->PostTask(
FROM_HERE, base::BindBlockArc(^{ FROM_HERE, base::BindOnce(^{
[handler_delegate canvasSizeChanged:CGSizeMake(width, height)]; [handler_delegate canvasSizeChanged:CGSizeMake(width, height)];
})); }));
} }
...@@ -200,7 +200,7 @@ void Core::CreateRendererContext(EAGLView* view) { ...@@ -200,7 +200,7 @@ void Core::CreateRendererContext(EAGLView* view) {
} }
view_ = view; view_ = view;
runtime_->ui_task_runner()->PostTask(FROM_HERE, base::BindBlockArc(^{ runtime_->ui_task_runner()->PostTask(FROM_HERE, base::BindOnce(^{
[view startWithContext:eagl_context_]; [view startWithContext:eagl_context_];
})); }));
...@@ -224,7 +224,7 @@ void Core::DestroyRendererContext() { ...@@ -224,7 +224,7 @@ void Core::DestroyRendererContext() {
renderer_->OnSurfaceDestroyed(); renderer_->OnSurfaceDestroyed();
__weak EAGLView* view = view_; __weak EAGLView* view = view_;
runtime_->ui_task_runner()->PostTask(FROM_HERE, base::BindBlockArc(^{ runtime_->ui_task_runner()->PostTask(FROM_HERE, base::BindOnce(^{
[view stop]; [view stop];
})); }));
view_ = nil; view_ = nil;
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
#import <Foundation/Foundation.h> #import <Foundation/Foundation.h>
#import <Security/Security.h> #import <Security/Security.h>
#import "base/mac/bind_objc_block.h" #import "base/bind.h"
#import "ios/third_party/material_components_ios/src/components/Snackbar/src/MaterialSnackbar.h" #import "ios/third_party/material_components_ios/src/components/Snackbar/src/MaterialSnackbar.h"
#import "remoting/ios/facade/host_info.h" #import "remoting/ios/facade/host_info.h"
#import "remoting/ios/facade/host_list_fetcher.h" #import "remoting/ios/facade/host_list_fetcher.h"
...@@ -127,7 +127,7 @@ RemotingAuthenticationStatus oauthStatusToRemotingAuthenticationStatus( ...@@ -127,7 +127,7 @@ RemotingAuthenticationStatus oauthStatusToRemotingAuthenticationStatus(
__weak RemotingOAuthAuthentication* weakSelf = self; __weak RemotingOAuthAuthentication* weakSelf = self;
_tokenGetter = CreateOAuthTokenGetterWithAuthorizationCode( _tokenGetter = CreateOAuthTokenGetterWithAuthorizationCode(
std::string(base::SysNSStringToUTF8(authorizationCode)), std::string(base::SysNSStringToUTF8(authorizationCode)),
base::BindBlockArc( base::BindRepeating(
^(const std::string& user_email, const std::string& refresh_token) { ^(const std::string& user_email, const std::string& refresh_token) {
VLOG(1) << "New Creds: " << user_email << " " << refresh_token; VLOG(1) << "New Creds: " << user_email << " " << refresh_token;
UserInfo* user = [[UserInfo alloc] init]; UserInfo* user = [[UserInfo alloc] init];
...@@ -169,7 +169,7 @@ RemotingAuthenticationStatus oauthStatusToRemotingAuthenticationStatus( ...@@ -169,7 +169,7 @@ RemotingAuthenticationStatus oauthStatusToRemotingAuthenticationStatus(
// Be careful here since a failure to reset onAccessToken will end up with // Be careful here since a failure to reset onAccessToken will end up with
// retain cycle and memory leakage. // retain cycle and memory leakage.
if (_tokenGetter) { if (_tokenGetter) {
_tokenGetter->CallWithToken(base::BindBlockArc( _tokenGetter->CallWithToken(base::BindRepeating(
^(remoting::OAuthTokenGetter::Status status, ^(remoting::OAuthTokenGetter::Status status,
const std::string& user_email, const std::string& access_token) { const std::string& user_email, const std::string& access_token) {
onAccessToken(oauthStatusToRemotingAuthenticationStatus(status), onAccessToken(oauthStatusToRemotingAuthenticationStatus(status),
......
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