SlideShare una empresa de Scribd logo
1 de 14
XPCO
M

CROSS PLATFORM COMPONENT OBJECT
MODELING
A Brief Overview
Catalogue
 Introduction
 Benefits
 Drawbacks
 Concepts
 Example

Code

 Working

 References
Introduction








XPCOM is a cross platform component object model, similar
to Microsoft COM.
It has multiple language bindings, allowing XPCOM
components to be used and implemented in JavaScript, Java,
and Python in addition to C++.
Interfaces in XPCOM are defined in a dialect of IDL
called XPIDL.
XPCOM itself provides a set of core components and
classes, e.g. file and memory management, threads, basic
data structures (strings, arrays, variants), etc.
Benefits


XPCOM components can be used by any programming
language Mozilla supports.



Objects implemented as XPCOM can be global to an
application, and are not dependent on the scope of any one
window. You can use an XPCOM service to share data
between windows.



XPCOM encourages modular programming - programming
logic can be encapsulated within a component.
Drawbacks


Objects must be accessed from their defined interfaces.
Javascript shortcuts such as the global window object cannot
be accessed.




The only exception to this rule, is if you set a magical
property wrappedJSObject on your component implemented in
JavaScript, the object this property refers to will be accessible
from the calling side. You can set ”this.wrappedJSObject =
this” in your component's constructor and avoid writing any
interfaces altogether.

It is easier to have memory leaks.
Concepts


Components:




A component is simply an object that implements interfaces, and
is registered with the component manager.

Interfaces:


Interfaces are used to define what functions and attributes an
XPCOM component provides. nsISupports is an interface that all
classes must implement. It provides a function to request the
interfaces on a class.
Concepts


Factories:




(Cont.)

Factories are objects used to instantiate components. Each
factory object implements the nsIFactory interface.

Modules:


Multiple classes can be defined in a file. A module is an object
that is used to register, unregister and provide factories for
classes. It implements the nsIModule interface.
Example Code
Example Code

(Cont.)
Example Code

(Cont.)
Working


I. Startup & Registration


During the startup process if the file compreg.dat is missing or
the file .autoreg exists, the application knows that it needs to
register components. It then loads files from each of the
components folders, including the components folder in each
extension directory. It then calls the function NSGetModule on
each file to get the object that implements the nsIModule
Interface. The module object is then used to register your

module. This is used to simplify the process of retrieving
the module later in class creation. The registerSelf function
is called to do the actual registering. When removing a
class, the unregisterSelf function is called.
Working


II. Class Creation





(Cont.)

The code calls getClassObject on your module.
This returns a class factory. The factory then has a method called
createInstance which is used to create the actual class object.

III. Accessing the component



You can now access your component by the code written.
Mozilla also provides a component construction process to easy
creation with JavaScript.
References


http://kb.mozillazine.org



http://en.wikipedia.org/wiki/XPCOM



https://developer.mozilla.org/en/docs/XPCOM



http://www.ibm.com/developerworks/webservices/library/coxpcom/index.html
Thank You
Jay Patel
(M.Sc. IT - Part 1)

Más contenido relacionado

La actualidad más candente (8)

.Net framework
.Net framework.Net framework
.Net framework
 
Namespaces in C#
Namespaces in C#Namespaces in C#
Namespaces in C#
 
Core Java interview questions-ppt
Core Java interview questions-pptCore Java interview questions-ppt
Core Java interview questions-ppt
 
Interview Questions and Answers for Java
Interview Questions and Answers for JavaInterview Questions and Answers for Java
Interview Questions and Answers for Java
 
Java interview questions
Java interview questionsJava interview questions
Java interview questions
 
Fundamentals of oops in .Net
Fundamentals of oops in .NetFundamentals of oops in .Net
Fundamentals of oops in .Net
 
What's new in SObjectizer 5.5.9
What's new in SObjectizer 5.5.9What's new in SObjectizer 5.5.9
What's new in SObjectizer 5.5.9
 
Microsoft .NET Framework
Microsoft .NET FrameworkMicrosoft .NET Framework
Microsoft .NET Framework
 

Destacado

Architecting Security across global networks
Architecting Security across global networksArchitecting Security across global networks
Architecting Security across global networks
EQS Group
 

Destacado (13)

