Is C++ DOM binding compatible with Pepper API?

32 views
Skip to first unread message

Won Jeon

unread,
Jun 24, 2010, 8:04:09 PM6/24/10
to es-operating-system
Hi all,

I'm wondering if C++ DOM binding is compatible with Pepper API which
allows both Javascript and Plugin could access and update the same
DOM. For example, can the same canvas (in html5) shared by both the
plugin (implemented by using C++ DOM binding) and Javascript? Thanks.

Shiki Okasaka

unread,
Jun 24, 2010, 10:30:20 PM6/24/10
to es-operat...@googlegroups.com
Hi Won,

You can access the same DOM object from both C++ and JavaScript. The
C++ DOM binding uses only core NPAPI functions, which are supported by
NPAPI Pepper extension, too.
If you find any problems, please report a bug.

Best,

- Shiki

> --
> You received this message because you are subscribed to the Google Groups "es-operating-system" group.
> To post to this group, send email to es-operat...@googlegroups.com.
> To unsubscribe from this group, send email to es-operating-sy...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/es-operating-system?hl=en.
>
>

Won Jeon

unread,
Jun 25, 2010, 1:33:12 PM6/25/10
to es-operating-system
Dear Shiki,

Thanks for your response. I have a couple of more questions for my
understanding.

1. In canvas painting example, where is the memory allocation for
canvas? It is inside the browser/webkit, not in the plugin, correct?
2. Is there any case when the plugin generate a large data to update
the DOM in the browser? If so, how is the data transmitted from the
plugin to the browser?
3. Is there any way for C++ binding from the plugin to read a file,
similar to Javascript? For example, does C++ binding allow
canvas.drawImage(image, dx, dy)? If so, how 'image's is retrieved from
either file system or from URL?
4. So basically C++ DOM binding allows a plugin to use DOM API in C++
from the plugin, and this commands are transmitted from the plugin to
the browser via NPAPI/Pepper, correct?
5. C++ binding is agnostic to the implementation of browser or NaCl -
whether NaCl is either statically linked or implemented as a plugin,
correct?

Regards,
Won

Shiki Okasaka

unread,
Jun 29, 2010, 1:36:22 PM6/29/10
to es-operat...@googlegroups.com
Hi Won,

On Wed, Jun 30, 2010 at 1:26 AM, Won Jeon <wjj...@gmail.com> wrote:
> Dear Shiki,
>
> Thanks for your response. I have a couple of more questions for my
> understanding.
>
> 1. In canvas painting example, where is the memory allocation for
> canvas? It is inside the browser/webkit, not in the plugin, correct?

Correct. The plugin only maintains references to the browser's object
through NPAPI.

> 2. Is there any case when the plugin generate a large data to update
> the DOM in the browser? If so, how is the data transmitted from the
> plugin to the browser?

You can use the Web IDL sequence type. However, we still need a byte
array mechanism that is widely supported by browsers and NPAPI
functions for the efficient large data transfer. Typed array [1] is
one of those promising draft specifications. At this moment, C++ DOM
binding over NPAPI can only transfer a value of the NPAPI primitive
data types, like int32, at one time internally.

> 3. Is there any way for C++ binding from the plugin to read a file,
> similar to Javascript? For example, does C++ binding allow
> canvas.drawImage(image, dx, dy)? If so, how 'image's is retrieved
> from
> either file system or from URL?

What you can do with JavaScript for DOM objects can be done with C++, too.
Please refer to the CanvasPixelArray interface definition for the
pixel manipulation; note this interface is not designed for the best
performance. This is one of the other area that typed array will be
useful.

> 4. So basically C++ DOM binding allows a plugin to use DOM API in C++
> from the plugin, and this commands are transmitted from the plugin to
> the browser via NPAPI/Pepper, correct?

Correct.

> 5. C++ binding is agnostic to the implementation of browser or NaCl -
> whether NaCl is either statically linked or implemented as a plugin,
> correct?

Correct. Eventually we'd like to have the standard Web IDL C++ binding
like ECMAScript and Java; NPAPI is only one of the possible transport
mechanism for C++ binding. Currently NPAPI is the most widely
supported API, but we are also interested in a better one that can be
used with various programing languages.

[1] https://cvs.khronos.org/svn/repos/registry/trunk/public/webgl/doc/spec/TypedArray-spec.html

Best,

- Shiki

Reply all
Reply to author
Forward
0 new messages