IRC Log Viewer » #firebreath » 2011-12-04

IRC Nick Time (GMT-7) Message
Forrest79 12:12 Hello, can I ask how to save JSObjectPtr for later use? I have function, that get JS callback function and when this function is called, I need to save this callback and call it repeatly, but if I make FB::JSObjectPtr attribute in my class I get error: Error C2758: 'TlsServer::receiveCallback' : must be initialized in constructor base/member initializer list. Thanks for help...
linearray 12:12 did you see this?
Forrest79 12:12 Yes, but my class use a library, that has its own threads with callback call, when some packet is receive and I need from this callback send data to javascript.
linearray 12:12 well, I'm not sure I understand what's going on
but it seems like you need to initialize your attribute in the constructor
Forrest79 12:12 Sorry for my bad english :-( Yes, I know, bad in constructor, I didn't have the JS object, that I can't initialize it in constructor...
linearray 12:12 the JSObjectPtr should be default constructed
try this in the constructor: your_attribute = JSObjectPtr();
Forrest79 12:12 It is not working. I need something like chapter JavaScript methods, but when I defined in my class private: FB::JSObjectPtr& m_callback I get an error...
linearray 12:12 uh yeah
your member should be of type FB::JSObjectPtr
not FB::JSObjectPtr&
Forrest79 12:12 I try it firest, but if I use FB::JSObjectPtr I got this error: error C2665: 'FB::variant_detail::conversion::convert_variant' : none of the 5 overloads could convert all the argument types d:\devel\plugins\firebreath\src\scriptingcore\variant.h
linearray 12:12 can you post the relevant code?
FireBreathBot 12:12 When you need to share code, logs, or anything else longer than a couple of lines, use a pastebin.,, and are all good options
linearray 13:12 Forrest79: because I can assure you it works like that:
Forrest79 13:12 Thank you so much for your help, here is my code:
I think, that now the error is not releated with JSObjectPtr...
linearray 13:12 ok, now what if you just write: receiveCallback = messageCallback; in init(.)
ah yes
I would convert data to a std::string first
before you use it in variant_list_of
maybe that helps
Forrest79 13:12 Thanks, I try commented all registerMethod in constructor and build is successfull, so I am searching for error here... Thank you so much for your help. I am rewriting code from XPCOM to FireBreath...
linearray 13:12 alright, good luck
taxilian 14:12 linearray: his problem is that you can't use a const char* type with a registered JSAPI method; he should have used std::string
good call
linearray 15:12 based on our discussion yesterday I now have a new tool in my toolkit:
taxilian 15:12 lol
might I suggest that you not use that in production? =]
linearray 15:12 regarding your problem with the child monitor
apart from the stackoverflow threads I found this:
taxilian 15:12 nice.. so it should be possible to do what I want, then
linearray 15:12 so I think you could use shared memory and put a mutex/semaphore/condition in it
the condition would be very helpful, because it acts like a callback
taxilian 15:12 nice; if I can find a reasonably good way of dealing with that I might even try to make something that is a firebreath module
linearray 15:12 the downside is of course dealing with shared memory
linearray 15:12 no, far far simpler: disregard everything I said and get a sharable_lock on a file_lock in the parent
in the child you get an exclusive lock on the file_lock in a separate thread
this will block until you can acquire the lock
and that is when your parent crashed
taxilian 15:12 sounds easy enough
the next thing I need to figure out is how to best communicate between the processes
probably shared memory there, I'm thinking
linearray 16:12 there's about 8 miles of documentation for that
which of course is better than none