SlideShare une entreprise Scribd logo
1  sur  15
Native Client

http://code.google.com/p/nativeclient/
Native Client

• open source technology
• running native compiled code in the browser
• maintaining the OS portability and safety
• expands web programming beyond JavaScript
• tied to a specific CPU architecture
•os independent, but not processor independent
• run close to native speed
• multithreaded/multicore
• low-latency audio
• combined with low-level access to networking
  APIs and OpenGL ES
• fit for running a physics engine or artificial
  intelligence module
• Reduce the encoding and decoding data in
  proprietary formats
• sandboxed environment proxies system calls
Native Client module execution




prevents the following unsafe activities:
Manipulating devices or files directly (instead, a special file system API is provided)
Directly accessing the operating system
Using self-modifying code to hide the code's intent (such as attempts to write to
protected memory)
Native Client SDK


  The Native Client SDK includes the following:
  GNU-based toolchain: gcc, as, ld, gdb, and other tools
  API libraries (Pepper, POSIX)
  SCons build scripts and configuration files for building Native Client applications



  The Pepper Plug-in API (PPAPI), a library is written in C, and the SDK also
  provides a set of C++ bindings for it. Native Client modules use the Pepper API
  to communicate with JavaScript and resources managed by the browser. The
  Pepper Library also provides a platform-independent multimedia API that
  Native Client modules can use for audio, video, and 2D graphics (support for 3D
  graphics is coming soon).
Program structure
                    HTML/JavaScript application:
                    •   Provides the user interface and event handling



                    Pepper bridge:
                    •   send messages between JavaScript code and
                        the Native Client module.
                    •   provides interfaces allow NaCl modules to
                        create/use browser resources.


                    Native Client module:
                    • performs numerical computation and other
                      compute-intensive tasks.
                    • Handles large-scale data manipulation.
                    • provides event handling APIs for apps
HTML file


<embed name="nacl_module"
    id="hello_world"
    width=0
    height=0
    src="hello_world.nmf"
    type="application/x-nacl" />
Creating a Native Client web app


     C++ Tutorial: Getting Started
The HTML web page (*.html).

A Native Client module(*.nexe):
written in C or C++. Native Client modules uses the Pepper API, as a bridge between
the browser and the modules.

A manifest file (*.nmf):
 that is used by the browser to determine which compiled Native Client module to
load for a given end-user instruction set ("x86-64" or "x86-32").



Communication between JavaScript and a Native Client module
Communication between JavaScript code in the browser and C++ code in a
Native Client module is two-way:

the browser can send messages to the Native Client module.
The Native Client module can respond to the message from JavaScript, or it can
initiate its own message to JavaScript.


   the communication is asynchronous.
Step 1: install the Native Client SDK and Python.

Step 3: Start a local server.

Step 4: Set up Chrome and verify that Native Client is working.

Step 5: Create a set of template files for your project.


       the directory of the project with the following files:
       •build.scons
       •hello_tutorial.html
       •hello_tutorial.cc
       •scons



•Scons, a driver script that runs the SCons tool to build your application
•build.scons, the build instructions for your application
Step 6: Modify the web page to load and communicate with the Native Client module.


  <embed name="nacl_module"
           id="hello_tutorial"
           width=0 height=0
           src="hello_tutorial.nmf"
           type="application/x-nacl" />


  function moduleDidLoad() {
           HelloTutorialModule = document.getElementById('hello_tutorial');
           HelloTutorialModule.addEventListener('message', handleMessage, false);
           updateStatus('SUCCESS'); //Send a message to the NaCl module.
           HelloTutorialModule.postMessage('hello');
  }
Step 7: Implement a message handler in the Native Client module.


•Implement the HandleMessage() function for the module instance
     (pp::Instance.HandleMessage, in the Pepper Library)

•Use the PostMessage() function to send a message to JavaScript.
    (pp::Instance.PostMessage, in the Pepper Library)


namespace {
         // The expected string sent by the browser.
         const char* const kHelloString = "hello";
         // The string sent back to the browser upon receipt of a message
         // containing "hello".
         const char* const kReplyString = "hello from NaCl";
} // namespace
virtual void HandleMessage(const pp::Var& var_message) {
        if (!var_message.is_string())
                 return;
        std::string message = var_message.AsString();
        pp::Var var_reply;
        if (message == kHelloString) {
                 var_reply = pp::Var(kReplyString);
                 PostMessage(var_reply);
        }
}
Step 8: Compile the Native Client module.