Tributo A The Beatles
Tributo A The BeatlesTributo A The Beatles
Tributo A The Beatles
 
Studi di settore ATTESTAZIONE, ASSEVERAZIONE e ASPETTI SANZIONATORI in CAPO a...
Studi di settore ATTESTAZIONE, ASSEVERAZIONE e ASPETTI SANZIONATORI in CAPO a...Studi di settore ATTESTAZIONE, ASSEVERAZIONE e ASPETTI SANZIONATORI in CAPO a...
Studi di settore ATTESTAZIONE, ASSEVERAZIONE e ASPETTI SANZIONATORI in CAPO a...
 
trust1
trust1trust1
trust1
 
1 consegna diagnosi certificata a scuola
1   consegna diagnosi certificata a scuola1   consegna diagnosi certificata a scuola
1 consegna diagnosi certificata a scuola
 
iJournalism: Putting it All Together
iJournalism: Putting it All TogetheriJournalism: Putting it All Together
iJournalism: Putting it All Together
 
Modalità di prenotazione per la diagnosiaslna1
Modalità di prenotazione per la diagnosiaslna1Modalità di prenotazione per la diagnosiaslna1
Modalità di prenotazione per la diagnosiaslna1
 
Métodos ágiles de programación
Métodos ágiles de programaciónMétodos ágiles de programación
Métodos ágiles de programación
 
extending-php
extending-phpextending-php
extending-php
 
ARMY Education Transcript
ARMY Education TranscriptARMY Education Transcript
ARMY Education Transcript
 
Applied anatomy
Applied anatomyApplied anatomy
Applied anatomy
 
MBA Colour
MBA ColourMBA Colour
MBA Colour
 
Architecting Security across global networks
Architecting Security across global networksArchitecting Security across global networks
Architecting Security across global networks
 
Tesi: diploma alta formazione in “Psicologia dell'apprendimento della Matemat...
Tesi: diploma alta formazione in “Psicologia dell'apprendimento della Matemat...Tesi: diploma alta formazione in “Psicologia dell'apprendimento della Matemat...
Tesi: diploma alta formazione in “Psicologia dell'apprendimento della Matemat...
 

Similar a Pcom xpcom

.Net framework
.Net framework.Net framework
.Net framework
Raghu nath
 
.NET TECHNOLOGIES
.NET TECHNOLOGIES.NET TECHNOLOGIES
.NET TECHNOLOGIES
Prof Ansari
 
Patterns (contd)Software Development ProcessDesign patte.docx
Patterns (contd)Software Development ProcessDesign patte.docxPatterns (contd)Software Development ProcessDesign patte.docx
Patterns (contd)Software Development ProcessDesign patte.docx
danhaley45372
 
ActionScript 3.0 Fundamentals
ActionScript 3.0 FundamentalsActionScript 3.0 Fundamentals
ActionScript 3.0 Fundamentals
Saurabh Narula
 
Inside .net framework
Inside .net frameworkInside .net framework
Inside .net framework
Faisal Aziz
 

Similar a Pcom xpcom (20)

.Net framework
.Net framework.Net framework
.Net framework
 
Interoduction to c++
Interoduction to c++Interoduction to c++
Interoduction to c++
 
Aspect Oriented Programming Through C#.NET
Aspect Oriented Programming Through C#.NETAspect Oriented Programming Through C#.NET
Aspect Oriented Programming Through C#.NET
 
.net Based Component Technologies
.net Based Component Technologies.net Based Component Technologies
.net Based Component Technologies
 
Maxbox starter19
Maxbox starter19Maxbox starter19
Maxbox starter19
 
.NET TECHNOLOGIES
.NET TECHNOLOGIES.NET TECHNOLOGIES
.NET TECHNOLOGIES
 
SynapseIndia dotnet web development architecture module
SynapseIndia dotnet web development architecture moduleSynapseIndia dotnet web development architecture module
SynapseIndia dotnet web development architecture module
 
dot NET Framework
dot NET Frameworkdot NET Framework
dot NET Framework
 
Patterns (contd)Software Development ProcessDesign patte.docx
Patterns (contd)Software Development ProcessDesign patte.docxPatterns (contd)Software Development ProcessDesign patte.docx
Patterns (contd)Software Development ProcessDesign patte.docx
 
