OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/child/web_database_observer_impl.h" | 5 #include "content/child/web_database_observer_impl.h" |
6 | 6 |
7 #include "base/metrics/histogram.h" | 7 #include "base/metrics/histogram.h" |
8 #include "base/strings/string16.h" | 8 #include "base/strings/string16.h" |
9 #include "content/common/database_messages.h" | 9 #include "content/common/database_messages.h" |
10 #include "third_party/WebKit/public/platform/WebCString.h" | 10 #include "third_party/WebKit/public/platform/WebCString.h" |
11 #include "third_party/WebKit/public/platform/WebString.h" | 11 #include "third_party/WebKit/public/platform/WebString.h" |
12 #include "third_party/WebKit/public/web/WebDatabase.h" | 12 #include "third_party/WebKit/public/web/WebDatabase.h" |
13 #include "third_party/sqlite/sqlite3.h" | 13 #include "third_party/sqlite/sqlite3.h" |
14 | 14 |
15 using WebKit::WebDatabase; | 15 using WebKit::WebDatabase; |
| 16 using WebKit::WebString; |
16 | 17 |
17 namespace content { | 18 namespace content { |
18 namespace { | 19 namespace { |
19 | 20 |
20 const int kResultHistogramSize = 50; | 21 const int kResultHistogramSize = 50; |
21 const int kCallsiteHistogramSize = 10; | 22 const int kCallsiteHistogramSize = 10; |
22 | 23 |
23 int DetermineHistogramResult(int websql_error, int sqlite_error) { | 24 int DetermineHistogramResult(int websql_error, int sqlite_error) { |
24 // If we have a sqlite error, log it after trimming the extended bits. | 25 // If we have a sqlite error, log it after trimming the extended bits. |
25 // There are 26 possible values, but we leave room for some new ones. | 26 // There are 26 possible values, but we leave room for some new ones. |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 origin_identifier, database_name, | 83 origin_identifier, database_name, |
83 database.displayName(), database.estimatedSize())); | 84 database.displayName(), database.estimatedSize())); |
84 } | 85 } |
85 | 86 |
86 void WebDatabaseObserverImpl::databaseModified( | 87 void WebDatabaseObserverImpl::databaseModified( |
87 const WebDatabase& database) { | 88 const WebDatabase& database) { |
88 sender_->Send(new DatabaseHostMsg_Modified( | 89 sender_->Send(new DatabaseHostMsg_Modified( |
89 database.securityOrigin().databaseIdentifier().utf8(), database.name())); | 90 database.securityOrigin().databaseIdentifier().utf8(), database.name())); |
90 } | 91 } |
91 | 92 |
| 93 void WebDatabaseObserverImpl::databaseClosed(const WebString& origin_identifier, |
| 94 const WebString& database_name) { |
| 95 sender_->Send(new DatabaseHostMsg_Closed( |
| 96 origin_identifier.utf8(), database_name)); |
| 97 open_connections_->RemoveOpenConnection(origin_identifier.utf8(), |
| 98 database_name); |
| 99 } |
| 100 |
92 void WebDatabaseObserverImpl::databaseClosed( | 101 void WebDatabaseObserverImpl::databaseClosed( |
93 const WebDatabase& database) { | 102 const WebDatabase& database) { |
94 std::string origin_identifier = | 103 std::string origin_identifier = |
95 database.securityOrigin().databaseIdentifier().utf8(); | 104 database.securityOrigin().databaseIdentifier().utf8(); |
96 string16 database_name = database.name(); | 105 string16 database_name = database.name(); |
97 sender_->Send(new DatabaseHostMsg_Closed( | 106 sender_->Send(new DatabaseHostMsg_Closed( |
98 origin_identifier, database_name)); | 107 origin_identifier, database_name)); |
99 open_connections_->RemoveOpenConnection(origin_identifier, database_name); | 108 open_connections_->RemoveOpenConnection(origin_identifier, database_name); |
100 } | 109 } |
101 | 110 |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 // high frequency (per-sqlstatement). | 172 // high frequency (per-sqlstatement). |
164 if (error == SQLITE_CORRUPT || error == SQLITE_NOTADB) { | 173 if (error == SQLITE_CORRUPT || error == SQLITE_NOTADB) { |
165 sender_->Send(new DatabaseHostMsg_HandleSqliteError( | 174 sender_->Send(new DatabaseHostMsg_HandleSqliteError( |
166 database.securityOrigin().databaseIdentifier().utf8(), | 175 database.securityOrigin().databaseIdentifier().utf8(), |
167 database.name(), | 176 database.name(), |
168 error)); | 177 error)); |
169 } | 178 } |
170 } | 179 } |
171 | 180 |
172 } // namespace content | 181 } // namespace content |
OLD | NEW |