be sure you are still in the project directory.
run the scons script (orscons.bat on Windows).

cd examples/hello_tutorial ./scons


•hello_tutorial_x86_32.nexe
•hello_tutorial_x86_32_dbg.nexe
•hello_tutorial_x86_64.nexe
•hello_tutorial_x86_64_dbg.nexe
•hello_tutorial.nmf

    {
          "program": {
               "x86-64": {"url":"hello_tutorial_x86_64.nexe"},
              "x86-32": {"url": "hello_tutorial_x86_32.nexe"}
          }
     }
Thanks

Contenu connexe

Tendances

Asynkron programmering i Visual Studio 11
Asynkron programmering i Visual Studio 11Asynkron programmering i Visual Studio 11
Asynkron programmering i Visual Studio 11MortenWennevik
 
Multiple django applications on a single server with nginx
Multiple django applications on a single server with nginxMultiple django applications on a single server with nginx
Multiple django applications on a single server with nginxroskakori
 
Laravel Poznań Meetup #12 - "Speed up web API with Laravel and Swoole using ...
 Laravel Poznań Meetup #12 - "Speed up web API with Laravel and Swoole using ... Laravel Poznań Meetup #12 - "Speed up web API with Laravel and Swoole using ...
Laravel Poznań Meetup #12 - "Speed up web API with Laravel and Swoole using ...HighSolutions Sp. z o.o.
 
Short introduction - .net core and .net standard 2.0
Short introduction - .net core and .net standard 2.0Short introduction - .net core and .net standard 2.0
Short introduction - .net core and .net standard 2.0Mark Lechtermann
 
Integrating Node.js with PHP
Integrating Node.js with PHPIntegrating Node.js with PHP
Integrating Node.js with PHPLee Boynton
 
Code quality par Simone Civetta
Code quality par Simone CivettaCode quality par Simone Civetta
Code quality par Simone CivettaCocoaHeads France
 
Node.js Web Apps @ ebay scale
Node.js Web Apps @ ebay scaleNode.js Web Apps @ ebay scale
Node.js Web Apps @ ebay scaleDmytro Semenov
 
CubeJS: eBay’s Node.js Adoption Journey
CubeJS: eBay’s Node.js Adoption JourneyCubeJS: eBay’s Node.js Adoption Journey
CubeJS: eBay’s Node.js Adoption JourneyPatrick Steele-Idem
 
Testing cloud and kubernetes applications - ElasTest
Testing cloud and kubernetes applications - ElasTestTesting cloud and kubernetes applications - ElasTest
Testing cloud and kubernetes applications - ElasTestMicael Gallego
 
Livecode widget course
Livecode widget courseLivecode widget course
Livecode widget coursecrazyaxe
 
Microsoft 2014 Dev Plataform - Roslyn -& ASP.NET vNext
Microsoft 2014 Dev Plataform -  Roslyn -& ASP.NET vNextMicrosoft 2014 Dev Plataform -  Roslyn -& ASP.NET vNext
Microsoft 2014 Dev Plataform - Roslyn -& ASP.NET vNextRodolfo Finochietti
 
An Introduction of Node Package Manager (NPM)
An Introduction of Node Package Manager (NPM)An Introduction of Node Package Manager (NPM)
An Introduction of Node Package Manager (NPM)iFour Technolab Pvt. Ltd.
 
Web Applications with Eclipse RT and Docker in the Cloud
Web Applications with Eclipse RT and Docker in the CloudWeb Applications with Eclipse RT and Docker in the Cloud
Web Applications with Eclipse RT and Docker in the CloudMarkus Knauer
 
Java concurrency
Java concurrencyJava concurrency
Java concurrencyfbenault
 
Developing Rich Internet Applications with Perl and JavaScript
Developing Rich Internet Applications with Perl and JavaScriptDeveloping Rich Internet Applications with Perl and JavaScript
Developing Rich Internet Applications with Perl and JavaScriptnohuhu
 
