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 ...
随机推荐
- php方法----将数组按照键值进行排序
将数组按照键值进行排序 array_multisort(array_column($arr,'first'),SORT_ASC,$arr);
- LeetCode Golang 7. 整数反转
7. 整数反转 给出一个 32 位的有符号整数,你需要将这个整数中每位上的数字进行反转. Tips : Math包给出的类型大小的边界: // Integer limit values. const ...
- ActiveMQ启动异常
启动报错信息:BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ...
- Oracle的分页查询及内联视图和函数处理
1.Oracle的分页常用方式: select * from(select * ,ROWNUM num from table where ROWNUM<=20 ) where num>0; ...
- 如何打开DOS控制台及常见DOS命令作用
如何打开DOS控制台? * A:xp下如何打开DOS控制台? * a:开始--程序--附件--命令提示符 * b:开始--运行--cmd--回车 * c:win+r--cmd- ...
- 路飞学城Python-Day49
55-善于使用父亲的padding,而不是margin 56-文本属性和字体属性 div{ width: 300px; height: 100px; border: 1px solid red; /* ...
- 【Python 学习】通过while循环和for循环猜测年龄
Python中可以通过while和for循环来限制猜测年龄的次数 1. 在猜测年龄的小程序中,不加循环的代码是这样的: age_of_yu = 23 guess_age = int(input(&qu ...
- Opencv 视频转为图像序列
本系列文章由 @YhL_Leo 出品,转载请注明出处. 文章链接: http://blog.csdn.net/yhl_leo/article/details/50283303 基于OpenCV的视频转 ...
- Nutch2 WebPage写入数据库的过程分析
版本: Nutch 2.2.1 本文通过InjectJob来追踪webpage的定义.创建.传递.序列化.写入数据库的整个过程.从源码中摘录了重要的代码行,并标明其所在文件名.行号. 1. 定义 sc ...
- java语言MySQL批处理
本质来讲就是使用Statement和PreStatement的addBatch()方法 代码 import java.sql.*; public class GetConnection{ public ...