<div>There are additional constraints that haven't been mentioned yet... Plugins. </div><div><br></div><div>The current model for plugins is that they execute in a single-threaded world. Chrome maintains that model by hosting each plugin in its own process and RPC'ing method invocations back and forth between calling pages and the plugin instances. All plugin instances (of a given plugin) reside on the same thread.</div>
<div><br></div><div>Consider three threads</div><div><br></div><div>PageA</div><div>PageB</div><div>PluginC</div><div><br></div><div>PageA</div><div>-grabs storage lock</div><div><br></div><div>PluginC</div><div>-calls out to PageB (everything in NPAPI is synchronous)</div>
<div>-now waiting for PageB to return</div><div><br></div><div>PageB</div><div>-while handling the plugins callback, attempts to grab the storage lock</div><div>-BLOCKED waiting for PageA to release it</div><div><br></div>
<div>PageA</div><div>-calls plugin (sync method call)</div><div>-BLOCK waiting indirectly for PageB</div><div><br></div><div>== DEADLOCK</div><div><br></div><div><br></div>