A Whirldwind Tour of ASP.NET 5
A Whirldwind Tour of ASP.NET 5A Whirldwind Tour of ASP.NET 5
A Whirldwind Tour of ASP.NET 5Steven Smith
 

Tendances (20)

Asynkron programmering i Visual Studio 11
Asynkron programmering i Visual Studio 11Asynkron programmering i Visual Studio 11
Asynkron programmering i Visual Studio 11
 
PHP and node.js Together
PHP and node.js TogetherPHP and node.js Together
PHP and node.js Together
 
Whats new in .net core 3
Whats new in .net core 3Whats new in .net core 3
Whats new in .net core 3
 
Multiple django applications on a single server with nginx
Multiple django applications on a single server with nginxMultiple django applications on a single server with nginx
Multiple django applications on a single server with nginx
 
Laravel Poznań Meetup #12 - "Speed up web API with Laravel and Swoole using ...
 Laravel Poznań Meetup #12 - "Speed up web API with Laravel and Swoole using ... Laravel Poznań Meetup #12 - "Speed up web API with Laravel and Swoole using ...
Laravel Poznań Meetup #12 - "Speed up web API with Laravel and Swoole using ...
 
Short introduction - .net core and .net standard 2.0
Short introduction - .net core and .net standard 2.0Short introduction - .net core and .net standard 2.0
Short introduction - .net core and .net standard 2.0
 
Integrating Node.js with PHP
Integrating Node.js with PHPIntegrating Node.js with PHP
Integrating Node.js with PHP
 
Code quality par Simone Civetta
Code quality par Simone CivettaCode quality par Simone Civetta
Code quality par Simone Civetta
 
Node.js Web Apps @ ebay scale
Node.js Web Apps @ ebay scaleNode.js Web Apps @ ebay scale
Node.js Web Apps @ ebay scale
 
CubeJS: eBay’s Node.js Adoption Journey
CubeJS: eBay’s Node.js Adoption JourneyCubeJS: eBay’s Node.js Adoption Journey
CubeJS: eBay’s Node.js Adoption Journey
 
Testing cloud and kubernetes applications - ElasTest
Testing cloud and kubernetes applications - ElasTestTesting cloud and kubernetes applications - ElasTest
Testing cloud and kubernetes applications - ElasTest
 
Livecode widget course
Livecode widget courseLivecode widget course
Livecode widget course
 
Microsoft 2014 Dev Plataform - Roslyn -& ASP.NET vNext
Microsoft 2014 Dev Plataform -  Roslyn -& ASP.NET vNextMicrosoft 2014 Dev Plataform -  Roslyn -& ASP.NET vNext
Microsoft 2014 Dev Plataform - Roslyn -& ASP.NET vNext
 
An Introduction of Node Package Manager (NPM)
An Introduction of Node Package Manager (NPM)An Introduction of Node Package Manager (NPM)
An Introduction of Node Package Manager (NPM)
 
Web Applications with Eclipse RT and Docker in the Cloud
Web Applications with Eclipse RT and Docker in the CloudWeb Applications with Eclipse RT and Docker in the Cloud
Web Applications with Eclipse RT and Docker in the Cloud
 
Java concurrency
Java concurrencyJava concurrency
Java concurrency
 
Developing Rich Internet Applications with Perl and JavaScript
Developing Rich Internet Applications with Perl and JavaScriptDeveloping Rich Internet Applications with Perl and JavaScript
Developing Rich Internet Applications with Perl and JavaScript
 
A Whirldwind Tour of ASP.NET 5
A Whirldwind Tour of ASP.NET 5A Whirldwind Tour of ASP.NET 5
A Whirldwind Tour of ASP.NET 5
 
Groovy and noteworthy
Groovy and noteworthyGroovy and noteworthy
Groovy and noteworthy
 
Composer: Dependency Manager for PHP
Composer: Dependency Manager for PHPComposer: Dependency Manager for PHP
Composer: Dependency Manager for PHP
 

En vedette

โครงงานครั้งที่ 2 (Guava Cake)
โครงงานครั้งที่ 2 (Guava Cake)โครงงานครั้งที่ 2 (Guava Cake)
โครงงานครั้งที่ 2 (Guava Cake)NattAA
 
