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

Side by Side Diff: chrome/browser/history/in_memory_database.cc

Issue 12314090: Add utf_string_conversions to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/history/in_memory_database.h" 5 #include "chrome/browser/history/in_memory_database.h"
6 6
7 #include "base/files/file_path.h" 7 #include "base/files/file_path.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "base/time.h" 10 #include "base/time.h"
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 bool InMemoryDatabase::InitFromDisk(const base::FilePath& history_name) { 65 bool InMemoryDatabase::InitFromDisk(const base::FilePath& history_name) {
66 if (!InitDB()) 66 if (!InitDB())
67 return false; 67 return false;
68 68
69 // Attach to the history database on disk. (We can't ATTACH in the middle of 69 // Attach to the history database on disk. (We can't ATTACH in the middle of
70 // a transaction.) 70 // a transaction.)
71 sql::Statement attach(GetDB().GetUniqueStatement("ATTACH ? AS history")); 71 sql::Statement attach(GetDB().GetUniqueStatement("ATTACH ? AS history"));
72 #if defined(OS_POSIX) 72 #if defined(OS_POSIX)
73 attach.BindString(0, history_name.value()); 73 attach.BindString(0, history_name.value());
74 #else 74 #else
75 attach.BindString(0, WideToUTF8(history_name.value())); 75 attach.BindString(0, base::WideToUTF8(history_name.value()));
76 #endif 76 #endif
77 if (!attach.Run()) 77 if (!attach.Run())
78 return false; 78 return false;
79 79
80 // Copy URL data to memory. 80 // Copy URL data to memory.
81 base::TimeTicks begin_load = base::TimeTicks::Now(); 81 base::TimeTicks begin_load = base::TimeTicks::Now();
82 if (!db_.Execute( 82 if (!db_.Execute(
83 "INSERT INTO urls SELECT * FROM history.urls WHERE typed_count > 0")) { 83 "INSERT INTO urls SELECT * FROM history.urls WHERE typed_count > 0")) {
84 // Unable to get data from the history database. This is OK, the file may 84 // Unable to get data from the history database. This is OK, the file may
85 // just not exist yet. 85 // just not exist yet.
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 CreateKeywordSearchTermsIndices(); 142 CreateKeywordSearchTermsIndices();
143 143
144 return true; 144 return true;
145 } 145 }
146 146
147 sql::Connection& InMemoryDatabase::GetDB() { 147 sql::Connection& InMemoryDatabase::GetDB() {
148 return db_; 148 return db_;
149 } 149 }
150 150
151 } // namespace history 151 } // namespace history
OLDNEW
« no previous file with comments | « chrome/browser/history/history_publisher_win.cc ('k') | chrome/browser/history/query_parser_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698