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

Side by Side Diff: chrome/browser/sync/util/sqlite_utils.cc

Issue 8491043: Allow linker initialization of lazy instance (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: thakis comment, renamed LAZY_INSTANCE_INITIALIZER Created 9 years, 1 month 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 "chrome/browser/sync/util/sqlite_utils.h" 5 #include "chrome/browser/sync/util/sqlite_utils.h"
6 6
7 #include <list> 7 #include <list>
8 8
9 #include "base/file_path.h" 9 #include "base/file_path.h"
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 base::AutoLock lock(lock_); 73 base::AutoLock lock(lock_);
74 errors_.push_back(handler); 74 errors_.push_back(handler);
75 } 75 }
76 76
77 typedef std::list<SQLErrorHandler*> ErrorList; 77 typedef std::list<SQLErrorHandler*> ErrorList;
78 ErrorList errors_; 78 ErrorList errors_;
79 base::Lock lock_; 79 base::Lock lock_;
80 }; 80 };
81 81
82 static base::LazyInstance<DefaultSQLErrorHandlerFactory> 82 static base::LazyInstance<DefaultSQLErrorHandlerFactory>
83 g_default_sql_error_handler_factory(base::LINKER_INITIALIZED); 83 g_default_sql_error_handler_factory = LAZY_INSTANCE_INITIALIZER;
84 84
85 SQLErrorHandlerFactory* GetErrorHandlerFactory() { 85 SQLErrorHandlerFactory* GetErrorHandlerFactory() {
86 // TODO(cpu): Testing needs to override the error handler. 86 // TODO(cpu): Testing needs to override the error handler.
87 // Destruction of DefaultSQLErrorHandlerFactory handled by at_exit manager. 87 // Destruction of DefaultSQLErrorHandlerFactory handled by at_exit manager.
88 return g_default_sql_error_handler_factory.Pointer(); 88 return g_default_sql_error_handler_factory.Pointer();
89 } 89 }
90 90
91 int OpenSqliteDb(const FilePath& filepath, sqlite3** database) { 91 int OpenSqliteDb(const FilePath& filepath, sqlite3** database) {
92 #if defined(OS_WIN) 92 #if defined(OS_WIN)
93 // We want the default encoding to always be UTF-8, so we use the 93 // We want the default encoding to always be UTF-8, so we use the
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after
502 return (s != NULL); 502 return (s != NULL);
503 } 503 }
504 504
505 std::wstring SQLStatement::column_wstring(int index) { 505 std::wstring SQLStatement::column_wstring(int index) {
506 std::wstring wstr; 506 std::wstring wstr;
507 column_wstring(index, &wstr); 507 column_wstring(index, &wstr);
508 return wstr; 508 return wstr;
509 } 509 }
510 510
511 } // namespace sqlite_utils 511 } // namespace sqlite_utils
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698