Calling Mojo from Blink
Variants
module example.mojom;
interface Foo {
SendData(string param1, array<int32> param2);
};
mojom("example") {
sources = [ "example.mojom" ]
use_new_wrapper_types = true
}
class Example {
virtual void SendArray(const std::string& param1, const std::vector<int32_t>& param2) = 0;
}
class Example {
virtual void SendArray(const WTF::String& param1, const WTF::Vector<int32_t>& param2) = 0;
}
#include "wtf/Functional.h"
void MyObject::ReverseString(const String& string)
{
m_service->ReverseString(
string,
ConvertToBaseCallback(WTF::Bind(&MyObject::onStringReversed, wrapPersistent(this))));
}
// m_service is a member of MyObject. This code should be run as soon as m_foo is bound to a message pipe.
m_service.set_connection_error_handler(
ConvertToBaseCallback(WTF::Bind(&MyObject::OnConnectionError,
wrapWeakPersistent(this))));
void MyObject::OnConnectionError()
{
m_service.reset();
}
// MyObject.h
class MyObject : public GarbageCollected
, public example::blink::Example
{
USING_PRE_FINALIZER(MyObject, dispose);
public:
MyObject();
void dispose();
// Implementation of example::blink::Example.
private:
mojo::Binding<example::blink::Example> m_binding;
};
// MyObject.cpp
MyObject::MyObject() : m_binding(this)
{
ThreadState::current()->registerPreFinalizer(this);
}
void MyObject::dispose()
{
m_binding.Close();
}
Calling Mojo from Blink的更多相关文章
- [Chromium文档转载,第005章]Calling Mojo from Blink
For Developers > Design Documents > Mojo > Calling Mojo from Blink Variants Let's as ...
- Mojo C++ Bindings API
This document is a subset of the Mojo documentation. Contents Overview Getting Started Interfaces Ba ...
- [Chromium文档转载,第002章]Mojo C++ Bindings API
Mojo C++ Bindings API This document is a subset of the Mojo documentation. Contents Overview Getting ...
- Deno下一代Nodejs?Deno初体验
前言 Ryan Dahl之父发布了新的项目Deno,很多IT媒体都使用了标题“下一代Nodejs”,首先我们看一下Deno的特性: 1.支持typescript (nodejs目前也支持). 2.无p ...
- Converting Legacy Chrome IPC To Mojo
Converting Legacy Chrome IPC To Mojo Looking for Mojo Documentation? Contents Overview Deciding What ...
- [Chromium文档转载,第006章]Chrome IPC To Mojo IPC Cheat Sheet
For Developers > Design Documents > Mojo > Chrome IPC To Mojo IPC Cheat Sheet 目录 1 O ...
- [Chromium文档转载,第001章] Mojo Migration Guide
For Developers > Design Documents > Mojo > Mojo Migration Guide 目录 1 Summary 2 H ...
- Mojo C++ System API
This document is a subset of the Mojo documentation. Contents Overview Scoped, Typed Handles Message ...
- Mojo Associated Interfaces
Mojo Associated Interfaces yzshen@chromium.org 02/22/2017 Background Before associated interfaces ar ...
随机推荐
- Axios 网络请求组件封装 (鉴权、刷新、拦截)
一.前言 注意:本教程需要你对axios有一定的了解,不适用于小白(只能借鉴,希望你能自己动手),注释都写的很清楚.此封装并非完整版,已进行部分删减修改操作,但仍然适用于大部分业务场景,如果不适用于你 ...
- CentOS 5/6 下添加epel源
如果既想获得 RHEL 的高质量.高性能.高可靠性,又需要方便易用(关键是免费)的软件包更新功能,那么 Fedora Project 推出的 EPEL(Extra Packages for Enter ...
- python 一句话输出26个英文字母
chr(i) # return i character ord(c) # return integer >>> [chr(i) for i in range(97,123)] ['a ...
- MySQL监控SQL及命中率脚本
[root@hank-yoon scrips]# vi mysqlstat.sh/export/servers/mysql/bin/mysqladmin -P3306 -uyoon -pyoon ...
- golang vue nginx
https://segmentfault.com/a/1190000012780963 https://blog.csdn.net/qq_32340877/article/details/790321 ...
- php基础-------preg_replace()与preg_replace_callback()
1.preg_replace() 执行一个正则表达式的搜索和替换. 语法: mixed preg_replace ( mixed $pattern , mixed $replacement , mix ...
- thinkphp5 模板中截取中文字符串
TP5模板页截取中文字符串 {$vo.task_detail|mb_substr=###,0,15,'utf-8'}
- ZBrush中如何清除画布中多余图像
ZBrush是一款数字雕刻与绘画软件,它以强大的功能和直观的工作流程彻底改变了整个三维行业.它的简洁化.智能化和人性化的设计无不让众多用户所折服.刚接触它的用户可能会因为找不到相关命令或不熟悉而觉得它 ...
- Python介绍与学习
Python是一种面向对象的解释型计算机程序设计语言,由荷兰人Guido van Rossum于1989年发明,第一个公开发行版发行于1991年. Python是纯粹的自由软件, 源代码和解释器CPy ...
- 记一次mybatis<if>标签的问题
前言 到底还是没理解清楚的锅~~~~搞了好久...啊啊啊啊 错误: There is no getter for property named 'name' in 'class java.lang.L ...