diff options
author | Patrick Scott <phanna@android.com> | 2009-07-28 15:24:16 -0400 |
---|---|---|
committer | Patrick Scott <phanna@android.com> | 2009-07-29 09:00:35 -0400 |
commit | 0deb5796f1ccc4ea91903fec3eda2c18ea5b3e37 (patch) | |
tree | 9574b757deeadd11f4dd2128f3a5247152fe5e04 | |
parent | 8456b60241dce135dbda5b6114fd3650366f5a9c (diff) | |
download | external_webkit-0deb5796f1ccc4ea91903fec3eda2c18ea5b3e37.zip external_webkit-0deb5796f1ccc4ea91903fec3eda2c18ea5b3e37.tar.gz external_webkit-0deb5796f1ccc4ea91903fec3eda2c18ea5b3e37.tar.bz2 |
Remove the WebIconDatabase thread attachment since ThreadingPthreads does it.
Also, delete threadData if pthread_create fails. This is a rare occurance but we
don't want to leak memory just in case.
-rw-r--r-- | JavaScriptCore/wtf/ThreadingPthreads.cpp | 1 | ||||
-rw-r--r-- | WebKit/android/jni/WebIconDatabase.cpp | 21 |
2 files changed, 3 insertions, 19 deletions
diff --git a/JavaScriptCore/wtf/ThreadingPthreads.cpp b/JavaScriptCore/wtf/ThreadingPthreads.cpp index f54dd3f..1aa5600 100644 --- a/JavaScriptCore/wtf/ThreadingPthreads.cpp +++ b/JavaScriptCore/wtf/ThreadingPthreads.cpp @@ -164,6 +164,7 @@ ThreadIdentifier createThreadInternal(ThreadFunction entryPoint, void* data, con if (pthread_create(&threadHandle, 0, runThreadWithRegistration, static_cast<void*>(threadData))) { LOG_ERROR("Failed to create pthread at entry point %p with data %p", entryPoint, data); + delete threadData; return 0; } return establishIdentifierForPthreadHandle(threadHandle); diff --git a/WebKit/android/jni/WebIconDatabase.cpp b/WebKit/android/jni/WebIconDatabase.cpp index c982c78..daf0334 100644 --- a/WebKit/android/jni/WebIconDatabase.cpp +++ b/WebKit/android/jni/WebIconDatabase.cpp @@ -71,28 +71,11 @@ void WebIconDatabase::dispatchDidAddIconForPageURL(const WebCore::String& pageUR if (mClients.size() == 0) return; - // Attempt to attach to the current vm. - JavaVM* vm = JSC::Bindings::getJavaVM(); - JavaVMAttachArgs args; - - args.version = JNI_VERSION_1_4; - args.name = "IconDatabase"; - args.group = NULL; - - JNIEnv* env; - bool threadIsAttached = true; - if (vm->AttachCurrentThread(&env, (void*) &args) != JNI_OK) { - LOGE("Could not attach IconDatabase thread to the VM"); - threadIsAttached = false; - } - mNotificationsMutex.lock(); mNotifications.append(pageURL); if (!mDeliveryRequested) { - if (threadIsAttached) { - mDeliveryRequested = true; - JavaSharedClient::EnqueueFunctionPtr(DeliverNotifications, this); - } + mDeliveryRequested = true; + JavaSharedClient::EnqueueFunctionPtr(DeliverNotifications, this); } mNotificationsMutex.unlock(); } |