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

Side by Side Diff: chrome/browser/webdata/web_data_service.cc

Issue 201099: Convert the sqlite cookie database and web database to use the new sqlite... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 3 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 | « chrome/browser/profile.cc ('k') | chrome/browser/webdata/web_database.h » ('j') | 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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 "chrome/browser/webdata/web_data_service.h" 5 #include "chrome/browser/webdata/web_data_service.h"
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/path_service.h" 8 #include "base/path_service.h"
9 #include "base/scoped_ptr.h" 9 #include "base/scoped_ptr.h"
10 #include "chrome/browser/search_engines/template_url.h" 10 #include "chrome/browser/search_engines/template_url.h"
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after
401 } 401 }
402 } 402 }
403 403
404 void WebDataService::InitializeDatabase(const FilePath& path) { 404 void WebDataService::InitializeDatabase(const FilePath& path) {
405 DCHECK(!db_); 405 DCHECK(!db_);
406 // In the rare case where the db fails to initialize a dialog may get shown 406 // In the rare case where the db fails to initialize a dialog may get shown
407 // the blocks the caller, yet allows other messages through. For this reason 407 // the blocks the caller, yet allows other messages through. For this reason
408 // we only set db_ to the created database if creation is successful. That 408 // we only set db_ to the created database if creation is successful. That
409 // way other methods won't do anything as db_ is still NULL. 409 // way other methods won't do anything as db_ is still NULL.
410 WebDatabase* db = new WebDatabase(); 410 WebDatabase* db = new WebDatabase();
411 if (!db->Init(path.ToWStringHack())) { 411 if (!db->Init(path)) {
412 NOTREACHED() << "Cannot initialize the web database"; 412 NOTREACHED() << "Cannot initialize the web database";
413 delete db; 413 delete db;
414 return; 414 return;
415 } 415 }
416 416
417 db_ = db; 417 db_ = db;
418
419 db_->BeginTransaction(); 418 db_->BeginTransaction();
420 } 419 }
421 420
422 void WebDataService::ShutdownDatabase() { 421 void WebDataService::ShutdownDatabase() {
423 if (db_) { 422 if (db_) {
424 db_->CommitTransaction(); 423 db_->CommitTransaction();
425 delete db_; 424 delete db_;
426 db_ = NULL; 425 db_ = NULL;
427 } 426 }
428 } 427 }
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
709 Task* t = NewRunnableMethod(s, 708 Task* t = NewRunnableMethod(s,
710 &WebDataService::RequestCompleted, 709 &WebDataService::RequestCompleted,
711 handle_); 710 handle_);
712 message_loop_->PostTask(FROM_HERE, t); 711 message_loop_->PostTask(FROM_HERE, t);
713 } 712 }
714 713
715 int WebDataService::GetNextRequestHandle() { 714 int WebDataService::GetNextRequestHandle() {
716 AutoLock l(pending_lock_); 715 AutoLock l(pending_lock_);
717 return ++next_request_handle_; 716 return ++next_request_handle_;
718 } 717 }
OLDNEW
« no previous file with comments | « chrome/browser/profile.cc ('k') | chrome/browser/webdata/web_database.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698