summaryrefslogtreecommitdiffstats
path: root/WebKit/android/jni/WebIconDatabase.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'WebKit/android/jni/WebIconDatabase.cpp')
-rw-r--r--WebKit/android/jni/WebIconDatabase.cpp18
1 files changed, 7 insertions, 11 deletions
diff --git a/WebKit/android/jni/WebIconDatabase.cpp b/WebKit/android/jni/WebIconDatabase.cpp
index daf0334..20258a4 100644
--- a/WebKit/android/jni/WebIconDatabase.cpp
+++ b/WebKit/android/jni/WebIconDatabase.cpp
@@ -13,7 +13,7 @@
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
@@ -67,10 +67,6 @@ static WebIconDatabase* gIconDatabaseClient = new WebIconDatabase();
// XXX: Called by the IconDatabase thread
void WebIconDatabase::dispatchDidAddIconForPageURL(const WebCore::String& pageURL)
{
- // If there are no clients currently, drop this message.
- if (mClients.size() == 0)
- return;
-
mNotificationsMutex.lock();
mNotifications.append(pageURL);
if (!mDeliveryRequested) {
@@ -83,23 +79,25 @@ void WebIconDatabase::dispatchDidAddIconForPageURL(const WebCore::String& pageUR
// Called in the WebCore thread
void WebIconDatabase::RegisterForIconNotification(WebIconDatabaseClient* client)
{
- gIconDatabaseClient->mClientsMutex.lock();
+ WebIconDatabase* db = gIconDatabaseClient;
+ for (unsigned i = 0; i < db->mClients.size(); ++i) {
+ // Do not add the same client twice.
+ if (db->mClients[i] == client)
+ return;
+ }
gIconDatabaseClient->mClients.append(client);
- gIconDatabaseClient->mClientsMutex.unlock();
}
// Called in the WebCore thread
void WebIconDatabase::UnregisterForIconNotification(WebIconDatabaseClient* client)
{
WebIconDatabase* db = gIconDatabaseClient;
- db->mClientsMutex.lock();
for (unsigned i = 0; i < db->mClients.size(); ++i) {
if (db->mClients[i] == client) {
db->mClients.remove(i);
break;
}
}
- db->mClientsMutex.unlock();
}
// Called in the WebCore thread
@@ -123,9 +121,7 @@ void WebIconDatabase::deliverNotifications()
// Swap the clients queue
Vector<WebIconDatabaseClient*> clients;
- mClientsMutex.lock();
clients.swap(mClients);
- mClientsMutex.unlock();
for (unsigned i = 0; i < queue.size(); ++i) {
for (unsigned j = 0; j < clients.size(); ++j) {