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

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

Issue 9614002: Use SyncMessageFilter to Send() ipc messages from background threads. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 9 months 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
« no previous file with comments | « content/common/web_database_observer_impl.h ('k') | content/renderer/render_thread_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 (c) 2011 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"
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 if (result) { \ 54 if (result) { \
55 UMA_HISTOGRAM_ENUMERATION("websql.Async." name ".ErrorSite", \ 55 UMA_HISTOGRAM_ENUMERATION("websql.Async." name ".ErrorSite", \
56 callsite, kCallsiteHistogramSize); \ 56 callsite, kCallsiteHistogramSize); \
57 } \ 57 } \
58 } \ 58 } \
59 } while (0) 59 } while (0)
60 60
61 } // namespace 61 } // namespace
62 62
63 WebDatabaseObserverImpl::WebDatabaseObserverImpl( 63 WebDatabaseObserverImpl::WebDatabaseObserverImpl(
64 IPC::Message::Sender* sender) 64 IPC::SyncMessageFilter* sender)
65 : sender_(sender), 65 : sender_(sender),
66 open_connections_(new webkit_database::DatabaseConnectionsWrapper) { 66 open_connections_(new webkit_database::DatabaseConnectionsWrapper) {
67 DCHECK(sender);
67 } 68 }
68 69
69 WebDatabaseObserverImpl::~WebDatabaseObserverImpl() { 70 WebDatabaseObserverImpl::~WebDatabaseObserverImpl() {
70 } 71 }
71 72
72 void WebDatabaseObserverImpl::databaseOpened( 73 void WebDatabaseObserverImpl::databaseOpened(
73 const WebDatabase& database) { 74 const WebDatabase& database) {
74 string16 origin_identifier = database.securityOrigin().databaseIdentifier(); 75 string16 origin_identifier = database.securityOrigin().databaseIdentifier();
75 string16 database_name = database.name(); 76 string16 database_name = database.name();
76 open_connections_->AddOpenConnection(origin_identifier, database_name); 77 open_connections_->AddOpenConnection(origin_identifier, database_name);
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 // We filter out errors which the backend doesn't act on to avoid 157 // We filter out errors which the backend doesn't act on to avoid
157 // a unnecessary ipc traffic, this method can get called at a fairly 158 // a unnecessary ipc traffic, this method can get called at a fairly
158 // high frequency (per-sqlstatement). 159 // high frequency (per-sqlstatement).
159 if (error == SQLITE_CORRUPT || error == SQLITE_NOTADB) { 160 if (error == SQLITE_CORRUPT || error == SQLITE_NOTADB) {
160 sender_->Send(new DatabaseHostMsg_HandleSqliteError( 161 sender_->Send(new DatabaseHostMsg_HandleSqliteError(
161 database.securityOrigin().databaseIdentifier(), 162 database.securityOrigin().databaseIdentifier(),
162 database.name(), 163 database.name(),
163 error)); 164 error));
164 } 165 }
165 } 166 }
OLDNEW
« no previous file with comments | « content/common/web_database_observer_impl.h ('k') | content/renderer/render_thread_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698