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 ...
随机推荐
- 『转』Writing Well
这是前辈Julie Zhuo的最新关于写作的文章,昨天写下-进行总结和阅读思考 这是一篇关于提笔写作的文章,首发在The looking glass...前辈每周都会回答一个读者的问题耶--This ...
- Thingworx 使用REST API获取JSON数据
版本:7.4.1 1.URL规则 http://localhost/Thingworx/Things/[Things名称]/Services/[Service名称]?method=POST&A ...
- 蓝桥杯_left and throw
思考了许久没有结果,最后,还是一位擅长搜索资源的学长帮我找到了一个不错的代码,这个代码极其精妙,再一次印证了一句话,没有做不到的,只有想不到的,当然这个代码我拿到手的时候是个没有注释的代码,我费尽周折 ...
- html+css居中问题
一.行级元素水平居中对齐(父元素设置 text-align:center) <div style="width: 200px; height: 100px;border: 1px so ...
- Cookie和Session有什么区别
1. 由于HTTP协议是无状态的协议,所以服务端需要记录用户的状态时,就需要用某种机制来识别具体的用户,这个机制就是Session. 典型的场景比如购物车,当你点击下单按钮时,由于HTTP协议无状 ...
- echarts图表属性说明
参考博客: https://blog.csdn.net/luanpeng825485697/article/details/76691965
- django-2-路由配置及渲染方式
<<<视图>>> (1)首先要注册创建好的app (2)配置路由 在app目录下新建一个urls.py模块 模块里面复制myproject目录下urls.py里面的 ...
- CSS隐藏overflow默认滚动条同时保留滚动效果
主要应用于移动端场景,仿移动端滚动效果.对于隐藏滚动条,众所周知overflow:hidden,但是想要的滚动效果也没了. 所以对于移动端webkit内核提供一个伪类选择器: .element::-w ...
- phpexcel乱码问题
php导出Excel乱码,只需在header函数前加入ob_end_clean();//清除缓冲区,避免乱码
- spring-boot-maven-plugin 插件的作用(转)
OM 文件中添加了“org.springframework.boot:spring-boot-maven-plugin”插件.在添加了该插件之后,当运行“mvn package”进行打包时,会打包成一 ...