diff options
author | Steve Block <steveblock@google.com> | 2009-12-19 20:20:17 +0000 |
---|---|---|
committer | Steve Block <steveblock@google.com> | 2009-12-21 16:52:07 +0000 |
commit | 5df9fcdb69c1d4f2009e1f7bad0d969f164dffc0 (patch) | |
tree | 2eee2c596c56a3b13e1545f705af5f96a5579557 /JavaScriptCore/wtf | |
parent | 36f687f9f79b594e08a1fb84059d381521f58949 (diff) | |
download | external_webkit-5df9fcdb69c1d4f2009e1f7bad0d969f164dffc0.zip external_webkit-5df9fcdb69c1d4f2009e1f7bad0d969f164dffc0.tar.gz external_webkit-5df9fcdb69c1d4f2009e1f7bad0d969f164dffc0.tar.bz2 |
Fixes MainThreadAndroid to use AndroidThreading, rather than calling methods on JavaSharedClient directly.
AndroidThreading is defined in WTF and implemented in WebKit. This is the
pattern used by Chromium, and avoids the current layering violation due to WTF
calling into WebKit.
This is being upstreamed to webkit.org in https://bugs.webkit.org/show_bug.cgi?id=32651
Change-Id: Ic58f0270ed134d9f897075cca692718d1c2e9369
Diffstat (limited to 'JavaScriptCore/wtf')
-rw-r--r-- | JavaScriptCore/wtf/android/AndroidThreading.h | 39 | ||||
-rw-r--r-- | JavaScriptCore/wtf/android/MainThreadAndroid.cpp | 12 |
2 files changed, 41 insertions, 10 deletions
diff --git a/JavaScriptCore/wtf/android/AndroidThreading.h b/JavaScriptCore/wtf/android/AndroidThreading.h new file mode 100644 index 0000000..27f548c --- /dev/null +++ b/JavaScriptCore/wtf/android/AndroidThreading.h @@ -0,0 +1,39 @@ +/* + * Copyright 2009, The Android Open Source Project + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 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 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 + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef AndroidThreading_h +#define AndroidThreading_h + +namespace WTF { + +// An interface to the embedding layer, which provides threading support. +class AndroidThreading { +public: + static void scheduleDispatchFunctionsOnMainThread(); +}; + +} // namespace WTF + +#endif // AndroidThreading_h diff --git a/JavaScriptCore/wtf/android/MainThreadAndroid.cpp b/JavaScriptCore/wtf/android/MainThreadAndroid.cpp index c28f953..5e5f7b1 100644 --- a/JavaScriptCore/wtf/android/MainThreadAndroid.cpp +++ b/JavaScriptCore/wtf/android/MainThreadAndroid.cpp @@ -26,25 +26,17 @@ #include "config.h" #include "MainThread.h" -#include "JavaSharedClient.h" - -using namespace android; +#include "AndroidThreading.h" namespace WTF { -// Callback in the main thread. -static void timeoutFired(void*) -{ - dispatchFunctionsFromMainThread(); -} - void initializeMainThreadPlatform() { } void scheduleDispatchFunctionsOnMainThread() { - JavaSharedClient::EnqueueFunctionPtr(timeoutFired, 0); + AndroidThreading::scheduleDispatchFunctionsOnMainThread(); } } // namespace WTF |