OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/browser/in_process_webkit/webkit_context.h" | 5 #include "content/browser/in_process_webkit/webkit_context.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "content/browser/browser_thread.h" | 8 #include "content/browser/browser_thread.h" |
9 | 9 |
10 WebKitContext::WebKitContext( | 10 WebKitContext::WebKitContext( |
11 bool is_incognito, const FilePath& data_path, | 11 bool is_incognito, const FilePath& data_path, |
12 quota::SpecialStoragePolicy* special_storage_policy, | 12 quota::SpecialStoragePolicy* special_storage_policy, |
13 bool clear_local_state_on_exit) | 13 bool clear_local_state_on_exit, |
14 quota::QuotaManagerProxy* quota_manager_proxy, | |
15 base::MessageLoopProxy* webkit_thread_loop) | |
14 : data_path_(is_incognito ? FilePath() : data_path), | 16 : data_path_(is_incognito ? FilePath() : data_path), |
15 is_incognito_(is_incognito), | 17 is_incognito_(is_incognito), |
16 clear_local_state_on_exit_(clear_local_state_on_exit), | 18 clear_local_state_on_exit_(clear_local_state_on_exit), |
17 ALLOW_THIS_IN_INITIALIZER_LIST( | 19 ALLOW_THIS_IN_INITIALIZER_LIST( |
18 dom_storage_context_(new DOMStorageContext( | 20 dom_storage_context_(new DOMStorageContext( |
19 this, special_storage_policy))), | 21 this, special_storage_policy))), |
20 ALLOW_THIS_IN_INITIALIZER_LIST( | 22 ALLOW_THIS_IN_INITIALIZER_LIST( |
21 indexed_db_context_(new IndexedDBContext( | 23 indexed_db_context_(new IndexedDBContext( |
22 this, special_storage_policy))) { | 24 this, special_storage_policy, quota_manager_proxy, |
25 webkit_thread_loop))) { | |
23 } | 26 } |
24 | 27 |
25 WebKitContext::~WebKitContext() { | 28 WebKitContext::~WebKitContext() { |
26 // If the WebKit thread was ever spun up, delete the object there. The task | 29 // If the WebKit thread was ever spun up, delete the object there. The task |
27 // will just get deleted if the WebKit thread isn't created (which only | 30 // will just get deleted if the WebKit thread isn't created (which only |
28 // happens during testing). | 31 // happens during testing). |
29 dom_storage_context_->set_clear_local_state_on_exit_( | 32 dom_storage_context_->set_clear_local_state_on_exit_( |
30 clear_local_state_on_exit_); | 33 clear_local_state_on_exit_); |
31 DOMStorageContext* dom_storage_context = dom_storage_context_.release(); | 34 DOMStorageContext* dom_storage_context = dom_storage_context_.release(); |
32 if (!BrowserThread::DeleteSoon( | 35 if (!BrowserThread::DeleteSoon( |
33 BrowserThread::WEBKIT, FROM_HERE, dom_storage_context)) { | 36 BrowserThread::WEBKIT, FROM_HERE, dom_storage_context)) { |
34 // The WebKit thread wasn't created, and the task got deleted without | 37 // The WebKit thread wasn't created, and the task got deleted without |
35 // freeing the DOMStorageContext, so delete it manually. | 38 // freeing the DOMStorageContext, so delete it manually. |
36 delete dom_storage_context; | 39 delete dom_storage_context; |
37 } | 40 } |
38 | 41 |
39 indexed_db_context_->set_clear_local_state_on_exit( | 42 indexed_db_context_->set_clear_local_state_on_exit( |
40 clear_local_state_on_exit_); | 43 clear_local_state_on_exit_); |
41 IndexedDBContext* indexed_db_context = indexed_db_context_.release(); | 44 IndexedDBContext* indexed_db_context = indexed_db_context_.release(); |
42 if (!BrowserThread::DeleteSoon( | 45 if (!BrowserThread::DeleteSoon( |
43 BrowserThread::WEBKIT, FROM_HERE, indexed_db_context)) { | 46 BrowserThread::WEBKIT, FROM_HERE, indexed_db_context)) { |
44 delete indexed_db_context; | 47 // Check failed: in_dtor_. RefCountedThreadSafe object deleted without |
dgrogan
2011/05/26 01:37:42
I forgot to revisit this after changing indexed_db
michaeln
2011/05/26 03:48:41
If your switching the IndexDBContext to be refcoun
| |
48 // calling Release() | |
49 // delete indexed_db_context; | |
45 } | 50 } |
46 } | 51 } |
47 | 52 |
48 void WebKitContext::PurgeMemory() { | 53 void WebKitContext::PurgeMemory() { |
49 if (!BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)) { | 54 if (!BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)) { |
50 BrowserThread::PostTask( | 55 BrowserThread::PostTask( |
51 BrowserThread::WEBKIT, FROM_HERE, | 56 BrowserThread::WEBKIT, FROM_HERE, |
52 NewRunnableMethod(this, &WebKitContext::PurgeMemory)); | 57 NewRunnableMethod(this, &WebKitContext::PurgeMemory)); |
53 return; | 58 return; |
54 } | 59 } |
(...skipping 20 matching lines...) Expand all Loading... | |
75 BrowserThread::PostTask( | 80 BrowserThread::PostTask( |
76 BrowserThread::WEBKIT, FROM_HERE, | 81 BrowserThread::WEBKIT, FROM_HERE, |
77 NewRunnableMethod(this, &WebKitContext::DeleteSessionStorageNamespace, | 82 NewRunnableMethod(this, &WebKitContext::DeleteSessionStorageNamespace, |
78 session_storage_namespace_id)); | 83 session_storage_namespace_id)); |
79 return; | 84 return; |
80 } | 85 } |
81 | 86 |
82 dom_storage_context_->DeleteSessionStorageNamespace( | 87 dom_storage_context_->DeleteSessionStorageNamespace( |
83 session_storage_namespace_id); | 88 session_storage_namespace_id); |
84 } | 89 } |
OLD | NEW |