It activity 6.3 catapults
It activity 6.3 catapultsIt activity 6.3 catapults
It activity 6.3 catapultslibbyheli
 
Dti2143 chap 4 control statement part 2
Dti2143 chap 4 control statement part 2Dti2143 chap 4 control statement part 2
Dti2143 chap 4 control statement part 2alish sha
 
TiemTapHoaSG
TiemTapHoaSGTiemTapHoaSG
TiemTapHoaSGLinh Vo
 
Projects templates
Projects templatesProjects templates
Projects templatesLinh Vo
 
Super moodlers
Super moodlersSuper moodlers
Super moodlersjohnw3600
 
Building Google Authorship Authority
Building Google Authorship AuthorityBuilding Google Authorship Authority
Building Google Authorship AuthorityMarvin Libron
 
Karta uslug doradczych 1
Karta uslug doradczych 1Karta uslug doradczych 1
Karta uslug doradczych 1annamull
 
Câu chuyệ sức khoẻ 21
Câu chuyệ sức khoẻ 21Câu chuyệ sức khoẻ 21
Câu chuyệ sức khoẻ 21vinhtungdk
 
オウンドメディア時代だからこそ! MTクラウド版への期待と不満
オウンドメディア時代だからこそ! MTクラウド版への期待と不満オウンドメディア時代だからこそ! MTクラウド版への期待と不満
オウンドメディア時代だからこそ! MTクラウド版への期待と不満新一 佐藤
 
Assessment to programming for reading
Assessment to programming for readingAssessment to programming for reading
Assessment to programming for readingKrystle Levings
 

En vedette (20)

โครงงานครั้งที่ 2 (Guava Cake)
โครงงานครั้งที่ 2 (Guava Cake)โครงงานครั้งที่ 2 (Guava Cake)
โครงงานครั้งที่ 2 (Guava Cake)
 
It activity 6.3 catapults
It activity 6.3 catapultsIt activity 6.3 catapults
It activity 6.3 catapults
 
Dti2143 chap 4 control statement part 2
Dti2143 chap 4 control statement part 2Dti2143 chap 4 control statement part 2
Dti2143 chap 4 control statement part 2
 
TiemTapHoaSG
TiemTapHoaSGTiemTapHoaSG
TiemTapHoaSG
 
Projects templates
Projects templatesProjects templates
Projects templates
 
Super moodlers
Super moodlersSuper moodlers
Super moodlers
 
Building Google Authorship Authority
Building Google Authorship AuthorityBuilding Google Authorship Authority
Building Google Authorship Authority
 
Proceso de cambios vip
Proceso de cambios vipProceso de cambios vip
Proceso de cambios vip
 
Karta uslug doradczych 1
Karta uslug doradczych 1Karta uslug doradczych 1
Karta uslug doradczych 1
 
ICA Membership
ICA MembershipICA Membership
ICA Membership
 
Câu chuyệ sức khoẻ 21
Câu chuyệ sức khoẻ 21Câu chuyệ sức khoẻ 21
Câu chuyệ sức khoẻ 21
 
Energy presentation
Energy presentationEnergy presentation
Energy presentation
 
オウンドメディア時代だからこそ! MTクラウド版への期待と不満
オウンドメディア時代だからこそ! MTクラウド版への期待と不満オウンドメディア時代だからこそ! MTクラウド版への期待と不満
オウンドメディア時代だからこそ! MTクラウド版への期待と不満
 
Ideas tema 1
Ideas tema 1Ideas tema 1
Ideas tema 1
 
Apuntes
Apuntes Apuntes
Apuntes
 
Assessment to programming for reading
Assessment to programming for readingAssessment to programming for reading
Assessment to programming for reading
 
γαλιλαIο γαλιλεϊ
γαλιλαIο γαλιλεϊγαλιλαIο γαλιλεϊ
γαλιλαIο γαλιλεϊ
 
Awsをつかってみた
AwsをつかってみたAwsをつかってみた
Awsをつかってみた
 
παρουσιαση 2016
παρουσιαση   2016παρουσιαση   2016
παρουσιαση 2016
 
Biblioteca de MIEDO
Biblioteca de MIEDOBiblioteca de MIEDO
Biblioteca de MIEDO
 

