浏览器内的 Silverlight 执行上下文
我需要有关浏览器中 XAP 文件执行上下文的一些信息。具体来说,XAP文件加载到内存时如何加载、加载到哪里。
我的理解是,它将被加载到网络浏览器进程的地址空间中,这将在每个浏览器窗口实例中完成一次。
这个问题的原因是我需要了解静态变量(在 XAP 包中的类型中定义)的行为及其生命周期,例如当 XAP 包在多个浏览器窗口中运行时(即用户打开 3 个 IE 窗口但正在查看)同一页)。这也引发了一个重要问题:静态变量中的静态数据是否可以在浏览器之间共享,但我不这样做。
我通过测试注意到的是,当我 F5(页面刷新)时,所有静态类型都被重新创建(即我的单例被重新创建),我可以通过看到所有静态成员字段都失去了之前的值来看到这一点当类初始化时返回默认值)
任何指向更多阅读的链接也将不胜感激。
谢谢,
Lk
I need some information on XAP files execution context in the browser. Specifically, how and where the XAP file is loaded when it is loaded into memory.
My understanding is that it would be loaded in the address space of the web browser's process, this would be done once per instance of the browser window.
Reason for this question is I need to understand how static variables (defined in a type located in XAP package) behave and their lifetime,- for example when XAP package is running in multiple browser windows (ie. user opened 3 IE windows but is viewing the same page). This also raises important issue whether static data in static variables can be shared across browsers, which I don't is the case.
What I did notice through my testing is that when I F5 (page refresh) all the static types were re-created (ie. my singletons were re-created, I could see this by seeing all static member fields losing their previous value they had back to default value when class is initialized)
Any links to more reading would be also appreciated.
Thx,
lk
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Silverlight 的每个实例都针对该特定实例进行沙箱处理。即使同一浏览器页面中的多个相同 Silverlight 应用程序都是重复实例,并且不会共享任何内容。
如果刷新浏览器,则您已从内存中清除了程序并重新开始。
因此,它们甚至不在浏览器选项卡之间共享。
其实没什么可读的,只是 Silverlight 生活的一个事实:)
Every instance of Silverlight is sandboxed to that specific instance. Even multiples of the same Silverlight app in the same Browser page are duplicate instances and nothing is shared.
If you refresh the browser you have flushed your program from memory and are starting again.
They are therefore not even shared between browser tabs.
Not much to read about really, just a fact of Silverlight life :)