diff options
author | jorlow@chromium.org <jorlow@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-01 19:51:45 +0000 |
---|---|---|
committer | jorlow@chromium.org <jorlow@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-01 19:51:45 +0000 |
commit | b94c30ecc12799ad4f89897cb8333b5285f2918a (patch) | |
tree | 92fd0243537d0c1104ee39ff37b812029f39c12b /chrome/browser/in_process_webkit/webkit_context.cc | |
parent | 1d5ac66b45c8e625fb4ec382d4e38e5357fdb257 (diff) | |
download | chromium_src-b94c30ecc12799ad4f89897cb8333b5285f2918a.zip chromium_src-b94c30ecc12799ad4f89897cb8333b5285f2918a.tar.gz chromium_src-b94c30ecc12799ad4f89897cb8333b5285f2918a.tar.bz2 |
Another stab at the Chromium side of storage events. The WebKit side can be found here: https://bugs.webkit.org/show_bug.cgi?id=29655
TEST=Manually inspected that storage events fired. Will turn on more layout tests in a subsequent patch.
BUG=19972
Review URL: http://codereview.chromium.org/223013
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@27756 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/in_process_webkit/webkit_context.cc')
-rw-r--r-- | chrome/browser/in_process_webkit/webkit_context.cc | 27 |
1 files changed, 10 insertions, 17 deletions
diff --git a/chrome/browser/in_process_webkit/webkit_context.cc b/chrome/browser/in_process_webkit/webkit_context.cc index ae647d6..0768284 100644 --- a/chrome/browser/in_process_webkit/webkit_context.cc +++ b/chrome/browser/in_process_webkit/webkit_context.cc @@ -9,24 +9,17 @@ WebKitContext::WebKitContext(const FilePath& data_path, bool is_incognito) : data_path_(data_path), - is_incognito_(is_incognito) { + is_incognito_(is_incognito), + ALLOW_THIS_IN_INITIALIZER_LIST( + dom_storage_context_(new DOMStorageContext(this))) { } WebKitContext::~WebKitContext() { - // If a dom storage context was ever created, we need to destroy it on the - // WebKit thread. Luckily we're guaranteed that the WebKit thread is still - // alive since the ResourceDispatcherHost (which owns the WebKit thread) goes - // away after all the ResourceMessageFilters and the profiles (i.e. all the - // objects with a reference to us). - if (dom_storage_context_.get()) { - MessageLoop* loop = ChromeThread::GetMessageLoop(ChromeThread::WEBKIT); - loop->DeleteSoon(FROM_HERE, dom_storage_context_.release()); - } -} - -DOMStorageContext* WebKitContext::GetDOMStorageContext() { - DCHECK(ChromeThread::CurrentlyOn(ChromeThread::WEBKIT)); - if (!dom_storage_context_.get()) - dom_storage_context_.reset(new DOMStorageContext(this)); - return dom_storage_context_.get(); + // If the WebKit thread was ever spun up, delete the object there. If we're + // on the IO thread, this is safe because the WebKit thread goes away after + // the IO. If we're on the UI thread, we're safe because the UI thread kills + // the WebKit thread. + MessageLoop* webkit_loop = ChromeThread::GetMessageLoop(ChromeThread::WEBKIT); + if (webkit_loop) + webkit_loop->DeleteSoon(FROM_HERE, dom_storage_context_.release()); } |