Similaire à Native client

Tech io nodejs_20130531_v0.6
Tech io nodejs_20130531_v0.6Tech io nodejs_20130531_v0.6
Tech io nodejs_20130531_v0.6Ganesh Kondal
 
Building production-quality apps with Node.js
Building production-quality apps with Node.jsBuilding production-quality apps with Node.js
Building production-quality apps with Node.jsmattpardee
 
Learn Electron for Web Developers
Learn Electron for Web DevelopersLearn Electron for Web Developers
Learn Electron for Web DevelopersKyle Cearley
 
Introduction to google endpoints
Introduction to google endpointsIntroduction to google endpoints
Introduction to google endpointsShinto Anto
 
4. RTFM, 나는프로그래머다 Meetup 2016 / 한국마이크로소프트 김명신 기술 에반젤리스트
4. RTFM, 나는프로그래머다 Meetup 2016 / 한국마이크로소프트 김명신 기술 에반젤리스트 4. RTFM, 나는프로그래머다 Meetup 2016 / 한국마이크로소프트 김명신 기술 에반젤리스트
4. RTFM, 나는프로그래머다 Meetup 2016 / 한국마이크로소프트 김명신 기술 에반젤리스트 양 한빛
 
Welcome to the microsoft madness
Welcome to the microsoft madnessWelcome to the microsoft madness
Welcome to the microsoft madness명신 김
 
2008 - TechDays PT: Building Software + Services with Volta
2008 - TechDays PT: Building Software + Services with Volta2008 - TechDays PT: Building Software + Services with Volta
2008 - TechDays PT: Building Software + Services with VoltaDaniel Fisher
 
Real time Communication with Signalr (Android Client)
Real time Communication with Signalr (Android Client)Real time Communication with Signalr (Android Client)
Real time Communication with Signalr (Android Client)Deepak Gupta
 
NCDevCon 2017 - Cross Platform Mobile Apps
NCDevCon 2017 - Cross Platform Mobile AppsNCDevCon 2017 - Cross Platform Mobile Apps
NCDevCon 2017 - Cross Platform Mobile AppsJohn M. Wargo
 
NativeScript: Cross-Platform Mobile Apps with JavaScript and Angular
NativeScript: Cross-Platform Mobile Apps with JavaScript and AngularNativeScript: Cross-Platform Mobile Apps with JavaScript and Angular
NativeScript: Cross-Platform Mobile Apps with JavaScript and AngularTodd Anglin
 
Deploying windows containers with kubernetes
Deploying windows containers with kubernetesDeploying windows containers with kubernetes
Deploying windows containers with kubernetesBen Hall
 
HHM-3540: The IBM MQ Light API: From Developer Laptop to Enterprise Data Cen...
 HHM-3540: The IBM MQ Light API: From Developer Laptop to Enterprise Data Cen... HHM-3540: The IBM MQ Light API: From Developer Laptop to Enterprise Data Cen...
HHM-3540: The IBM MQ Light API: From Developer Laptop to Enterprise Data Cen...Matt Leming
 
Using Eclipse and Lua for the Internet of Things - JAX2013
Using Eclipse and Lua for the Internet of Things - JAX2013Using Eclipse and Lua for the Internet of Things - JAX2013
Using Eclipse and Lua for the Internet of Things - JAX2013Benjamin Cabé
 
When Smalltalk Meets the Web
When Smalltalk Meets the WebWhen Smalltalk Meets the Web
When Smalltalk Meets the WebESUG
 
Nodejs Native Add-Ons from zero to hero
Nodejs Native Add-Ons from zero to heroNodejs Native Add-Ons from zero to hero
Nodejs Native Add-Ons from zero to heroNicola Del Gobbo
 
A164 enterprise javascript ibm node sdk
A164 enterprise javascript ibm node sdkA164 enterprise javascript ibm node sdk
A164 enterprise javascript ibm node sdkToby Corbin
 

Similaire à Native client (20)

Tech io nodejs_20130531_v0.6
Tech io nodejs_20130531_v0.6Tech io nodejs_20130531_v0.6
Tech io nodejs_20130531_v0.6
 
