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

Side by Side Diff: webkit/database/database_connections.cc

Issue 7583053: Add MessageLoopProxy::current (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: No need for MessageLoopProxy destruction observer. Created 9 years, 4 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "webkit/database/database_connections.h" 5 #include "webkit/database/database_connections.h"
6 6
7 #include "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/message_loop_proxy.h" 10 #include "base/message_loop_proxy.h"
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 if (count) 113 if (count)
114 return false; 114 return false;
115 db_connections.erase(database_name); 115 db_connections.erase(database_name);
116 if (db_connections.empty()) 116 if (db_connections.empty())
117 connections_.erase(origin_iterator); 117 connections_.erase(origin_iterator);
118 return true; 118 return true;
119 } 119 }
120 120
121 DatabaseConnectionsWrapper::DatabaseConnectionsWrapper() 121 DatabaseConnectionsWrapper::DatabaseConnectionsWrapper()
122 : waiting_for_dbs_to_close_(false), 122 : waiting_for_dbs_to_close_(false),
123 main_thread_(base::MessageLoopProxy::CreateForCurrentThread()) { 123 main_thread_(base::MessageLoopProxy::current()) {
124 } 124 }
125 125
126 DatabaseConnectionsWrapper::~DatabaseConnectionsWrapper() { 126 DatabaseConnectionsWrapper::~DatabaseConnectionsWrapper() {
127 } 127 }
128 128
129 void DatabaseConnectionsWrapper::WaitForAllDatabasesToClose() { 129 void DatabaseConnectionsWrapper::WaitForAllDatabasesToClose() {
130 // We assume that new databases won't be open while we're waiting. 130 // We assume that new databases won't be open while we're waiting.
131 DCHECK(main_thread_->BelongsToCurrentThread()); 131 DCHECK(main_thread_->BelongsToCurrentThread());
132 if (HasOpenConnections()) { 132 if (HasOpenConnections()) {
133 AutoReset<bool> auto_reset(&waiting_for_dbs_to_close_, true); 133 AutoReset<bool> auto_reset(&waiting_for_dbs_to_close_, true);
(...skipping 27 matching lines...) Expand all
161 origin_identifier, database_name)); 161 origin_identifier, database_name));
162 return; 162 return;
163 } 163 }
164 base::AutoLock auto_lock(open_connections_lock_); 164 base::AutoLock auto_lock(open_connections_lock_);
165 open_connections_.RemoveConnection(origin_identifier, database_name); 165 open_connections_.RemoveConnection(origin_identifier, database_name);
166 if (waiting_for_dbs_to_close_ && open_connections_.IsEmpty()) 166 if (waiting_for_dbs_to_close_ && open_connections_.IsEmpty())
167 MessageLoop::current()->Quit(); 167 MessageLoop::current()->Quit();
168 } 168 }
169 169
170 } // namespace webkit_database 170 } // namespace webkit_database
OLDNEW
« no previous file with comments | « webkit/blob/deletable_file_reference_unittest.cc ('k') | webkit/database/database_quota_client_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698