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

Side by Side Diff: content/child/web_database_observer_impl.cc

Issue 2586483002: Use explicit WebString <-> string16 conversion methods in storage API files (Closed)
Patch Set: '' Created 4 years 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 | « content/child/indexed_db/webidbfactory_impl.cc ('k') | content/child/webfileutilities_impl.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 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/bind.h" 7 #include "base/bind.h"
8 #include "base/metrics/histogram_macros.h" 8 #include "base/metrics/histogram_macros.h"
9 #include "base/single_thread_task_runner.h" 9 #include "base/single_thread_task_runner.h"
10 #include "base/strings/string16.h" 10 #include "base/strings/string16.h"
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 75
76 WebDatabaseObserverImpl::~WebDatabaseObserverImpl() { 76 WebDatabaseObserverImpl::~WebDatabaseObserverImpl() {
77 } 77 }
78 78
79 void WebDatabaseObserverImpl::databaseOpened( 79 void WebDatabaseObserverImpl::databaseOpened(
80 const WebSecurityOrigin& origin, 80 const WebSecurityOrigin& origin,
81 const WebString& database_name, 81 const WebString& database_name,
82 const WebString& database_display_name, 82 const WebString& database_display_name,
83 unsigned long estimated_size) { 83 unsigned long estimated_size) {
84 open_connections_->AddOpenConnection(GetIdentifierFromOrigin(origin), 84 open_connections_->AddOpenConnection(GetIdentifierFromOrigin(origin),
85 database_name); 85 database_name.utf16());
86 sender_->Send(new DatabaseHostMsg_Opened( 86 sender_->Send(new DatabaseHostMsg_Opened(origin, database_name.utf16(),
87 origin, database_name, database_display_name, estimated_size)); 87 database_display_name.utf16(),
88 estimated_size));
88 } 89 }
89 90
90 void WebDatabaseObserverImpl::databaseModified(const WebSecurityOrigin& origin, 91 void WebDatabaseObserverImpl::databaseModified(const WebSecurityOrigin& origin,
91 const WebString& database_name) { 92 const WebString& database_name) {
92 sender_->Send(new DatabaseHostMsg_Modified(origin, database_name)); 93 sender_->Send(new DatabaseHostMsg_Modified(origin, database_name.utf16()));
93 } 94 }
94 95
95 void WebDatabaseObserverImpl::databaseClosed(const WebSecurityOrigin& origin, 96 void WebDatabaseObserverImpl::databaseClosed(const WebSecurityOrigin& origin,
96 const WebString& database_name) { 97 const WebString& database_name) {
97 DCHECK(!main_thread_task_runner_->RunsTasksOnCurrentThread()); 98 DCHECK(!main_thread_task_runner_->RunsTasksOnCurrentThread());
99 base::string16 database_name_utf16 = database_name.utf16();
98 main_thread_task_runner_->PostTask( 100 main_thread_task_runner_->PostTask(
99 FROM_HERE, 101 FROM_HERE,
100 base::Bind(base::IgnoreResult(&IPC::SyncMessageFilter::Send), sender_, 102 base::Bind(base::IgnoreResult(&IPC::SyncMessageFilter::Send), sender_,
101 new DatabaseHostMsg_Closed(origin, database_name))); 103 new DatabaseHostMsg_Closed(origin, database_name_utf16)));
102 open_connections_->RemoveOpenConnection(GetIdentifierFromOrigin(origin), 104 open_connections_->RemoveOpenConnection(GetIdentifierFromOrigin(origin),
103 database_name); 105 database_name_utf16);
104 } 106 }
105 107
106 void WebDatabaseObserverImpl::reportOpenDatabaseResult( 108 void WebDatabaseObserverImpl::reportOpenDatabaseResult(
107 const WebSecurityOrigin& origin, 109 const WebSecurityOrigin& origin,
108 const WebString& database_name, 110 const WebString& database_name,
109 int callsite, 111 int callsite,
110 int websql_error, 112 int websql_error,
111 int sqlite_error, 113 int sqlite_error,
112 double call_time) { 114 double call_time) {
113 UMA_HISTOGRAM_WEBSQL_RESULT("OpenResult", callsite, 115 UMA_HISTOGRAM_WEBSQL_RESULT("OpenResult", callsite,
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 return open_connections_->WaitForAllDatabasesToClose(timeout); 185 return open_connections_->WaitForAllDatabasesToClose(timeout);
184 } 186 }
185 187
186 void WebDatabaseObserverImpl::HandleSqliteError(const WebSecurityOrigin& origin, 188 void WebDatabaseObserverImpl::HandleSqliteError(const WebSecurityOrigin& origin,
187 const WebString& database_name, 189 const WebString& database_name,
188 int error) { 190 int error) {
189 // We filter out errors which the backend doesn't act on to avoid 191 // We filter out errors which the backend doesn't act on to avoid
190 // a unnecessary ipc traffic, this method can get called at a fairly 192 // a unnecessary ipc traffic, this method can get called at a fairly
191 // high frequency (per-sqlstatement). 193 // high frequency (per-sqlstatement).
192 if (error == SQLITE_CORRUPT || error == SQLITE_NOTADB) { 194 if (error == SQLITE_CORRUPT || error == SQLITE_NOTADB) {
193 sender_->Send( 195 sender_->Send(new DatabaseHostMsg_HandleSqliteError(
194 new DatabaseHostMsg_HandleSqliteError(origin, database_name, error)); 196 origin, database_name.utf16(), error));
195 } 197 }
196 } 198 }
197 199
198 } // namespace content 200 } // namespace content
OLDNEW
« no previous file with comments | « content/child/indexed_db/webidbfactory_impl.cc ('k') | content/child/webfileutilities_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698