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

Side by Side Diff: webkit/support/simple_database_system.cc

Issue 7234014: Move code to clear web databases on shutdown to the database tracker (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: updates Created 9 years, 5 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
« no previous file with comments | « webkit/database/vfs_backend.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "webkit/support/simple_database_system.h" 5 #include "webkit/support/simple_database_system.h"
6 6
7 #include "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/message_loop_proxy.h" 10 #include "base/message_loop_proxy.h"
(...skipping 18 matching lines...) Expand all
29 return instance_; 29 return instance_;
30 } 30 }
31 31
32 SimpleDatabaseSystem::SimpleDatabaseSystem() 32 SimpleDatabaseSystem::SimpleDatabaseSystem()
33 : db_thread_("SimpleDBThread"), 33 : db_thread_("SimpleDBThread"),
34 quota_per_origin_(5 * 1024 * 1024), 34 quota_per_origin_(5 * 1024 * 1024),
35 open_connections_(new webkit_database::DatabaseConnectionsWrapper) { 35 open_connections_(new webkit_database::DatabaseConnectionsWrapper) {
36 DCHECK(!instance_); 36 DCHECK(!instance_);
37 instance_ = this; 37 instance_ = this;
38 CHECK(temp_dir_.CreateUniqueTempDir()); 38 CHECK(temp_dir_.CreateUniqueTempDir());
39 db_tracker_ = new DatabaseTracker(temp_dir_.path(), false, NULL, NULL, NULL); 39 db_tracker_ =
40 new DatabaseTracker(temp_dir_.path(), false, false, NULL, NULL, NULL);
40 db_tracker_->AddObserver(this); 41 db_tracker_->AddObserver(this);
41 db_thread_.Start(); 42 db_thread_.Start();
42 db_thread_proxy_ = db_thread_.message_loop_proxy(); 43 db_thread_proxy_ = db_thread_.message_loop_proxy();
43 } 44 }
44 45
45 SimpleDatabaseSystem::~SimpleDatabaseSystem() { 46 SimpleDatabaseSystem::~SimpleDatabaseSystem() {
46 base::WaitableEvent done_event(false, false); 47 base::WaitableEvent done_event(false, false);
47 db_thread_proxy_->PostTask(FROM_HERE, 48 db_thread_proxy_->PostTask(FROM_HERE,
48 NewRunnableMethod(this, &SimpleDatabaseSystem::ThreadCleanup, 49 NewRunnableMethod(this, &SimpleDatabaseSystem::ThreadCleanup,
49 &done_event)); 50 &done_event));
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 file_util::Delete(db_tracker_->DatabaseDirectory(), true); 282 file_util::Delete(db_tracker_->DatabaseDirectory(), true);
282 } 283 }
283 284
284 void SimpleDatabaseSystem::ThreadCleanup(base::WaitableEvent* done_event) { 285 void SimpleDatabaseSystem::ThreadCleanup(base::WaitableEvent* done_event) {
285 ResetTracker(); 286 ResetTracker();
286 db_tracker_->RemoveObserver(this); 287 db_tracker_->RemoveObserver(this);
287 db_tracker_ = NULL; 288 db_tracker_ = NULL;
288 done_event->Signal(); 289 done_event->Signal();
289 } 290 }
290 291
OLDNEW
« no previous file with comments | « webkit/database/vfs_backend.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698