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

Side by Side Diff: chrome/common/sqlite_utils.h

Issue 2804042: Incomplete changes to make scoped_ptr_malloc use plain functions. (Closed)
Patch Set: chrome now builds & links Created 10 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
« no previous file with comments | « chrome/browser/gtk/certificate_dialogs.cc ('k') | chrome/gpu/gpu_backing_store_glx_context.cc » ('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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 #ifndef CHROME_COMMON_SQLITE_UTILS_H_ 5 #ifndef CHROME_COMMON_SQLITE_UTILS_H_
6 #define CHROME_COMMON_SQLITE_UTILS_H_ 6 #define CHROME_COMMON_SQLITE_UTILS_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 344
345 private: 345 private:
346 DISALLOW_COPY_AND_ASSIGN(SQLStatement); 346 DISALLOW_COPY_AND_ASSIGN(SQLStatement);
347 }; 347 };
348 348
349 namespace sqlite_utils { 349 namespace sqlite_utils {
350 350
351 //------------------------------------------------------------------------------ 351 //------------------------------------------------------------------------------
352 // A scoped sqlite database that closes when it goes out of scope. 352 // A scoped sqlite database that closes when it goes out of scope.
353 //------------------------------------------------------------------------------ 353 //------------------------------------------------------------------------------
354 class DBClose { 354 typedef scoped_ptr_malloc<sqlite3, FreeFnIgnoreReturn<sqlite3, sqlite3_close> >
355 public: 355 scoped_sqlite_db_ptr;
356 inline void operator()(sqlite3* x) const {
357 sqlite3_close(x);
358 }
359 };
360
361 typedef scoped_ptr_malloc<sqlite3, DBClose> scoped_sqlite_db_ptr;
362 356
363 // Opens the DB in the file pointed to by |filepath|. This method forces the 357 // Opens the DB in the file pointed to by |filepath|. This method forces the
364 // database to be in UTF-8 mode on all platforms. See 358 // database to be in UTF-8 mode on all platforms. See
365 // http://www.sqlite.org/capi3ref.html#sqlite3_open for an explanation of the 359 // http://www.sqlite.org/capi3ref.html#sqlite3_open for an explanation of the
366 // return value. 360 // return value.
367 int OpenSqliteDb(const FilePath& filepath, sqlite3** database); 361 int OpenSqliteDb(const FilePath& filepath, sqlite3** database);
368 362
369 // Returns true if there is a table with the given name in the database. 363 // Returns true if there is a table with the given name in the database.
370 // For the version where a database name is specified, it may be NULL or the 364 // For the version where a database name is specified, it may be NULL or the
371 // empty string if no database name is necessary. 365 // empty string if no database name is necessary.
(...skipping 29 matching lines...) Expand all
401 395
402 } // namespace sqlite_utils 396 } // namespace sqlite_utils
403 397
404 #if defined(USE_SYSTEM_SQLITE) 398 #if defined(USE_SYSTEM_SQLITE)
405 // This function is a local change to sqlite3 which doesn't exist when one is 399 // This function is a local change to sqlite3 which doesn't exist when one is
406 // using the system sqlite library. Thus, we stub it out here. 400 // using the system sqlite library. Thus, we stub it out here.
407 int sqlite3Preload(sqlite3* db); 401 int sqlite3Preload(sqlite3* db);
408 #endif 402 #endif
409 403
410 #endif // CHROME_COMMON_SQLITE_UTILS_H_ 404 #endif // CHROME_COMMON_SQLITE_UTILS_H_
OLDNEW
« no previous file with comments | « chrome/browser/gtk/certificate_dialogs.cc ('k') | chrome/gpu/gpu_backing_store_glx_context.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698