Mca 504 dotnet_unit3
Mca 504 dotnet_unit3Mca 504 dotnet_unit3
Mca 504 dotnet_unit3
 
ActionScript 3.0 Fundamentals
ActionScript 3.0 FundamentalsActionScript 3.0 Fundamentals
ActionScript 3.0 Fundamentals
 
Net Interview questions
Net Interview questionsNet Interview questions
Net Interview questions
 
Interview Question of Aspdotnet
Interview Question of AspdotnetInterview Question of Aspdotnet
Interview Question of Aspdotnet
 
Online lg prodect
Online lg prodectOnline lg prodect
Online lg prodect
 
COM Introduction
COM IntroductionCOM Introduction
COM Introduction
 
Lotusphere 2007 AD507 Leveraging the Power of Object Oriented Programming in ...
Lotusphere 2007 AD507 Leveraging the Power of Object Oriented Programming in ...Lotusphere 2007 AD507 Leveraging the Power of Object Oriented Programming in ...
Lotusphere 2007 AD507 Leveraging the Power of Object Oriented Programming in ...
 
Inside .net framework
Inside .net frameworkInside .net framework
Inside .net framework
 
Topic 1 PBO
Topic 1 PBOTopic 1 PBO
Topic 1 PBO
 
distributing computing
distributing computingdistributing computing
distributing computing
 
Frankenstein's IDE: NetBeans and OSGi
Frankenstein's IDE: NetBeans and OSGiFrankenstein's IDE: NetBeans and OSGi
Frankenstein's IDE: NetBeans and OSGi
 

Último

CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
giselly40
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Último (20)

The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
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
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdf
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
[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
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 

Pcom xpcom

  • 1. XPCO M CROSS PLATFORM COMPONENT OBJECT MODELING A Brief Overview
  • 2. Catalogue  Introduction  Benefits  Drawbacks  Concepts  Example Code  Working  References
  • 3. Introduction     XPCOM is a cross platform component object model, similar to Microsoft COM. It has multiple language bindings, allowing XPCOM components to be used and implemented in JavaScript, Java, and Python in addition to C++. Interfaces in XPCOM are defined in a dialect of IDL called XPIDL. XPCOM itself provides a set of core components and classes, e.g. file and memory management, threads, basic data structures (strings, arrays, variants), etc.
  • 4. Benefits  XPCOM components can be used by any programming language Mozilla supports.  Objects implemented as XPCOM can be global to an application, and are not dependent on the scope of any one window. You can use an XPCOM service to share data between windows.  XPCOM encourages modular programming - programming logic can be encapsulated within a component.
  • 5. Drawbacks  Objects must be accessed from their defined interfaces. Javascript shortcuts such as the global window object cannot be accessed.   The only exception to this rule, is if you set a magical property wrappedJSObject on your component implemented in JavaScript, the object this property refers to will be accessible from the calling side. You can set ”this.wrappedJSObject = this” in your component's constructor and avoid writing any interfaces altogether. It is easier to have memory leaks.
  • 6. Concepts  Components:   A component is simply an object that implements interfaces, and is registered with the component manager. Interfaces:  Interfaces are used to define what functions and attributes an XPCOM component provides. nsISupports is an interface that all classes must implement. It provides a function to request the interfaces on a class.
  • 7. Concepts  Factories:   (Cont.) Factories are objects used to instantiate components. Each factory object implements the nsIFactory interface. Modules:  Multiple classes can be defined in a file. A module is an object that is used to register, unregister and provide factories for classes. It implements the nsIModule interface.
  • 11. Working  I. Startup & Registration  During the startup process if the file compreg.dat is missing or the file .autoreg exists, the application knows that it needs to register components. It then loads files from each of the components folders, including the components folder in each extension directory. It then calls the function NSGetModule on each file to get the object that implements the nsIModule Interface. The module object is then used to register your module. This is used to simplify the process of retrieving the module later in class creation. The registerSelf function is called to do the actual registering. When removing a class, the unregisterSelf function is called.
  • 12. Working  II. Class Creation    (Cont.) The code calls getClassObject on your module. This returns a class factory. The factory then has a method called createInstance which is used to create the actual class object. III. Accessing the component   You can now access your component by the code written. Mozilla also provides a component construction process to easy creation with JavaScript.