summaryrefslogtreecommitdiffstats
path: root/content
diff options
context:
space:
mode:
authormichaeln@google.com <michaeln@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-01 20:40:35 +0000
committermichaeln@google.com <michaeln@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-01 20:40:35 +0000
commit1d4dbdeaa23f3459fb710c8b2fe4d444266d952a (patch)
tree94064bd57faaba18d1ee7a9fe514628f58a6be55 /content
parent228d0659a51d0581c743b5b81921d43c7fd81e35 (diff)
downloadchromium_src-1d4dbdeaa23f3459fb710c8b2fe4d444266d952a.zip
chromium_src-1d4dbdeaa23f3459fb710c8b2fe4d444266d952a.tar.gz
chromium_src-1d4dbdeaa23f3459fb710c8b2fe4d444266d952a.tar.bz2
Changes to WebDatabaseObserverImpl and SimpleDatabaseSystem required to have a chance of working properly with v8 isolates. With isolates the database related interfaces will be called on multiple threads and the previous impl was not put together with that in mind.
BUG=none TEST=existing tests pass (no way to test with isolates yet) Review URL: http://codereview.chromium.org/6677088 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@80218 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r--content/common/web_database_observer_impl.cc19
-rw-r--r--content/common/web_database_observer_impl.h9
2 files changed, 12 insertions, 16 deletions
diff --git a/content/common/web_database_observer_impl.cc b/content/common/web_database_observer_impl.cc
index 37c3e2c..be3c8ca 100644
--- a/content/common/web_database_observer_impl.cc
+++ b/content/common/web_database_observer_impl.cc
@@ -4,8 +4,6 @@
#include "content/common/web_database_observer_impl.h"
-#include "base/auto_reset.h"
-#include "base/message_loop.h"
#include "base/string16.h"
#include "content/common/database_messages.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebDatabase.h"
@@ -14,17 +12,20 @@
WebDatabaseObserverImpl::WebDatabaseObserverImpl(
IPC::Message::Sender* sender)
: sender_(sender),
- waiting_for_dbs_to_close_(false) {
+ open_connections_(new webkit_database::DatabaseConnectionsWrapper) {
+}
+
+WebDatabaseObserverImpl::~WebDatabaseObserverImpl() {
}
void WebDatabaseObserverImpl::databaseOpened(
const WebKit::WebDatabase& database) {
string16 origin_identifier = database.securityOrigin().databaseIdentifier();
string16 database_name = database.name();
+ open_connections_->AddOpenConnection(origin_identifier, database_name);
sender_->Send(new DatabaseHostMsg_Opened(
origin_identifier, database_name,
database.displayName(), database.estimatedSize()));
- database_connections_.AddConnection(origin_identifier, database_name);
}
void WebDatabaseObserverImpl::databaseModified(
@@ -39,15 +40,9 @@ void WebDatabaseObserverImpl::databaseClosed(
string16 database_name = database.name();
sender_->Send(new DatabaseHostMsg_Closed(
origin_identifier, database_name));
- database_connections_.RemoveConnection(origin_identifier, database_name);
- if (waiting_for_dbs_to_close_ && database_connections_.IsEmpty())
- MessageLoop::current()->Quit();
+ open_connections_->RemoveOpenConnection(origin_identifier, database_name);
}
void WebDatabaseObserverImpl::WaitForAllDatabasesToClose() {
- if (!database_connections_.IsEmpty()) {
- AutoReset<bool> waiting_for_dbs_auto_reset(&waiting_for_dbs_to_close_, true);
- MessageLoop::ScopedNestableTaskAllower nestable(MessageLoop::current());
- MessageLoop::current()->Run();
- }
+ open_connections_->WaitForAllDatabasesToClose();
}
diff --git a/content/common/web_database_observer_impl.h b/content/common/web_database_observer_impl.h
index 442a7af..a79ee6f 100644
--- a/content/common/web_database_observer_impl.h
+++ b/content/common/web_database_observer_impl.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,6 +6,7 @@
#define CONTENT_COMMON_WEB_DATABASE_OBSERVER_IMPL_H_
#pragma once
+#include "base/memory/ref_counted.h"
#include "ipc/ipc_message.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebDatabaseObserver.h"
#include "webkit/database/database_connections.h"
@@ -13,7 +14,8 @@
class WebDatabaseObserverImpl : public WebKit::WebDatabaseObserver {
public:
explicit WebDatabaseObserverImpl(IPC::Message::Sender* sender);
- virtual ~WebDatabaseObserverImpl() {}
+ virtual ~WebDatabaseObserverImpl();
+
virtual void databaseOpened(const WebKit::WebDatabase& database);
virtual void databaseModified(const WebKit::WebDatabase& database);
virtual void databaseClosed(const WebKit::WebDatabase& database);
@@ -22,8 +24,7 @@ class WebDatabaseObserverImpl : public WebKit::WebDatabaseObserver {
private:
IPC::Message::Sender* sender_;
- bool waiting_for_dbs_to_close_;
- webkit_database::DatabaseConnections database_connections_;
+ scoped_refptr<webkit_database::DatabaseConnectionsWrapper> open_connections_;
};
#endif // CONTENT_COMMON_WEB_DATABASE_OBSERVER_IMPL_H_