OLD | NEW |
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 "content/common/web_database_observer_impl.h" | 5 #include "content/common/web_database_observer_impl.h" |
6 | 6 |
7 #include "base/metrics/histogram.h" | 7 #include "base/metrics/histogram.h" |
8 #include "base/string16.h" | 8 #include "base/string16.h" |
9 #include "content/common/database_messages.h" | 9 #include "content/common/database_messages.h" |
10 #include "third_party/sqlite/sqlite3.h" | 10 #include "third_party/sqlite/sqlite3.h" |
11 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDatabase.h" | 11 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDatabase.h" |
12 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" | 12 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" |
13 | 13 |
14 using WebKit::WebDatabase; | 14 using WebKit::WebDatabase; |
15 | 15 |
| 16 namespace content { |
16 namespace { | 17 namespace { |
17 | 18 |
18 const int kResultHistogramSize = 50; | 19 const int kResultHistogramSize = 50; |
19 const int kCallsiteHistogramSize = 10; | 20 const int kCallsiteHistogramSize = 10; |
20 | 21 |
21 int DetermineHistogramResult(int websql_error, int sqlite_error) { | 22 int DetermineHistogramResult(int websql_error, int sqlite_error) { |
22 // If we have a sqlite error, log it after trimming the extended bits. | 23 // If we have a sqlite error, log it after trimming the extended bits. |
23 // There are 26 possible values, but we leave room for some new ones. | 24 // There are 26 possible values, but we leave room for some new ones. |
24 if (sqlite_error) | 25 if (sqlite_error) |
25 return std::min(sqlite_error & 0xff, 30); | 26 return std::min(sqlite_error & 0xff, 30); |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 // We filter out errors which the backend doesn't act on to avoid | 158 // We filter out errors which the backend doesn't act on to avoid |
158 // a unnecessary ipc traffic, this method can get called at a fairly | 159 // a unnecessary ipc traffic, this method can get called at a fairly |
159 // high frequency (per-sqlstatement). | 160 // high frequency (per-sqlstatement). |
160 if (error == SQLITE_CORRUPT || error == SQLITE_NOTADB) { | 161 if (error == SQLITE_CORRUPT || error == SQLITE_NOTADB) { |
161 sender_->Send(new DatabaseHostMsg_HandleSqliteError( | 162 sender_->Send(new DatabaseHostMsg_HandleSqliteError( |
162 database.securityOrigin().databaseIdentifier(), | 163 database.securityOrigin().databaseIdentifier(), |
163 database.name(), | 164 database.name(), |
164 error)); | 165 error)); |
165 } | 166 } |
166 } | 167 } |
| 168 |
| 169 } // namespace content |
OLD | NEW |