diff options
author | michaeln@chromium.org <michaeln@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-02 22:12:56 +0000 |
---|---|---|
committer | michaeln@chromium.org <michaeln@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-02 22:12:56 +0000 |
commit | 4cccc224e222ceeb765ce93d5bb40223b210c472 (patch) | |
tree | 34c0d1c03d688288801e372282e560631148a692 /webkit | |
parent | c692dd33c9a2686d7121045de78e7a0bdfabfe86 (diff) | |
download | chromium_src-4cccc224e222ceeb765ce93d5bb40223b210c472.zip chromium_src-4cccc224e222ceeb765ce93d5bb40223b210c472.tar.gz chromium_src-4cccc224e222ceeb765ce93d5bb40223b210c472.tar.bz2 |
Include the appcache and database tracker databases into the sql diagnostics fold.
TEST=manual
BUG=none
Review URL: http://codereview.chromium.org/1508016
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@43534 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r-- | webkit/appcache/appcache_database.cc | 14 | ||||
-rw-r--r-- | webkit/appcache/appcache_interfaces.cc | 4 | ||||
-rw-r--r-- | webkit/appcache/appcache_interfaces.h | 5 | ||||
-rw-r--r-- | webkit/appcache/appcache_storage_impl.cc | 8 | ||||
-rw-r--r-- | webkit/database/database_tracker.cc | 16 |
5 files changed, 40 insertions, 7 deletions
diff --git a/webkit/appcache/appcache_database.cc b/webkit/appcache/appcache_database.cc index a93b744..42af3dbc 100644 --- a/webkit/appcache/appcache_database.cc +++ b/webkit/appcache/appcache_database.cc @@ -1,10 +1,11 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "webkit/appcache/appcache_database.h" #include "app/sql/connection.h" +#include "app/sql/diagnostic_error_delegate.h" #include "app/sql/meta_table.h" #include "app/sql/statement.h" #include "app/sql/transaction.h" @@ -133,6 +134,15 @@ const struct { const int kTableCount = ARRAYSIZE_UNSAFE(kTables); const int kIndexCount = ARRAYSIZE_UNSAFE(kIndexes); +class HistogramUniquifier { + public: + static const char* name() { return "Sqlite.AppCache.Error"; } +}; + +sql::ErrorDelegate* GetErrorHandlerForAppCacheDb() { + return new sql::DiagnosticErrorDelegate<HistogramUniquifier>(); +} + } // anon namespace @@ -983,6 +993,8 @@ bool AppCacheDatabase::LazyOpen(bool create_if_needed) { meta_table_.reset(new sql::MetaTable); quota_table_.reset(new webkit_database::QuotaTable(db_.get())); + db_->set_error_delegate(GetErrorHandlerForAppCacheDb()); + bool opened = false; if (use_in_memory_db) { opened = db_->OpenInMemory(); diff --git a/webkit/appcache/appcache_interfaces.cc b/webkit/appcache/appcache_interfaces.cc index 4ee686a..b70cadf 100644 --- a/webkit/appcache/appcache_interfaces.cc +++ b/webkit/appcache/appcache_interfaces.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -19,6 +19,8 @@ const char kHttpsScheme[] = "https"; const char kHttpGETMethod[] = "GET"; const char kHttpHEADMethod[] = "HEAD"; +const FilePath::CharType kAppCacheDatabaseName[] = FILE_PATH_LITERAL("Index"); + bool IsSchemeSupported(const GURL& url) { bool supported = url.SchemeIs(kHttpScheme) || url.SchemeIs(kHttpsScheme); #ifndef NDEBUG diff --git a/webkit/appcache/appcache_interfaces.h b/webkit/appcache/appcache_interfaces.h index 223e560..b5d6424 100644 --- a/webkit/appcache/appcache_interfaces.h +++ b/webkit/appcache/appcache_interfaces.h @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -8,6 +8,7 @@ #include <string> #include <vector> #include "base/basictypes.h" +#include "base/file_path.h" class GURL; class URLRequest; @@ -87,6 +88,8 @@ bool IsSchemeSupported(const GURL& url); bool IsMethodSupported(const std::string& method); bool IsSchemeAndMethodSupported(const URLRequest* request); +extern const FilePath::CharType kAppCacheDatabaseName[]; + } // namespace #endif // WEBKIT_APPCACHE_APPCACHE_INTERFACES_H_ diff --git a/webkit/appcache/appcache_storage_impl.cc b/webkit/appcache/appcache_storage_impl.cc index 10724eb..69701e6 100644 --- a/webkit/appcache/appcache_storage_impl.cc +++ b/webkit/appcache/appcache_storage_impl.cc @@ -32,10 +32,10 @@ void DeleteDirectory(const FilePath& path) { namespace appcache { -static const char kAppCacheDatabaseName[] = "Index"; -static const char kDiskCacheDirectoryName[] = "Cache"; static const int kMaxDiskCacheSize = 250 * 1024 * 1024; static const int kMaxMemDiskCacheSize = 10 * 1024 * 1024; +static const FilePath::CharType kDiskCacheDirectoryName[] = + FILE_PATH_LITERAL("Cache"); // DatabaseTask ----------------------------------------- @@ -849,7 +849,7 @@ void AppCacheStorageImpl::Initialize(const FilePath& cache_directory) { FilePath db_file_path; if (!is_incognito_) - db_file_path = cache_directory_.AppendASCII(kAppCacheDatabaseName); + db_file_path = cache_directory_.Append(kAppCacheDatabaseName); database_ = new AppCacheDatabase(db_file_path); scoped_refptr<InitTask> task = new InitTask(this); @@ -1271,7 +1271,7 @@ AppCacheDiskCache* AppCacheStorageImpl::disk_cache() { kMaxMemDiskCacheSize, &init_callback_); } else { rv = disk_cache_->InitWithDiskBackend( - cache_directory_.AppendASCII(kDiskCacheDirectoryName), + cache_directory_.Append(kDiskCacheDirectoryName), kMaxDiskCacheSize, false, &init_callback_); } diff --git a/webkit/database/database_tracker.cc b/webkit/database/database_tracker.cc index e64f118..c184c8b 100644 --- a/webkit/database/database_tracker.cc +++ b/webkit/database/database_tracker.cc @@ -7,6 +7,7 @@ #include <vector> #include "app/sql/connection.h" +#include "app/sql/diagnostic_error_delegate.h" #include "app/sql/meta_table.h" #include "app/sql/statement.h" #include "app/sql/transaction.h" @@ -18,6 +19,19 @@ #include "webkit/database/databases_table.h" #include "webkit/database/quota_table.h" +namespace { + +class HistogramUniquifier { + public: + static const char* name() { return "Sqlite.DatabaseTracker.Error"; } +}; + +sql::ErrorDelegate* GetErrorHandlerForTrackerDb() { + return new sql::DiagnosticErrorDelegate<HistogramUniquifier>(); +} + +} // anon namespace + namespace webkit_database { const FilePath::CharType kDatabaseDirectoryName[] = @@ -304,6 +318,8 @@ bool DatabaseTracker::LazyInit() { return false; } + db_->set_error_delegate(GetErrorHandlerForTrackerDb()); + databases_table_.reset(new DatabasesTable(db_.get())); quota_table_.reset(new QuotaTable(db_.get())); meta_table_.reset(new sql::MetaTable()); |