SlideShare a Scribd company logo
1 of 144
NAS ENTRANHAS
DO WEBKIT
ZAEDY SAYÃO @zaedysayao
NAS ENTRANHAS
DO WEBKIT
ZAEDY SAYÃO @zaedysayao
V8
Zaedy Dantas Sayão
@zaedysayao
@javamanrj
@javamanrj
@WORKS
http://about.me/zaedy
BÁSICO
CONCEITO
O QUE É?
BROWSER
USER INTERFACE
BROWSER ENGINE
RENDER ENGINE
NETWORK
I/O
JAVASCRIPT
ENGINE
GRAPHICS
STACK
USER INTERFACE
BROWSER ENGINE
RENDER ENGINE
NETWORK
I/O
JAVASCRIPT
ENGINE
GRAPHICS
STACK
W
EBKIT
WEBKIT
NÃO É UM
BROWSER
WEBKIT
⊑
BROWSER
ENGINE
RENDER
ENGINE
ENGINE?
CONJUNTO
DE LIBS
CÓDIGO
FAZ O QUE?
C
Ó
D
I
G
O
42
C
Ó
D
I
G
O
PAINT
HTML
CSS
JS
SVG
LAYOUT
PAST
HISTÓRIA
2001
KHTML
2005
CONTRIBUTOR
COMMITER
REVIEWER
APPLE
ENVIA
CONTA SVN
ONDE
RODA?
EVERYWHERE
APPLE
GOOGLE
NOKIA
BLACKBERRY
IGALIA (GNOME)
GETTING
CODE
svn checkout https://svn.webkit.org/repository/webkit/trunk
git clone git://git.webkit.org/WebKit.git
1.2GB
80% TESTES
BUILD
WebKitTools/Scripts/build-webkit
--qt for Qt,
--gtk for Gtk+
--debug for “Debug” mode
RUN
WebKitTools/Scripts/run-launcher
--qt for Qt,
--gtk for Gtk+
--debug for “Debug” mode
DEMO
PORTS
SAFARI
IOS ≠WINDOWS
APPLE
PORT DO
COREFOUNDATION
PARA O WINDOWS
CHROME
CHROMIUM
ANDROID
QTWEBKIT
WEBKITGTK+
WEBKIT
NIGHTLY
MAC PORT -> SAFARI
INTERFACE
IMPLEMENTAÇÃO
<input type=”number” />
WebKit
ursday, November 3, 2011
<input type=”number”/>
PINTA
PARA MIM
input type=”number” />
EU SEI FAZER!
WEBKIT
PORT
<input type=”number” />
WebKit
ursday, November 3, 2011
<input type=”number”/>
WEBKIT
123
AQUI
<input type=”number”/>
input type=”number” />
PORT
123
BLZ!
WEBKIT SABE
COMO
DESENHAR
RESPONSABILIDADE
É DO PORT
(COREGRAPHICS)
QTWEBKIT
QNETWORKACESSMANAGER
KDEWEBKIT
KDE NETWORK LAYER
NETWORK
INTERFACE
NADA DE HTTP, SSL...
MAS TEM CHAMADAS PARA
ENVIO DE DADOS
IMPLEMENTAÇÃO
LIB DO SISTEMA
SE QUISER FAZER
UM PORT?
IMPLEMENTE AS
INTERFACES
SE NÃO
IMPLEMENTAR?
fillRoundedRect()
BOTÃO
QUADRADO
SE WEBKIT
->
MENOS UM
BROWSER PARA
TESTAR
NOVA FEATURE
->
DISPONÍVEL EM
TODO PORT
WEBKIT
TAMBÉM É UMA
API
WEBKIT2
MULTI-PROCESS
JAVASCRIPTCORE
ENGINE
WEBCORE
CSS, HTML, DOM,
RENDER
WTF
WEB TEMPLATE
FRAMEWORK
PROPÓSITOS
WEBCORE
LOADING
PARSING
LAYOUT
PAINT
HTML EDITING
JS BINDINGS
LOADING
PEGANDO DADOS
COMPLICADO!!!
WEBKIT
WEBCORE
WEBCORE/LOADER
WEBCORE/PLATFORM/NETWORK
FRAMELOADERCLIENT
2 PASSOS
FRAMES E RESOURCES
LOADING A
FRAME
CLASSE FRAMELOADER
1)POLICY STAGE
BLOCK POP-UP
CROSS-PROCESS NAVIGATION
2)PROVISIONAL
STAGE
DOWNLOAD OU COMMIT
EX: LINK
3)COMMITED
STAGE
START PARSING
LOADING
SUBRESOURCES
DOCLOADER
CACHE
DOCLOADER
PEGA UMA URL
VERIFICA NO CACHE OU
LOADER
RETORNA UM
CACHEDRESOURCE
CACHEDRESOURCE
RESPONDE CALLBACK
PRODUZ UM OBJETO
(IMAGEM, FONTE...)
PARSING
HTML x XML
HTMLTOKENIZER E HTMLPARSER
XMLTOKENIZER
OUTRAS TASKS:
PRE-LOAD SCANNING
(CARREGAMENTO DE CSS ANTES
DO PARSE)
DOM TREE
RENDEROBJECT TREE
RENDERSTYLE TREE
RENDERLAYER TREE
LINEBOX TREE
LOADING -> SOURCE
PARSING -> DOM TREE
attach() -> RENDEROBJECT TREE
STYLE RESOLUTION -> RENDERSTYLE
TREE
LAYOUT -> RENDERLAYER TREE
LINEBOX TREE
DOM TREE
<html>
<head>
<title>
foo
</title>
<head>
HTMLDocument
HTMLHTMLELement
HTMLHeadElement
HTMLTitleElement
Text(“foo”)
RENDER TREE
LAYOUT
PAINTING
HIT TESTING
RENDER TREE
RENDEROBJECTS
RENDERSTYLE
RENDERLAYERS
INLINEBOXES
RENDEROBJECT
class RenderObject {
virtual void layout() = 0;
virtual void paint(PaintInfo) = 0;
virtual IntRect repaintRect() = 0;
Node* node();
RenderStyle* style() const;
RenderLayer* containingLayer();
}
RENDEROBJECT
RenderBlock(<div>, <p>)
RenderInline(<span>, <b>, <i>)
RenderImage(<image>)
RenderText(#text)
RenderTableCell (<td>)
OBJETOS DA
ENGINE JSString
Array
Number
Prototypes
.__proto__
.callee
__defineGetter__
.toString()
ABERTAS
FECHADAS
SPIDER MONKEY
JAVASCRIPTCORE (JSC, NITRO)
V8
V8
PARSER RUNTIME
INTERPRETER
PARSER
TOKENIZE
var answer = 42;
TOKENIZE
var answer = 42;
keyword identifier
sinal igual
número
vírgula
TOKENIZER
NOV8
src/scanner.*
KEYWORD
X
IDENTIFIER
instanceof - instanceComponent
A G H J K L M O P Q XY Z
GRAMÁTICA
SouceElement :: (Statement)*
FunctionDeclaration ::
‘function’ Identifier ‘(‘FormalParameters’)’	

‘{‘FunctionBody’}’
SYNTAX TREE
IDENTIFIER LITERAL
CONSTANT
VARIABLE
DECLARATION
answer 42
CONSEQUÊNCIA
ALTERNATIVA
BRANCH
VELHO
NOVO
CONDIÇÃO
idade > 60
PARSER NOV8
src/parser.*
CODE TRACE
(EVAL)
SCRIPT :: COMPILE
SCRIPT :: NEW
INTERNAL :: COMPILER :: COMPILE
INTERNAL :: MAKEFUNCIONINFO
INTERNAL :: PARSEAPI :: PARSE
DEMO
INTERPRETER
var answer = 42;
Declare um objeto local
Chame esse objeto de “answer”
Crie um número 42
De “assign” do número ao objeto
IDENTIFIER LITERAL
CONSTANT
VARIABLE
DECLARATION
answer 42
VELOCIDADE
BYTECODE
SERIALIZA EM UMA
LISTA DE “AÇÕES”
COMPILA O
BYTECODE
PARA ASSEMBLY
JIT (=JUST-IN-TIME) COMPILE
shell --print-code
shell --expose-debug-as deb
deb.Debug.disassemble(f)
LAZY
foobar = function(x, y, z)
{
...
}
foobar(x, y, z);
Analiza sintaxe
Guarda posição da função
foobar = function(x, y, z, run)
{
...
}
foobar(x, y, z, false);
HACK
Compila e roda
Date.now()
código
nativo
código
JavaScript
BRIDGE
C++
Primitive
Date
Object
Array
Function
External
Handle<FunctionTemplate> systemObject = FunctionTemplate::New();
systemObject->Set(String::New(“exit”)),
FunctionTemplate::New(system_exit)->GetFunction());
static Handle<value> system_exit(const Arguments& args)
{
int status = args[0]->Int32Value();
::exit(status);
return Undefined();
}
EXPONDO
FUNÇÃO
JSLINT
JSBEAUTIFY
OBRIGADO!
@zaedysayao

