OLD | NEW |
| (Empty) |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include "content/browser/in_process_webkit/webkit_context.h" | |
6 | |
7 #include "base/bind.h" | |
8 #include "base/command_line.h" | |
9 #include "content/browser/in_process_webkit/dom_storage_context_impl.h" | |
10 #include "content/browser/in_process_webkit/indexed_db_context_impl.h" | |
11 #include "content/public/browser/browser_thread.h" | |
12 | |
13 using content::BrowserThread; | |
14 | |
15 WebKitContext::WebKitContext( | |
16 bool is_incognito, const FilePath& data_path, | |
17 quota::SpecialStoragePolicy* special_storage_policy, | |
18 quota::QuotaManagerProxy* quota_manager_proxy, | |
19 base::MessageLoopProxy* webkit_thread_loop) | |
20 : data_path_(is_incognito ? FilePath() : data_path), | |
21 is_incognito_(is_incognito), | |
22 ALLOW_THIS_IN_INITIALIZER_LIST( | |
23 dom_storage_context_(new DOMStorageContextImpl( | |
24 this, special_storage_policy))), | |
25 ALLOW_THIS_IN_INITIALIZER_LIST( | |
26 indexed_db_context_(new IndexedDBContextImpl( | |
27 this, special_storage_policy, quota_manager_proxy, | |
28 webkit_thread_loop))) { | |
29 } | |
30 | |
31 WebKitContext::~WebKitContext() { | |
32 // If the WebKit thread was ever spun up, delete the object there. The task | |
33 // will just get deleted if the WebKit thread isn't created (which only | |
34 // happens during testing). | |
35 DOMStorageContextImpl* dom_storage_context = dom_storage_context_.release(); | |
36 if (!BrowserThread::ReleaseSoon( | |
37 BrowserThread::WEBKIT_DEPRECATED, FROM_HERE, dom_storage_context)) { | |
38 // The WebKit thread wasn't created, and the task got deleted without | |
39 // freeing the DOMStorageContext, so delete it manually. | |
40 dom_storage_context->Release(); | |
41 } | |
42 } | |
OLD | NEW |