On Mon, Jan 4, 2016 at 12:55 AM, David Rajchenbach-Teller < dtel...@mozilla.com> wrote:
> Well, XPConnect is designed for the main thread, and many of the things > it does assume that everything takes place on the main thread. > > An example, from the topic of my head: whenever objects cross between > JavaScript and C++ through XPConnect, they need to be retained in > hashtables to preserve unicity, etc. For performance reasons, these > hashtables are not protected against concurrent access. > I was maintaining the whole hashtable in the Javascript, And the XPConnect would be used any more, so that would be a problem. > > Another example: JavaScript objects can point towards C++ objects and > vice-versa. The garbage-collector (well, the cycle-collector) needs to > walk the graph in specific ways to get rid of possible cycles that > involve both C++ and JS. The worker's implementation of the > cycle-collector is much simpler (and quite different) than the main > thread's, since it doesn't need to handle XPConnect. Mixing both > Does the worker's gc are implement in mark-swap way? or reference-count based collector? Cause I was implement the whole xpconnect in pure javascript, I think a simple mark-swap garbage collector should be suffice. That's means, we only reference js object in javascript, and C++ object in javascript, and we never reference Javascript object in C++, that's wold not affect the worker's garbage-collector. > accidentally can lead to unpredictable results. > > Oh, and XPConnect pointers can simply not be dereferenced from worker > threads. Attempting to do so will crash libxul by design to avoid > accidents. > > etc. > > Cheers, > David > > On 03/01/16 17:45, 罗勇刚(Yonggang Luo) wrote: > > > > > > On Mon, Jan 4, 2016 at 12:35 AM, David Rajchenbach-Teller > > <dtel...@mozilla.com <mailto:dtel...@mozilla.com>> wrote: > > > > Accessing XPCOM in a worker will most likely break the > garbage-collector > > in novel and interesting ways, so I don't suggest heading in that > > direction. > > > > I'd like to hear more information about that, > > For example, if I setting a finalize for each XPCOM instance > > Object(javascript), when the Object's is GCed, then I release > > the xpcom instance, is that would not break the garbage-collector? > > Or we have other problems about garbage-collector, I am interested in > that. > > > > > > > > Cheers, > > David > > > > On 03/01/16 17:24, 罗勇刚(Yonggang Luo) wrote: > > > So that we could be able to access xpcom in worker. > > > And we could be able to implement thunderbird new msg protocol in > > pure > > > javascript > > > > > > On Sun, Jan 3, 2016 at 11:09 PM, Josh Matthews > > <j...@joshmatthews.net <mailto:j...@joshmatthews.net>> > > > wrote: > > > > > >> What is the motivation for this work? > > > > >> > > >> _______________________________________________ > > >> dev-platform mailing list > > >> dev-platform@lists.mozilla.org > > <mailto:dev-platform@lists.mozilla.org> > > >> https://lists.mozilla.org/listinfo/dev-platform > > >> > > > > > > > > > > > > > > > > > > > -- > > 此致 > > 礼 > > 罗勇刚 > > Yours > > sincerely, > > Yonggang Luo > -- 此致 礼 罗勇刚 Yours sincerely, Yonggang Luo _______________________________________________ dev-platform mailing list dev-platform@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-platform