Commit 260cde16 authored by Julie Jeongeun Kim's avatar Julie Jeongeun Kim Committed by Commit Bot

Convert Hyphenation to new Mojo types

This CL converts HyphenationRequest and HyphenationPtr to
new Mojo types.

Bug: 955171, 978694
Change-Id: I3be08953612cc01ea30d1f2ed65ea971df263b9f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1778898
Commit-Queue: Dave Tapuska <dtapuska@chromium.org>
Reviewed-by: default avatarEmil A Eklund <eae@chromium.org>
Reviewed-by: default avatarDave Tapuska <dtapuska@chromium.org>
Cr-Commit-Position: refs/heads/master@{#693134}
parent 0b98e5cc
......@@ -15,7 +15,7 @@
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "base/task/post_task.h"
#include "mojo/public/cpp/bindings/strong_binding.h"
#include "mojo/public/cpp/bindings/self_owned_receiver.h"
namespace {
......@@ -58,9 +58,10 @@ HyphenationImpl::HyphenationImpl() {}
HyphenationImpl::~HyphenationImpl() {}
// static
void HyphenationImpl::Create(blink::mojom::HyphenationRequest request) {
mojo::MakeStrongBinding(std::make_unique<HyphenationImpl>(),
std::move(request));
void HyphenationImpl::Create(
mojo::PendingReceiver<blink::mojom::Hyphenation> receiver) {
mojo::MakeSelfOwnedReceiver(std::make_unique<HyphenationImpl>(),
std::move(receiver));
}
// static
......
......@@ -7,7 +7,7 @@
#include "base/macros.h"
#include "base/sequenced_task_runner.h"
#include "mojo/public/cpp/bindings/interface_request.h"
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "third_party/blink/public/mojom/hyphenation/hyphenation.mojom.h"
namespace hyphenation {
......@@ -17,7 +17,7 @@ class HyphenationImpl : public blink::mojom::Hyphenation {
HyphenationImpl();
~HyphenationImpl() override;
static void Create(blink::mojom::HyphenationRequest);
static void Create(mojo::PendingReceiver<blink::mojom::Hyphenation>);
static scoped_refptr<base::SequencedTaskRunner> GetTaskRunner();
......
......@@ -11,6 +11,7 @@
#include "base/files/memory_mapped_file.h"
#include "base/memory/ptr_util.h"
#include "base/metrics/histogram_macros.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "third_party/blink/public/mojom/hyphenation/hyphenation.mojom-blink.h"
#include "third_party/blink/public/platform/interface_provider.h"
#include "third_party/blink/public/platform/platform.h"
......@@ -48,21 +49,21 @@ StringView SkipLeadingSpaces(const StringView& text,
using Hyphenator = android::Hyphenator;
static mojom::blink::HyphenationPtr ConnectToRemoteService() {
mojom::blink::HyphenationPtr service;
static mojo::Remote<mojom::blink::Hyphenation> ConnectToRemoteService() {
mojo::Remote<mojom::blink::Hyphenation> service;
Platform::Current()->GetInterfaceProvider()->GetInterface(
mojo::MakeRequest(&service));
service.BindNewPipeAndPassReceiver());
return service;
}
static const mojom::blink::HyphenationPtr& GetService() {
DEFINE_STATIC_LOCAL(mojom::blink::HyphenationPtr, service,
static mojom::blink::Hyphenation* GetService() {
DEFINE_STATIC_LOCAL(mojo::Remote<mojom::blink::Hyphenation>, service,
(ConnectToRemoteService()));
return service;
return service.get();
}
bool HyphenationMinikin::OpenDictionary(const AtomicString& locale) {
const mojom::blink::HyphenationPtr& service = GetService();
mojom::blink::Hyphenation* service = GetService();
base::File file;
service->OpenDictionary(locale, &file);
return OpenDictionary(std::move(file));
......
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