Building production-quality apps with Node.js
Building production-quality apps with Node.jsBuilding production-quality apps with Node.js
Building production-quality apps with Node.js
 
Learn Electron for Web Developers
Learn Electron for Web DevelopersLearn Electron for Web Developers
Learn Electron for Web Developers
 
Introduction to google endpoints
Introduction to google endpointsIntroduction to google endpoints
Introduction to google endpoints
 
4. RTFM, 나는프로그래머다 Meetup 2016 / 한국마이크로소프트 김명신 기술 에반젤리스트
4. RTFM, 나는프로그래머다 Meetup 2016 / 한국마이크로소프트 김명신 기술 에반젤리스트 4. RTFM, 나는프로그래머다 Meetup 2016 / 한국마이크로소프트 김명신 기술 에반젤리스트
4. RTFM, 나는프로그래머다 Meetup 2016 / 한국마이크로소프트 김명신 기술 에반젤리스트
 
Welcome to the microsoft madness
Welcome to the microsoft madnessWelcome to the microsoft madness
Welcome to the microsoft madness
 
2008 - TechDays PT: Building Software + Services with Volta
2008 - TechDays PT: Building Software + Services with Volta2008 - TechDays PT: Building Software + Services with Volta
2008 - TechDays PT: Building Software + Services with Volta
 
Nodejs overview
Nodejs overviewNodejs overview
Nodejs overview
 
Real time Communication with Signalr (Android Client)
Real time Communication with Signalr (Android Client)Real time Communication with Signalr (Android Client)
Real time Communication with Signalr (Android Client)
 
NCDevCon 2017 - Cross Platform Mobile Apps
NCDevCon 2017 - Cross Platform Mobile AppsNCDevCon 2017 - Cross Platform Mobile Apps
NCDevCon 2017 - Cross Platform Mobile Apps
 
Signal R 2015
Signal R 2015Signal R 2015
Signal R 2015
 
NativeScript: Cross-Platform Mobile Apps with JavaScript and Angular
NativeScript: Cross-Platform Mobile Apps with JavaScript and AngularNativeScript: Cross-Platform Mobile Apps with JavaScript and Angular
NativeScript: Cross-Platform Mobile Apps with JavaScript and Angular
 
Deploying windows containers with kubernetes
Deploying windows containers with kubernetesDeploying windows containers with kubernetes
Deploying windows containers with kubernetes
 
Dynamic virtual evironments
Dynamic virtual evironmentsDynamic virtual evironments
Dynamic virtual evironments
 
HHM-3540: The IBM MQ Light API: From Developer Laptop to Enterprise Data Cen...
 HHM-3540: The IBM MQ Light API: From Developer Laptop to Enterprise Data Cen... HHM-3540: The IBM MQ Light API: From Developer Laptop to Enterprise Data Cen...
HHM-3540: The IBM MQ Light API: From Developer Laptop to Enterprise Data Cen...
 
Beginners Node.js
Beginners Node.jsBeginners Node.js
Beginners Node.js
 
Using Eclipse and Lua for the Internet of Things - JAX2013
Using Eclipse and Lua for the Internet of Things - JAX2013Using Eclipse and Lua for the Internet of Things - JAX2013
Using Eclipse and Lua for the Internet of Things - JAX2013
 
When Smalltalk Meets the Web
When Smalltalk Meets the WebWhen Smalltalk Meets the Web
When Smalltalk Meets the Web
 
Nodejs Native Add-Ons from zero to hero
Nodejs Native Add-Ons from zero to heroNodejs Native Add-Ons from zero to hero
Nodejs Native Add-Ons from zero to hero
 
A164 enterprise javascript ibm node sdk
A164 enterprise javascript ibm node sdkA164 enterprise javascript ibm node sdk
A164 enterprise javascript ibm node sdk
 

Dernier

IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 

Dernier (20)

IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 

