Commit 7052b23c authored by Sylvain Defresne's avatar Sylvain Defresne Committed by Commit Bot

Convert components/image_fetcher 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: I0a10526bd47c8c52b2cfc980bdc9d43e4883c18e
Reviewed-on: https://chromium-review.googlesource.com/1087061Reviewed-by: default avatarMarc Treib <treib@chromium.org>
Reviewed-by: default avatarOlivier Robin <olivierrobin@chromium.org>
Commit-Queue: Sylvain Defresne <sdefresne@chromium.org>
Cr-Commit-Position: refs/heads/master@{#564869}
parent 1988f91d
......@@ -4,7 +4,7 @@
#import "components/image_fetcher/ios/ios_image_data_fetcher_wrapper.h"
#import "base/mac/bind_objc_block.h"
#include "base/bind.h"
#include "base/task_scheduler/post_task.h"
#import "components/image_fetcher/ios/webp_decoder.h"
#include "net/http/http_response_headers.h"
......@@ -55,8 +55,8 @@ void IOSImageDataFetcherWrapper::SetDataUseServiceName(
ImageDataFetcher::ImageDataFetcherCallback
IOSImageDataFetcherWrapper::CallbackForImageDataFetcher(
IOSImageDataFetcherCallback callback) {
return base::BindBlockArc(^(const std::string& image_data,
const RequestMetadata& metadata) {
return base::BindRepeating(^(const std::string& image_data,
const RequestMetadata& metadata) {
// Create a NSData from the returned data and notify the callback.
NSData* data =
[NSData dataWithBytes:image_data.data() length:image_data.size()];
......@@ -75,10 +75,10 @@ IOSImageDataFetcherWrapper::CallbackForImageDataFetcher(
base::TaskPriority::BACKGROUND,
base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN,
},
base::BindBlockArc(^NSData*() {
base::BindOnce(^NSData*() {
return webp_transcode::WebpDecoder::DecodeWebpImage(data);
}),
base::BindBlockArc(^(NSData* decoded_data) {
base::BindOnce(^(NSData* decoded_data) {
callback(decoded_data, webp_metadata);
}));
});
......
......@@ -8,8 +8,8 @@
#include <memory>
#include "base/bind.h"
#include "base/callback.h"
#import "base/mac/bind_objc_block.h"
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
#include "base/task_scheduler/post_task.h"
......@@ -81,9 +81,9 @@ void IOSImageDecoderImpl::DecodeImage(const std::string& image_data,
}
base::PostTaskAndReplyWithResult(
task_runner_.get(), FROM_HERE, base::BindBlockArc(decodeBlock),
base::Bind(&IOSImageDecoderImpl::CreateUIImageAndRunCallback,
weak_factory_.GetWeakPtr(), callback));
task_runner_.get(), FROM_HERE, base::BindOnce(decodeBlock),
base::BindOnce(&IOSImageDecoderImpl::CreateUIImageAndRunCallback,
weak_factory_.GetWeakPtr(), callback));
}
void IOSImageDecoderImpl::CreateUIImageAndRunCallback(
......
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