Date post: | 25-May-2015 |
Category: |
Technology |
Upload: | makoto-kato |
View: | 474 times |
Download: | 1 times |
e10s@makoto_kato
Agenda
• Electrolysis (e10s) ?
• Firefox OS
• Firefox / Gecko
e10s
• Firefox Out-Of-Process Plugin• Firefox 3.6
• Firefox DRM/CDM (Content Decryption Module)• Firefox 3x ?
• Firefox Chrome Content
• (Nightly)
• Firefox OS
Firefox OS
• b2g
• plugin-container
•
• APIb2g
Kernel / Gonk
b2g process
Plugin-containerprocess
(Apps)
Plugin-container process
(Apps)
Hardware Access
IPC
IPC
(IPC)
• Chromium IPC
• IPC IPDL• IDL
IPDL
• IDL
•
• IPDL
•
•
ipdl
hal/sandbox/PHal.idl
sync protocol PHal {
…
child:
NotifyBatteryChange(
BatteryInformation aBatteryInfo);
…
parent:
Vibrate(uint32_t[] pattern, uint64_t[] id,
PBrowser browser);
}
( )
@OBJDIR@/ipc/ipdl/_ipdlheaders/mozilla/hal_sandbox/PHal.h
class Msg_NotifyBatteryChange :
public IPC::Message
…
}
( )
@OBJDIR@/ipc/ipdl/_ipdlheaders/mozilla/hal_sandbox/PHalChild.h
class /*NS_ABSTRACT_CLASS*/ PHalParent :
public mozilla::ipc::IProtocol,
protected mozilla::ipc::IProtocolManager<mozilla::ipc::IProtocol>
{
…
virtual bool
RecvVibrate(
const nsTArray<uint32_t>& pattern,
const nsTArray<uint64_t>& id,
PBrowserParent* browser) = 0;
…
bool
SendNotifyBatteryChange(const BatteryInformation& aBatteryInfo) NS_WARN_UNUSED_RESULT;
( )
@OBJDIR@/ipc/ipdl/_ipdlheaders/mozilla/hal_sandbox/PHalChild.h
class /*NS_ABSTRACT_CLASS*/ PHalChild :
public mozilla::ipc::IProtocol,
protected mozilla::ipc::IProtocolManager<mozilla::ipc::IProtocol>
{
…
virtual bool
RecvNotifyBatteryChange(const BatteryInformation& aBatteryInfo) = 0;
…
bool
SendVibrate(
const nsTArray<uint32_t>& pattern,
const nsTArray<uint64_t>& id,
PBrowserChild* browser);
template<>struct ParamTraits<mozilla::WidgetGUIEvent>{typedef mozilla::WidgetGUIEvent paramType;
static void Write(Message* aMsg, const paramType& aParam){WriteParam(aMsg, static_cast<mozilla::WidgetEvent>(aParam));WriteParam(aMsg, aParam.mPluginEvent.mBuffer);
}
static bool Read(const Message* aMsg, void** aIter,paramType* aResult)
{return ReadParam(aMsg, aIter,
static_cast<mozilla::WidgetEvent*>(aResult)) &&ReadParam(aMsg, aIter, &aResult->mPluginEvent.mBuffer);
}
IPC
• B2g (Chrome ) (Content )
• b2g
• XMLHttpRequsest
• WebSocket
• Socket (TCP/UDP)
• Web Activity
• Inter App Communication
XMLHttpRequest / WebSocket
•
XMLHttpRequest / WebSocket
•
• HTTP
• Firefox OS Daemon ProcessDaemon Process• DRM
• Localhost Network Activity
Socket API
• TCP or UDP Socket
•
•
TCP Socket ( )
var socket = new navigator.mozTCPSocket.open(
‘127.0.0.1’, 8888, { binaryType: ‘string’ } );
socket.onopen = function() {
};
socket.ondata = function(msg) {
//
};
…
socket.send(‘hello’);
TCP Server Socket
var socket = navigator.mozTCPSocket.listen(8888, { binaryType : ‘string’ });
Socket.onconnect = function() {
//
}
…
UDP Socket
var socket = new UDPSocket();
socket.addEventListener(‘message’, function() {
//
})
socket.send(‘hello’, ‘127.0.0.1’, 8888);
Web Activity
• Web Intent API (Google Chrome) Firefox OS Counter
Proposal
“Web Activities' intent is not to be a clone of Google's Web Intents with some naming and API details changed. Web Activities aim to be a simple API trying to solve a very clear set of use cases.”
http://lists.w3.org/Archives/Public/public-web-intents/2012Jun/0061.html
• MozActivity
var activity = new MozActivity( {
name: “pick”,
data: {
type: “image/jpeg”
}
});
activity.onsuccess = function() {
// this.result
}
••
•
{
“name”: ‘<Application Name>’,
“description”: ‘<Application’s description>’,
“activities”: {
“view” : {
“filters”: {
“type” : “image/tiff”
}
}
}
}
var register = navigator.mozRegisterActivityHandler({
name: “view”,
disposition: “inline”,
filters: {
type: “image/tiff”;
}
}
navigator.mozSetMessageHandler(‘activity’, function(request) {
//
request.postRequest(…);
}
Web Activity
•• 1:n
•
Inter-App Communication (IAC)
• Firefox OS 1.2+
• Certified App only
• Web Activity
•
• – Publisher•
• - Subscriber
“connections” {
“<keyword>” : {
“handler_path”: “/index.html”,
“description”: “description”,
“rules” : {
“manifestURLs”: “<url>”,
…
}
}
}
navigator.mozApps.getSelf().onsuccess = function(ev) {
var app = ev.target.result;
app.connet(‘<keyword>’, rules).then(function(ports) {
// connected
ports.forEach(function(port) {
port.onmessage = function(evt) {
// received data
});
port.postMessage({ value: ‘hello’ });
}
}, function(reason) {
// reject
});
};
navigator.mozSetMessageHandler(‘connection’,
function(request) {
var keyword = request.keyword;
var port = request.port;
port.onmessage = function(evt) {
var message = evt.data;
port.postMessage({ value: “Hello” });
}
});
Inter App Communication
• Certified App
• Certified
• 1:1
• e10s Gecko• Gecko
• Firefox OS (Web Activity / Inter-App Communication) e10s
• API Network Activity
• Gecko• XMLHttpRequest / WebSocket / Socket
API
References
• mozTCPSocket• https://developer.mozilla.org/en-
US/docs/Web/API/Navigator.mozTCPSocket
• Web Activities• https://developer.mozilla.org/en-
US/docs/Web/API/Web_Activities
• Inter App Communication• https://wiki.mozilla.org/WebAPI/Inter_App_Communic
ation
• https://bugzilla.mozilla.org/show_bug.cgi?id=907068