Native client

  • 2. Native Client • open source technology • running native compiled code in the browser • maintaining the OS portability and safety • expands web programming beyond JavaScript • tied to a specific CPU architecture •os independent, but not processor independent
  • 3. • run close to native speed • multithreaded/multicore • low-latency audio • combined with low-level access to networking APIs and OpenGL ES • fit for running a physics engine or artificial intelligence module • Reduce the encoding and decoding data in proprietary formats • sandboxed environment proxies system calls
  • 4. Native Client module execution prevents the following unsafe activities: Manipulating devices or files directly (instead, a special file system API is provided) Directly accessing the operating system Using self-modifying code to hide the code's intent (such as attempts to write to protected memory)
  • 5. Native Client SDK The Native Client SDK includes the following: GNU-based toolchain: gcc, as, ld, gdb, and other tools API libraries (Pepper, POSIX) SCons build scripts and configuration files for building Native Client applications The Pepper Plug-in API (PPAPI), a library is written in C, and the SDK also provides a set of C++ bindings for it. Native Client modules use the Pepper API to communicate with JavaScript and resources managed by the browser. The Pepper Library also provides a platform-independent multimedia API that Native Client modules can use for audio, video, and 2D graphics (support for 3D graphics is coming soon).
  • 6. Program structure HTML/JavaScript application: • Provides the user interface and event handling Pepper bridge: • send messages between JavaScript code and the Native Client module. • provides interfaces allow NaCl modules to create/use browser resources. Native Client module: • performs numerical computation and other compute-intensive tasks. • Handles large-scale data manipulation. • provides event handling APIs for apps
  • 7. HTML file <embed name="nacl_module" id="hello_world" width=0 height=0 src="hello_world.nmf" type="application/x-nacl" />
  • 8. Creating a Native Client web app C++ Tutorial: Getting Started
  • 9. The HTML web page (*.html). A Native Client module(*.nexe): written in C or C++. Native Client modules uses the Pepper API, as a bridge between the browser and the modules. A manifest file (*.nmf): that is used by the browser to determine which compiled Native Client module to load for a given end-user instruction set ("x86-64" or "x86-32"). Communication between JavaScript and a Native Client module Communication between JavaScript code in the browser and C++ code in a Native Client module is two-way: the browser can send messages to the Native Client module. The Native Client module can respond to the message from JavaScript, or it can initiate its own message to JavaScript. the communication is asynchronous.
  • 10. Step 1: install the Native Client SDK and Python. Step 3: Start a local server. Step 4: Set up Chrome and verify that Native Client is working. Step 5: Create a set of template files for your project. the directory of the project with the following files: •build.scons •hello_tutorial.html •hello_tutorial.cc •scons •Scons, a driver script that runs the SCons tool to build your application •build.scons, the build instructions for your application
  • 11. Step 6: Modify the web page to load and communicate with the Native Client module. <embed name="nacl_module" id="hello_tutorial" width=0 height=0 src="hello_tutorial.nmf" type="application/x-nacl" /> function moduleDidLoad() { HelloTutorialModule = document.getElementById('hello_tutorial'); HelloTutorialModule.addEventListener('message', handleMessage, false); updateStatus('SUCCESS'); //Send a message to the NaCl module. HelloTutorialModule.postMessage('hello'); }
  • 12. Step 7: Implement a message handler in the Native Client module. •Implement the HandleMessage() function for the module instance (pp::Instance.HandleMessage, in the Pepper Library) •Use the PostMessage() function to send a message to JavaScript. (pp::Instance.PostMessage, in the Pepper Library) namespace { // The expected string sent by the browser. const char* const kHelloString = "hello"; // The string sent back to the browser upon receipt of a message // containing "hello". const char* const kReplyString = "hello from NaCl"; } // namespace
  • 13. virtual void HandleMessage(const pp::Var& var_message) { if (!var_message.is_string()) return; std::string message = var_message.AsString(); pp::Var var_reply; if (message == kHelloString) { var_reply = pp::Var(kReplyString); PostMessage(var_reply); } }
  • 14. Step 8: Compile the Native Client module. be sure you are still in the project directory. run the scons script (orscons.bat on Windows). cd examples/hello_tutorial ./scons •hello_tutorial_x86_32.nexe •hello_tutorial_x86_32_dbg.nexe •hello_tutorial_x86_64.nexe •hello_tutorial_x86_64_dbg.nexe •hello_tutorial.nmf { "program": { "x86-64": {"url":"hello_tutorial_x86_64.nexe"}, "x86-32": {"url": "hello_tutorial_x86_32.nexe"} } }