Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(931)

Side by Side Diff: content/browser/in_process_webkit/webkit_context.cc

Issue 7053030: Initial IndexedDBQuotaClient implementation (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: make webkit thread outlive IndexedDBContext Created 9 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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();
42 if (!BrowserThread::DeleteSoon(
43 BrowserThread::WEBKIT, FROM_HERE, indexed_db_context)) {
44 delete indexed_db_context;
45 }
46 } 44 }
47 45
48 void WebKitContext::PurgeMemory() { 46 void WebKitContext::PurgeMemory() {
49 if (!BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)) { 47 if (!BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)) {
50 BrowserThread::PostTask( 48 BrowserThread::PostTask(
51 BrowserThread::WEBKIT, FROM_HERE, 49 BrowserThread::WEBKIT, FROM_HERE,
52 NewRunnableMethod(this, &WebKitContext::PurgeMemory)); 50 NewRunnableMethod(this, &WebKitContext::PurgeMemory));
53 return; 51 return;
54 } 52 }
55 53
(...skipping 19 matching lines...) Expand all
75 BrowserThread::PostTask( 73 BrowserThread::PostTask(
76 BrowserThread::WEBKIT, FROM_HERE, 74 BrowserThread::WEBKIT, FROM_HERE,
77 NewRunnableMethod(this, &WebKitContext::DeleteSessionStorageNamespace, 75 NewRunnableMethod(this, &WebKitContext::DeleteSessionStorageNamespace,
78 session_storage_namespace_id)); 76 session_storage_namespace_id));
79 return; 77 return;
80 } 78 }
81 79
82 dom_storage_context_->DeleteSessionStorageNamespace( 80 dom_storage_context_->DeleteSessionStorageNamespace(
83 session_storage_namespace_id); 81 session_storage_namespace_id);
84 } 82 }
OLDNEW
« no previous file with comments | « content/browser/in_process_webkit/webkit_context.h ('k') | content/browser/in_process_webkit/webkit_context_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698