More Related Content

Similar to Nas entranhas do WebKit (e V8) - SampaJS 3.1 - 2013

Intro to MVC 3 for Government Developers
Intro to MVC 3 for Government DevelopersIntro to MVC 3 for Government Developers
Intro to MVC 3 for Government Developers
Frank La Vigne
 
Why Node.js
Why Node.jsWhy Node.js
Why Node.js
guileen
 

Similar to Nas entranhas do WebKit (e V8) - SampaJS 3.1 - 2013 (20)

前端概述
前端概述前端概述
前端概述
 
Familiar HTML5 - 事例とサンプルコードから学ぶ 身近で普通に使わているHTML5
Familiar HTML5 - 事例とサンプルコードから学ぶ 身近で普通に使わているHTML5Familiar HTML5 - 事例とサンプルコードから学ぶ 身近で普通に使わているHTML5
Familiar HTML5 - 事例とサンプルコードから学ぶ 身近で普通に使わているHTML5
 
I Can't Believe It's Not Flash
I Can't Believe It's Not FlashI Can't Believe It's Not Flash
I Can't Believe It's Not Flash
 
Open Source Ajax Solution @OSDC.tw 2009
Open Source Ajax  Solution @OSDC.tw 2009Open Source Ajax  Solution @OSDC.tw 2009
Open Source Ajax Solution @OSDC.tw 2009
 
