Okay, I've looked at my code.

I modified the DedicatedWorkerTemplate.js file from speedtracer to include 
the following lines near the top (first two should already be there):

$self = self;
$sessionId = null;
$wnd = self;
$doc = self;
window = self;

This kept a lot of the code I was using that was looking for a $wnd and 
$doc variable happy. Of course, it doesn't *actually* provide window or 
document objects, it just renames them so the code doesn't blow up. This 
has been part of the problem with the project I've been working on, I'm 
using an external library that is unaware it is being used as a worker and 
while in theory it's just doing processing, it's still expecting to find 
certain values in window and document objects, so I've been slowly and 
annoyingly figuring out how to create a mock window and document object to 
accommodate the code. But it's a pain and I'm considering just rewriting 
it. Unfortunately that removes the usefulness of the library since I was 
using it to save me from coding my own implementation (and I'd have to keep 
porting over the updates as they occur, bleh). On the other hand, running 
the third-party processing in the main thread really kills the app's 
performance (especially on mobile).

Sigh. Apparently I needed to vent... Sorry about that.

Derek

On Thursday, September 13, 2012 5:15:32 AM UTC-4, Harold wrote:
>
> Hi Derek,
>
> Thanks for the advice.
> I tried to put "var $wnd= $self" but what about "var $document" ?
>
> if you have some time to check your code, it is welcome :)
>
> Regards,
> Harold
>
> 2012/9/10 Derek <[email protected] <javascript:>>
>
>> I'd need to look at my code again (not convenient to do right now), but I 
>> recall putting something along the lines of 'var $wnd = $self' at the top 
>> of the js wrapper. (i.e., editing the speedtracer code's javascript file 
>> and adding those lines to the top)
>>
>>
>> On Monday, September 10, 2012 3:59:11 AM UTC-4, Harold wrote:
>>
>>> Hi Derek,
>>>
>>> As i have a lot of JSNI calls, i do not use the dev mode.
>>> Super dev mode is far more suitable !
>>>
>>> Btw, i still have issue with my worker because after GWT compilation, 
>>> the generated script contains "window" and "document" variables which are 
>>> not defined in the worker scope, so i get an error at worker start.
>>>
>>>  function myworker(){
>>>>  ...
>>>> var $wnd = window, $doc = document ...
>>>> ...
>>>
>>>
>>> How do you say to GWT to ignore "window" things ?
>>> I have read that we should use $self instead of $window but i do not 
>>> know how to configure GWT compiler.
>>>
>>> Regards,
>>> Harold
>>>
>>>
>>> 2012/9/9 Derek <[email protected]>
>>>
>>> I've played around with web workers on GWT, but it's not a lot of fun. 
>>>> You can't use normal GWT devmode on them (though maybe superdevmode would 
>>>> work?). So you essentially have to write the worker, compile it, and then 
>>>> call it from your non-worker code and hope it does what you want.
>>>>
>>>>
>>>> On Saturday, September 8, 2012 3:58:30 PM UTC-4, Harold wrote:
>>>>>
>>>>> Hi all,
>>>>>
>>>>> Does anyone have used web workers via GWT ? 
>>>>>
>>>>> I have tried to use web workers looking at speed tracer code :
>>>>> http://code.google.com/p/**speed**tracer/source/browse/#**svn%**
>>>>> 2Ftrunk%2Fsrc%2Fclient%**2Fui%**2Fsrc%2Fcom%2Fgoogle%**2Fgwt%**
>>>>> 2Fwebworker%253Fstate%**253Dclos**ed<http://code.google.com/p/speedtracer/source/browse/#svn%2Ftrunk%2Fsrc%2Fclient%2Fui%2Fsrc%2Fcom%2Fgoogle%2Fgwt%2Fwebworker%253Fstate%253Dclosed>
>>>>>  
>>>>> But i did not succeed to launch my worker.
>>>>>
>>>>> Is there any example anywhere ?
>>>>>
>>>>> Regards,
>>>>> Harold
>>>>>
>>>>
>>>
>>>
>>> -- 
>>> *Small WebGL 3D engine for GWT*
>>> *http://code.google.com/p/ethereal-engine/*<http://code.google.com/p/ethereal-engine/>
>>>  
>>>  
>>  -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Google Web Toolkit" group.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msg/google-web-toolkit/-/u65cj3jpGssJ.
>>
>> To post to this group, send email to 
>> [email protected]<javascript:>
>> .
>> To unsubscribe from this group, send email to 
>> [email protected] <javascript:>.
>> For more options, visit this group at 
>> http://groups.google.com/group/google-web-toolkit?hl=en.
>>
>
>
>
> -- 
> *Small WebGL 3D engine for GWT*
> *http://code.google.com/p/ethereal-engine/*<http://code.google.com/p/ethereal-engine/>
>  
>  

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/uADQDjj9cvcJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to