php
phpphp
php
 
HTML5 - A Whirlwind tour
HTML5 - A Whirlwind tourHTML5 - A Whirlwind tour
HTML5 - A Whirlwind tour
 
Journey to JavaScript (from C#)
Journey to JavaScript (from C#)Journey to JavaScript (from C#)
Journey to JavaScript (from C#)
 
Minimalism in Web Development
Minimalism in Web DevelopmentMinimalism in Web Development
Minimalism in Web Development
 
當ZK遇見Front-End
當ZK遇見Front-End當ZK遇見Front-End
當ZK遇見Front-End
 
Modular Web Applications With Netzke
Modular Web Applications With NetzkeModular Web Applications With Netzke
Modular Web Applications With Netzke
 
HTML5 - Chances and Pitfalls (Bytro Labs GmbH)
HTML5 - Chances and Pitfalls (Bytro Labs GmbH)HTML5 - Chances and Pitfalls (Bytro Labs GmbH)
HTML5 - Chances and Pitfalls (Bytro Labs GmbH)
 
Ruby on Rails 3.1: Let's bring the fun back into web programing
Ruby on Rails 3.1: Let's bring the fun back into web programingRuby on Rails 3.1: Let's bring the fun back into web programing
Ruby on Rails 3.1: Let's bring the fun back into web programing
 
Razor and the Art of Templating
Razor and the Art of TemplatingRazor and the Art of Templating
Razor and the Art of Templating
 
Webové aplikace v JavaScriptu
Webové aplikace v JavaScriptuWebové aplikace v JavaScriptu
Webové aplikace v JavaScriptu
 
BDD - Buzzword Driven Development - Build the next cool app for fun and for.....
BDD - Buzzword Driven Development - Build the next cool app for fun and for.....BDD - Buzzword Driven Development - Build the next cool app for fun and for.....
BDD - Buzzword Driven Development - Build the next cool app for fun and for.....
 
BDD - Buzzword Driven Development - Build the next cool app for fun and for.....
BDD - Buzzword Driven Development - Build the next cool app for fun and for.....BDD - Buzzword Driven Development - Build the next cool app for fun and for.....
BDD - Buzzword Driven Development - Build the next cool app for fun and for.....
 
Intro to MVC 3 for Government Developers
Intro to MVC 3 for Government DevelopersIntro to MVC 3 for Government Developers
Intro to MVC 3 for Government Developers
 
HTML5 and Other Modern Browser Game Tech
HTML5 and Other Modern Browser Game TechHTML5 and Other Modern Browser Game Tech
HTML5 and Other Modern Browser Game Tech
 
Why Nodejs Guilin Shanghai
Why Nodejs Guilin ShanghaiWhy Nodejs Guilin Shanghai
Why Nodejs Guilin Shanghai
 
Why Node.js
Why Node.jsWhy Node.js
Why Node.js
 

Recently uploaded

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 

Recently uploaded (20)

Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 

Nas entranhas do WebKit (e V8) - SampaJS 3.1 - 2013