summaryrefslogtreecommitdiffstats
path: root/WebKit/android
diff options
context:
space:
mode:
Diffstat (limited to 'WebKit/android')
-rw-r--r--WebKit/android/TimeCounter.cpp3
-rw-r--r--WebKit/android/WebCoreSupport/CookieClient.h (renamed from WebKit/android/stl/limits)25
-rw-r--r--WebKit/android/WebCoreSupport/MediaPlayerPrivateAndroid.cpp19
-rw-r--r--WebKit/android/WebCoreSupport/PlatformBridge.cpp66
-rw-r--r--WebKit/android/icu/unicode/ucnv.cpp9
-rw-r--r--WebKit/android/jni/JavaBridge.cpp29
-rw-r--r--WebKit/android/jni/JavaSharedClient.cpp9
-rw-r--r--WebKit/android/jni/WebCoreFrameBridge.cpp135
-rw-r--r--WebKit/android/jni/WebCoreJni.cpp35
-rw-r--r--WebKit/android/jni/WebCoreJni.h6
-rw-r--r--WebKit/android/jni/WebCoreJniOnLoad.cpp2
-rw-r--r--WebKit/android/jni/WebHistory.cpp5
-rw-r--r--WebKit/android/jni/WebHistory.h2
-rw-r--r--WebKit/android/jni/WebIconDatabase.cpp16
-rw-r--r--WebKit/android/jni/WebIconDatabase.h3
-rw-r--r--WebKit/android/jni/WebStorage.cpp6
-rw-r--r--WebKit/android/jni/WebViewCore.cpp480
-rw-r--r--WebKit/android/jni/WebViewCore.h4
-rw-r--r--WebKit/android/nav/SelectText.cpp88
-rw-r--r--WebKit/android/nav/SelectText.h4
-rw-r--r--WebKit/android/nav/WebView.cpp131
-rw-r--r--WebKit/android/plugins/ANPSoundInterface.cpp1
-rw-r--r--WebKit/android/sort.cpp56
-rw-r--r--WebKit/android/stl/algorithm277
-rw-r--r--WebKit/android/stl/concept_checks.h812
-rw-r--r--WebKit/android/stl/cstring128
-rw-r--r--WebKit/android/stl/heap.h48
-rw-r--r--WebKit/android/stl/memory132
-rw-r--r--WebKit/android/stl/new.h25
-rw-r--r--WebKit/android/stl/stl_config.h577
-rw-r--r--WebKit/android/stl/stl_heap.h298
-rw-r--r--WebKit/android/stl/stl_iterator_base.h274
-rw-r--r--WebKit/android/stl/strings.h25
33 files changed, 383 insertions, 3347 deletions
diff --git a/WebKit/android/TimeCounter.cpp b/WebKit/android/TimeCounter.cpp
index 61584a7..da09b07 100644
--- a/WebKit/android/TimeCounter.cpp
+++ b/WebKit/android/TimeCounter.cpp
@@ -37,6 +37,9 @@
#include <utils/Log.h>
#include <wtf/CurrentTime.h>
+#include <sys/time.h>
+#include <time.h>
+
#if USE(JSC)
#include "JSDOMWindow.h"
#include <runtime/JSGlobalObject.h>
diff --git a/WebKit/android/stl/limits b/WebKit/android/WebCoreSupport/CookieClient.h
index 672e605..56d9382 100644
--- a/WebKit/android/stl/limits
+++ b/WebKit/android/WebCoreSupport/CookieClient.h
@@ -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
@@ -23,9 +23,24 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef __ANDROID_LIMITS
-#define __ANDROID_LIMITS
+#ifndef COOKIE_CLIENT_H
+#define COOKIE_CLIENT_H
-#include <limits.h>
+#include <KURL.h>
+#include <PlatformString.h>
-#endif // __ANDROID_LIMITS
+using namespace WebCore;
+
+namespace android {
+
+class CookieClient {
+
+public:
+ virtual ~CookieClient() {}
+ virtual void setCookies(const KURL& url, const String& value) = 0;
+ virtual String cookies(const KURL& url) = 0;
+ virtual bool cookiesEnabled() = 0;
+};
+
+}
+#endif
diff --git a/WebKit/android/WebCoreSupport/MediaPlayerPrivateAndroid.cpp b/WebKit/android/WebCoreSupport/MediaPlayerPrivateAndroid.cpp
index 00e973e..1bb8802 100644
--- a/WebKit/android/WebCoreSupport/MediaPlayerPrivateAndroid.cpp
+++ b/WebKit/android/WebCoreSupport/MediaPlayerPrivateAndroid.cpp
@@ -121,7 +121,7 @@ bool MediaPlayerPrivate::hasAudio() const
bool MediaPlayerPrivate::hasVideo() const
{
- return false;
+ return m_hasVideo;
}
void MediaPlayerPrivate::setVisible(bool visible)
@@ -282,6 +282,7 @@ MediaPlayerPrivate::MediaPlayerPrivate(MediaPlayer* player)
m_duration(6000),
m_currentTime(0),
m_paused(true),
+ m_hasVideo(false),
m_readyState(MediaPlayer::HaveNothing),
m_networkState(MediaPlayer::Empty),
m_poster(0),
@@ -352,6 +353,7 @@ void MediaPlayerPrivate::onPrepared(int duration, int width, int height) {
m_duration = duration / 1000.0f;
m_naturalSize = IntSize(width, height);
m_naturalSizeUnknown = false;
+ m_hasVideo = true;
m_player->durationChanged();
m_player->sizeChanged();
}
@@ -361,6 +363,7 @@ void MediaPlayerPrivate::onEnded() {
m_player->timeChanged();
m_paused = true;
m_currentTime = 0;
+ m_hasVideo = false;
m_networkState = MediaPlayer::Idle;
m_readyState = MediaPlayer::HaveNothing;
}
@@ -379,6 +382,11 @@ void MediaPlayerPrivate::onPosterFetched(SkBitmap* poster) {
}
}
+void MediaPlayerPrivate::onTimeupdate(int position) {
+ m_currentTime = position / 1000.0f;
+ m_player->timeChanged();
+}
+
}
namespace android {
@@ -408,6 +416,13 @@ static void OnPosterFetched(JNIEnv* env, jobject obj, jobject poster, int pointe
player->onPosterFetched(posterNative);
}
+static void OnTimeupdate(JNIEnv* env, jobject obj, int position, int pointer) {
+ if (pointer) {
+ WebCore::MediaPlayerPrivate* player = reinterpret_cast<WebCore::MediaPlayerPrivate*>(pointer);
+ player->onTimeupdate(position);
+ }
+}
+
/*
* JNI registration
*/
@@ -418,6 +433,8 @@ static JNINativeMethod g_MediaPlayerMethods[] = {
(void*) OnEnded },
{ "nativeOnPosterFetched", "(Landroid/graphics/Bitmap;I)V",
(void*) OnPosterFetched },
+ { "nativeOnTimeupdate", "(II)V",
+ (void*) OnTimeupdate },
};
int register_mediaplayer(JNIEnv* env)
diff --git a/WebKit/android/WebCoreSupport/PlatformBridge.cpp b/WebKit/android/WebCoreSupport/PlatformBridge.cpp
index e93d3da..f36ecf7 100644
--- a/WebKit/android/WebCoreSupport/PlatformBridge.cpp
+++ b/WebKit/android/WebCoreSupport/PlatformBridge.cpp
@@ -24,11 +24,14 @@
*/
#include "config.h"
-#include "PlatformBridge.h"
+#include <PlatformBridge.h>
+#include "CookieClient.h"
#include "JavaSharedClient.h"
#include "KeyGeneratorClient.h"
#include "WebViewCore.h"
+#include <wtf/android/AndroidThreading.h>
+#include <wtf/MainThread.h>
using namespace android;
@@ -68,4 +71,65 @@ String PlatformBridge::getSignedPublicKeyAndChallengeString(unsigned index, cons
return client->getSignedPublicKeyAndChallengeString(index, challenge, url);
}
+void PlatformBridge::setCookies(const KURL& url, const String& value)
+{
+ CookieClient* client = JavaSharedClient::GetCookieClient();
+ if (!client)
+ return;
+
+ client->setCookies(url, value);
+}
+
+String PlatformBridge::cookies(const KURL& url)
+{
+ CookieClient* client = JavaSharedClient::GetCookieClient();
+ if (!client)
+ return String();
+
+ return client->cookies(url);
+}
+
+bool PlatformBridge::cookiesEnabled()
+{
+ CookieClient* client = JavaSharedClient::GetCookieClient();
+ if (!client)
+ return false;
+
+ return client->cookiesEnabled();
}
+
+bool PlatformBridge::isWebViewPaused()
+{
+ return WebViewCore::isPaused();
+}
+
+} // namespace WebCore
+
+
+// This is the implementation of AndroidThreading, which is declared in
+// JavaScriptCore/wtf/android/AndroidThreading.h. It is provided here, rather
+// than in its own source file, to avoid linker problems.
+//
+// By default, when building a shared library, the linker strips from static
+// libraries any compilation units which do not contain any code referenced from
+// that static library. Since
+// AndroidThreading::scheduleDispatchFunctionsOnMainThread is not referenced
+// from libwebcore.a, implementing it in its own compilation unit results in it
+// being stripped. This stripping can be avoided by using the linker option
+// --whole-archive for libwebcore.a, but this adds considerably to the size of
+// libwebcore.so.
+
+namespace WTF {
+
+// Callback in the main thread.
+static void timeoutFired(void*)
+{
+ dispatchFunctionsFromMainThread();
+}
+
+void AndroidThreading::scheduleDispatchFunctionsOnMainThread()
+{
+ JavaSharedClient::EnqueueFunctionPtr(timeoutFired, 0);
+}
+
+} // namespace WTF
diff --git a/WebKit/android/icu/unicode/ucnv.cpp b/WebKit/android/icu/unicode/ucnv.cpp
index 6407a09..1963dd2 100644
--- a/WebKit/android/icu/unicode/ucnv.cpp
+++ b/WebKit/android/icu/unicode/ucnv.cpp
@@ -23,6 +23,15 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+// BEGIN android-added
+// Add config.h to avoid compiler error in uobject.h
+// ucnv.h includes uobject.h indirectly and uobjetcs.h defines new/delete.
+// new/delete are also defined in WebCorePrefix.h which auto included in Android make.
+//
+// config.h has to be on top of the include list.
+#include "config.h"
+// END android-added
+
#include "EmojiFont.h"
#include <icu4c/common/unicode/ucnv.h>
diff --git a/WebKit/android/jni/JavaBridge.cpp b/WebKit/android/jni/JavaBridge.cpp
index 842d841..049a7da 100644
--- a/WebKit/android/jni/JavaBridge.cpp
+++ b/WebKit/android/jni/JavaBridge.cpp
@@ -101,7 +101,7 @@ public:
static void UpdatePluginDirectories(JNIEnv* env, jobject obj, jobjectArray array, jboolean reload);
private:
- jobject mJavaObject;
+ jweak mJavaObject;
jmethodID mSetSharedTimer;
jmethodID mStopSharedTimer;
jmethodID mSetCookies;
@@ -118,7 +118,7 @@ static void (*sSharedTimerFiredCallback)();
JavaBridge::JavaBridge(JNIEnv* env, jobject obj)
{
- mJavaObject = adoptGlobalRef(env, obj);
+ mJavaObject = env->NewWeakGlobalRef(obj);
jclass clazz = env->GetObjectClass(obj);
mSetSharedTimer = env->GetMethodID(clazz, "setSharedTimer", "(J)V");
@@ -152,7 +152,7 @@ JavaBridge::~JavaBridge()
{
if (mJavaObject) {
JNIEnv* env = JSC::Bindings::getJNIEnv();
- env->DeleteGlobalRef(mJavaObject);
+ env->DeleteWeakGlobalRef(mJavaObject);
mJavaObject = 0;
}
@@ -167,8 +167,6 @@ JavaBridge::setSharedTimer(long long timemillis)
{
JNIEnv* env = JSC::Bindings::getJNIEnv();
AutoJObject obj = getRealObject(env, mJavaObject);
- if (!obj.get())
- return;
env->CallVoidMethod(obj.get(), mSetSharedTimer, timemillis);
}
@@ -177,8 +175,6 @@ JavaBridge::stopSharedTimer()
{
JNIEnv* env = JSC::Bindings::getJNIEnv();
AutoJObject obj = getRealObject(env, mJavaObject);
- if (!obj.get())
- return;
env->CallVoidMethod(obj.get(), mStopSharedTimer);
}
@@ -186,13 +182,11 @@ void
JavaBridge::setCookies(WebCore::KURL const& url, WebCore::String const& value)
{
JNIEnv* env = JSC::Bindings::getJNIEnv();
- AutoJObject obj = getRealObject(env, mJavaObject);
- if (!obj.get())
- return;
const WebCore::String& urlStr = url.string();
jstring jUrlStr = env->NewString(urlStr.characters(), urlStr.length());
jstring jValueStr = env->NewString(value.characters(), value.length());
+ AutoJObject obj = getRealObject(env, mJavaObject);
env->CallVoidMethod(obj.get(), mSetCookies, jUrlStr, jValueStr);
env->DeleteLocalRef(jUrlStr);
env->DeleteLocalRef(jValueStr);
@@ -203,10 +197,9 @@ JavaBridge::cookies(WebCore::KURL const& url)
{
JNIEnv* env = JSC::Bindings::getJNIEnv();
const WebCore::String& urlStr = url.string();
- AutoJObject obj = getRealObject(env, mJavaObject);
- if (!obj.get())
- return WebCore::String();
jstring jUrlStr = env->NewString(urlStr.characters(), urlStr.length());
+
+ AutoJObject obj = getRealObject(env, mJavaObject);
jstring string = (jstring)(env->CallObjectMethod(obj.get(), mCookies, jUrlStr));
WebCore::String ret = to_string(env, string);
@@ -220,8 +213,6 @@ JavaBridge::cookiesEnabled()
{
JNIEnv* env = JSC::Bindings::getJNIEnv();
AutoJObject obj = getRealObject(env, mJavaObject);
- if (!obj.get())
- return false;
jboolean ret = env->CallBooleanMethod(obj.get(), mCookiesEnabled);
return (ret != 0);
}
@@ -232,8 +223,6 @@ JavaBridge::getPluginDirectories()
WTF::Vector<WebCore::String> directories;
JNIEnv* env = JSC::Bindings::getJNIEnv();
AutoJObject obj = getRealObject(env, mJavaObject);
- if (!obj.get())
- return directories;
jobjectArray array = (jobjectArray)
env->CallObjectMethod(obj.get(), mGetPluginDirectories);
int count = env->GetArrayLength(array);
@@ -252,8 +241,6 @@ JavaBridge::getPluginSharedDataDirectory()
{
JNIEnv* env = JSC::Bindings::getJNIEnv();
AutoJObject obj = getRealObject(env, mJavaObject);
- if (!obj.get())
- return WebCore::String();
jstring ret = (jstring)env->CallObjectMethod(obj.get(), mGetPluginSharedDataDirectory);
WebCore::String path = to_string(env, ret);
checkException(env);
@@ -276,8 +263,6 @@ void JavaBridge::signalServiceFuncPtrQueue()
// environment is setup.
JNIEnv* env = JSC::Bindings::getJNIEnv();
AutoJObject obj = getRealObject(env, mJavaObject);
- if (!obj.get())
- return;
env->CallVoidMethod(obj.get(), mSignalFuncPtrQueue);
}
@@ -285,8 +270,6 @@ WTF::Vector<WebCore::String>JavaBridge::getSupportedKeyStrengthList() {
WTF::Vector<WebCore::String> list;
JNIEnv* env = JSC::Bindings::getJNIEnv();
AutoJObject obj = getRealObject(env, mJavaObject);
- if (!obj.get())
- return list;
jobjectArray array = (jobjectArray) env->CallObjectMethod(obj.get(),
mGetKeyStrengthList);
int count = env->GetArrayLength(array);
diff --git a/WebKit/android/jni/JavaSharedClient.cpp b/WebKit/android/jni/JavaSharedClient.cpp
index b9ecff7..ce46570 100644
--- a/WebKit/android/jni/JavaSharedClient.cpp
+++ b/WebKit/android/jni/JavaSharedClient.cpp
@@ -102,24 +102,23 @@ namespace android {
void JavaSharedClient::ServiceFunctionPtrQueue()
{
for (;;) {
- void (*proc)(void*);
- void* payload;
+ void (*proc)(void*) = 0;
+ void* payload = 0;
const FuncPtrRec* rec;
// we have to copy the proc/payload (if present). we do this so we
// don't call the proc inside the mutex (possible deadlock!)
gFuncPtrQMutex.acquire();
rec = (const FuncPtrRec*)gFuncPtrQ.front();
- if (NULL != rec) {
+ if (rec) {
proc = rec->fProc;
payload = rec->fPayload;
gFuncPtrQ.pop_front();
}
gFuncPtrQMutex.release();
- if (NULL == rec) {
+ if (!rec)
break;
- }
proc(payload);
}
}
diff --git a/WebKit/android/jni/WebCoreFrameBridge.cpp b/WebKit/android/jni/WebCoreFrameBridge.cpp
index ee39462..150c428 100644
--- a/WebKit/android/jni/WebCoreFrameBridge.cpp
+++ b/WebKit/android/jni/WebCoreFrameBridge.cpp
@@ -171,8 +171,8 @@ namespace android {
struct WebFrame::JavaBrowserFrame
{
- jobject mObj;
- jobject mHistoryList; // WebBackForwardList object
+ jweak mObj;
+ jweak mHistoryList; // WebBackForwardList object
jmethodID mStartLoadingResource;
jmethodID mLoadStarted;
jmethodID mTransitionToCommitted;
@@ -212,8 +212,8 @@ WebFrame::WebFrame(JNIEnv* env, jobject obj, jobject historyList, WebCore::Page*
{
jclass clazz = env->GetObjectClass(obj);
mJavaFrame = new JavaBrowserFrame;
- mJavaFrame->mObj = adoptGlobalRef(env, obj);
- mJavaFrame->mHistoryList = adoptGlobalRef(env, historyList);
+ mJavaFrame->mObj = env->NewWeakGlobalRef(obj);
+ mJavaFrame->mHistoryList = env->NewWeakGlobalRef(historyList);
mJavaFrame->mStartLoadingResource = env->GetMethodID(clazz, "startLoadingResource",
"(ILjava/lang/String;Ljava/lang/String;Ljava/util/HashMap;[BJIZZZ)Landroid/webkit/LoadListener;");
mJavaFrame->mLoadStarted = env->GetMethodID(clazz, "loadStarted",
@@ -281,8 +281,8 @@ WebFrame::~WebFrame()
{
if (mJavaFrame->mObj) {
JNIEnv* env = getJNIEnv();
- env->DeleteGlobalRef(mJavaFrame->mObj);
- env->DeleteGlobalRef(mJavaFrame->mHistoryList);
+ env->DeleteWeakGlobalRef(mJavaFrame->mObj);
+ env->DeleteWeakGlobalRef(mJavaFrame->mHistoryList);
mJavaFrame->mObj = 0;
}
delete mJavaFrame;
@@ -381,10 +381,6 @@ WebFrame::startLoadingResource(WebCore::ResourceHandle* loader,
WebCore::HTTPHeaderMap headers = request.httpHeaderFields();
JNIEnv* env = getJNIEnv();
- AutoJObject obj = mJavaFrame->frame(env);
- if (!obj.get())
- return 0;
-
WebCore::String urlStr = request.url().string();
int colon = urlStr.find(':');
bool allLower = true;
@@ -405,6 +401,7 @@ WebFrame::startLoadingResource(WebCore::ResourceHandle* loader,
jMethodStr = env->NewString(method.characters(), method.length());
jbyteArray jPostDataStr = NULL;
WebCore::FormData* formdata = request.httpBody();
+ AutoJObject obj = mJavaFrame->frame(env);
if (formdata) {
// We can use the formdata->flatten() but it will result in two
// memcpys, first through loading up the vector with the form data
@@ -487,10 +484,10 @@ WebFrame::startLoadingResource(WebCore::ResourceHandle* loader,
jobject jLoadListener =
env->CallObjectMethod(obj.get(), mJavaFrame->mStartLoadingResource,
- (int)loader, jUrlStr, jMethodStr, jHeaderMap,
- jPostDataStr, formdata ? formdata->identifier(): 0,
- cacheMode, mainResource, request.getUserGesture(),
- synchronous);
+ (int)loader, jUrlStr, jMethodStr, jHeaderMap,
+ jPostDataStr, formdata ? formdata->identifier(): 0,
+ cacheMode, mainResource, request.getUserGesture(),
+ synchronous);
env->DeleteLocalRef(jUrlStr);
env->DeleteLocalRef(jMethodStr);
@@ -515,13 +512,11 @@ WebFrame::reportError(int errorCode, const WebCore::String& description,
#endif
LOGV("::WebCore:: reportError(%d, %s)", errorCode, description.ascii().data());
JNIEnv* env = getJNIEnv();
- AutoJObject obj = mJavaFrame->frame(env);
- if (!obj.get())
- return;
jstring descStr = env->NewString((unsigned short*)description.characters(), description.length());
jstring failUrl = env->NewString((unsigned short*)failingUrl.characters(), failingUrl.length());
- env->CallVoidMethod(obj.get(), mJavaFrame->mReportError, errorCode, descStr, failUrl);
+ env->CallVoidMethod(mJavaFrame->frame(env).get(), mJavaFrame->mReportError,
+ errorCode, descStr, failUrl);
env->DeleteLocalRef(descStr);
env->DeleteLocalRef(failUrl);
}
@@ -547,9 +542,6 @@ WebFrame::loadStarted(WebCore::Frame* frame)
return;
JNIEnv* env = getJNIEnv();
- AutoJObject obj = mJavaFrame->frame(env);
- if (!obj.get())
- return;
WebCore::String urlString(url.string());
// If this is the main frame and we already have a favicon in the database,
// send it along with the page started notification.
@@ -562,7 +554,7 @@ WebFrame::loadStarted(WebCore::Frame* frame)
}
jstring urlStr = env->NewString((unsigned short*)urlString.characters(), urlString.length());
- env->CallVoidMethod(obj.get(), mJavaFrame->mLoadStarted, urlStr, favicon,
+ env->CallVoidMethod(mJavaFrame->frame(env).get(), mJavaFrame->mLoadStarted, urlStr, favicon,
(int)loadType, isMainFrame);
checkException(env);
env->DeleteLocalRef(urlStr);
@@ -587,12 +579,9 @@ WebFrame::transitionToCommitted(WebCore::Frame* frame)
TimeCounterAuto counter(TimeCounter::JavaCallbackTimeCounter);
#endif
JNIEnv* env = getJNIEnv();
- AutoJObject obj = mJavaFrame->frame(env);
- if (!obj.get())
- return;
WebCore::FrameLoadType loadType = frame->loader()->loadType();
bool isMainFrame = (!frame->tree() || !frame->tree()->parent());
- env->CallVoidMethod(obj.get(), mJavaFrame->mTransitionToCommitted,
+ env->CallVoidMethod(mJavaFrame->frame(env).get(), mJavaFrame->mTransitionToCommitted,
(int)loadType, isMainFrame);
checkException(env);
}
@@ -604,9 +593,6 @@ WebFrame::didFinishLoad(WebCore::Frame* frame)
TimeCounterAuto counter(TimeCounter::JavaCallbackTimeCounter);
#endif
JNIEnv* env = getJNIEnv();
- AutoJObject obj = mJavaFrame->frame(env);
- if (!obj.get())
- return;
WebCore::FrameLoader* loader = frame->loader();
const WebCore::KURL& url = loader->activeDocumentLoader()->url();
if (url.isEmpty())
@@ -617,7 +603,7 @@ WebFrame::didFinishLoad(WebCore::Frame* frame)
WebCore::FrameLoadType loadType = loader->loadType();
WebCore::String urlString(url.string());
jstring urlStr = env->NewString((unsigned short*)urlString.characters(), urlString.length());
- env->CallVoidMethod(obj.get(), mJavaFrame->mLoadFinished, urlStr,
+ env->CallVoidMethod(mJavaFrame->frame(env).get(), mJavaFrame->mLoadFinished, urlStr,
(int)loadType, isMainFrame);
checkException(env);
env->DeleteLocalRef(urlStr);
@@ -666,12 +652,9 @@ WebFrame::setTitle(const WebCore::String& title)
LOGV("setTitle(%s)", title.ascii().data());
#endif
JNIEnv* env = getJNIEnv();
- AutoJObject obj = mJavaFrame->frame(env);
- if (!obj.get())
- return;
jstring jTitleStr = env->NewString((unsigned short *)title.characters(), title.length());
- env->CallVoidMethod(obj.get(), mJavaFrame->mSetTitle,
+ env->CallVoidMethod(mJavaFrame->frame(env).get(), mJavaFrame->mSetTitle,
jTitleStr);
checkException(env);
env->DeleteLocalRef(jTitleStr);
@@ -685,11 +668,8 @@ WebFrame::windowObjectCleared(WebCore::Frame* frame)
#endif
LOGV("::WebCore:: windowObjectCleared");
JNIEnv* env = getJNIEnv();
- AutoJObject obj = mJavaFrame->frame(env);
- if (!obj.get())
- return;
- env->CallVoidMethod(obj.get(), mJavaFrame->mWindowObjectCleared, (int)frame);
+ env->CallVoidMethod(mJavaFrame->frame(env).get(), mJavaFrame->mWindowObjectCleared, (int)frame);
checkException(env);
}
@@ -700,11 +680,8 @@ WebFrame::setProgress(float newProgress)
TimeCounterAuto counter(TimeCounter::JavaCallbackTimeCounter);
#endif
JNIEnv* env = getJNIEnv();
- AutoJObject obj = mJavaFrame->frame(env);
- if (!obj.get())
- return;
int progress = (int) (100 * newProgress);
- env->CallVoidMethod(obj.get(), mJavaFrame->mSetProgress, progress);
+ env->CallVoidMethod(mJavaFrame->frame(env).get(), mJavaFrame->mSetProgress, progress);
checkException(env);
}
@@ -722,14 +699,11 @@ WebFrame::didReceiveIcon(WebCore::Image* icon)
#endif
LOG_ASSERT(icon, "DidReceiveIcon called without an image!");
JNIEnv* env = getJNIEnv();
- AutoJObject obj = mJavaFrame->frame(env);
- if (!obj.get())
- return;
jobject bitmap = webcoreImageToJavaBitmap(env, icon);
if (!bitmap)
return;
- env->CallVoidMethod(obj.get(), mJavaFrame->mDidReceiveIcon, bitmap);
+ env->CallVoidMethod(mJavaFrame->frame(env).get(), mJavaFrame->mDidReceiveIcon, bitmap);
env->DeleteLocalRef(bitmap);
checkException(env);
}
@@ -741,13 +715,10 @@ WebFrame::didReceiveTouchIconURL(const WebCore::String& url, bool precomposed)
TimeCounterAuto counter(TimeCounter::JavaCallbackTimeCounter);
#endif
JNIEnv* env = getJNIEnv();
- AutoJObject obj = mJavaFrame->frame(env);
- if (!obj.get())
- return;
jstring jUrlStr = env->NewString((unsigned short*)url.characters(),
url.length());
- env->CallVoidMethod(obj.get(),
+ env->CallVoidMethod(mJavaFrame->frame(env).get(),
mJavaFrame->mDidReceiveTouchIconUrl, jUrlStr, precomposed);
checkException(env);
}
@@ -760,13 +731,9 @@ WebFrame::updateVisitedHistory(const WebCore::KURL& url, bool reload)
#endif
WebCore::String urlStr(url.string());
JNIEnv* env = getJNIEnv();
- AutoJObject obj = mJavaFrame->frame(env);
- if (!obj.get())
- return;
-
jstring jUrlStr = env->NewString((unsigned short*)urlStr.characters(), urlStr.length());
- env->CallVoidMethod(obj.get(), mJavaFrame->mUpdateVisitedHistory, jUrlStr, reload);
+ env->CallVoidMethod(mJavaFrame->frame(env).get(), mJavaFrame->mUpdateVisitedHistory, jUrlStr, reload);
checkException(env);
}
@@ -790,14 +757,11 @@ WebFrame::canHandleRequest(const WebCore::ResourceRequest& request)
if (url.isEmpty())
return true;
JNIEnv* env = getJNIEnv();
- AutoJObject obj = mJavaFrame->frame(env);
- if (!obj.get())
- return true;
jstring jUrlStr = env->NewString((unsigned short *)url.characters(), url.length());
// check to see whether browser app wants to hijack url loading.
// if browser app handles the url, we will return false to bail out WebCore loading
- jboolean ret = env->CallBooleanMethod(obj.get(), mJavaFrame->mHandleUrl, jUrlStr);
+ jboolean ret = env->CallBooleanMethod(mJavaFrame->frame(env).get(), mJavaFrame->mHandleUrl, jUrlStr);
checkException(env);
return (ret == 0);
}
@@ -809,13 +773,10 @@ WebFrame::createWindow(bool dialog, bool userGesture)
TimeCounterAuto counter(TimeCounter::JavaCallbackTimeCounter);
#endif
JNIEnv* env = getJNIEnv();
- AutoJObject obj = mJavaFrame->frame(env);
- if (!obj.get())
- return NULL;
- jobject jobj = env->CallObjectMethod(obj.get(),
+ jobject obj = env->CallObjectMethod(mJavaFrame->frame(env).get(),
mJavaFrame->mCreateWindow, dialog, userGesture);
- if (jobj) {
- WebCore::Frame* frame = GET_NATIVE_FRAME(env, jobj);
+ if (obj) {
+ WebCore::Frame* frame = GET_NATIVE_FRAME(env, obj);
return frame;
}
return NULL;
@@ -828,10 +789,7 @@ WebFrame::requestFocus() const
TimeCounterAuto counter(TimeCounter::JavaCallbackTimeCounter);
#endif
JNIEnv* env = getJNIEnv();
- AutoJObject obj = mJavaFrame->frame(env);
- if (!obj.get())
- return;
- env->CallVoidMethod(obj.get(), mJavaFrame->mRequestFocus);
+ env->CallVoidMethod(mJavaFrame->frame(env).get(), mJavaFrame->mRequestFocus);
checkException(env);
}
@@ -843,10 +801,7 @@ WebFrame::closeWindow(WebViewCore* webViewCore)
#endif
assert(webViewCore);
JNIEnv* env = getJNIEnv();
- AutoJObject obj = mJavaFrame->frame(env);
- if (!obj.get())
- return;
- env->CallVoidMethod(obj.get(), mJavaFrame->mCloseWindow,
+ env->CallVoidMethod(mJavaFrame->frame(env).get(), mJavaFrame->mCloseWindow,
webViewCore->getJavaObject().get());
}
@@ -861,22 +816,16 @@ WebFrame::decidePolicyForFormResubmission(WebCore::FramePolicyFunction func)
TimeCounterAuto counter(TimeCounter::JavaCallbackTimeCounter);
#endif
JNIEnv* env = getJNIEnv();
- AutoJObject obj = mJavaFrame->frame(env);
- if (!obj.get())
- return;
PolicyFunctionWrapper* p = new PolicyFunctionWrapper;
p->func = func;
- env->CallVoidMethod(obj.get(), mJavaFrame->mDecidePolicyForFormResubmission, p);
+ env->CallVoidMethod(mJavaFrame->frame(env).get(), mJavaFrame->mDecidePolicyForFormResubmission, p);
}
WebCore::String
WebFrame::getRawResourceFilename(WebCore::PlatformBridge::rawResId id) const
{
JNIEnv* env = getJNIEnv();
- AutoJObject obj = mJavaFrame->frame(env);
- if (!obj.get())
- return WebCore::String();
- jstring ret = (jstring) env->CallObjectMethod(obj.get(),
+ jstring ret = (jstring) env->CallObjectMethod(mJavaFrame->frame(env).get(),
mJavaFrame->mGetRawResFilename, (int)id);
return to_string(env, ret);
@@ -886,10 +835,7 @@ float
WebFrame::density() const
{
JNIEnv* env = getJNIEnv();
- AutoJObject obj = mJavaFrame->frame(env);
- if (!obj.get())
- return 1.0;
- jfloat dpi = env->CallFloatMethod(obj.get(), mJavaFrame->mDensity);
+ jfloat dpi = env->CallFloatMethod(mJavaFrame->frame(env).get(), mJavaFrame->mDensity);
checkException(env);
return dpi;
}
@@ -1223,8 +1169,21 @@ private:
JNIEnv* env = getJNIEnv();
// JavaInstance creates a global ref to instance in its constructor.
env->DeleteGlobalRef(_instance->instance());
- // Set the object to our WeakReference wrapper.
- _instance->setInstance(adoptGlobalRef(env, instance));
+ // Set the object to a weak reference.
+ _instance->setInstance(env->NewWeakGlobalRef(instance));
+ }
+ ~WeakJavaInstance()
+ {
+ JNIEnv* env = getJNIEnv();
+ // Store the weak reference so we can delete it later.
+ jweak weak = _instance->instance();
+ // The JavaInstance destructor attempts to delete the global ref stored
+ // in _instance. Since we replaced it in our constructor with a weak
+ // reference, restore the global ref here so the vm will not complain.
+ _instance->setInstance(env->NewGlobalRef(
+ getRealObject(env, _instance->instance()).get()));
+ // Delete the weak reference.
+ env->DeleteWeakGlobalRef(weak);
}
virtual void virtualBegin()
@@ -1256,7 +1215,7 @@ private:
private:
typedef JavaInstance INHERITED;
jobject _realObject;
- jobject _weakRef;
+ jweak _weakRef;
};
static void AddJavascriptInterface(JNIEnv *env, jobject obj, jint nativeFramePointer,
diff --git a/WebKit/android/jni/WebCoreJni.cpp b/WebKit/android/jni/WebCoreJni.cpp
index aa3e2c7..ef33cc0 100644
--- a/WebKit/android/jni/WebCoreJni.cpp
+++ b/WebKit/android/jni/WebCoreJni.cpp
@@ -35,25 +35,10 @@
namespace android {
-// Class, constructor, and get method on WeakReference
-jclass gWeakRefClass;
-jmethodID gWeakRefInit;
-jmethodID gWeakRefGet;
-
-jobject adoptGlobalRef(JNIEnv* env, jobject obj)
-{
- // Create a WeakReference object
- jobject ref = env->NewObject(gWeakRefClass, gWeakRefInit, obj);
- // Increment the ref count of the WeakReference
- ref = env->NewGlobalRef(ref);
- return ref;
-}
-
AutoJObject getRealObject(JNIEnv* env, jobject obj)
{
- jobject real = env->CallObjectMethod(obj, gWeakRefGet);
- if (!real)
- LOGE("The real object has been deleted");
+ jobject real = env->NewLocalRef(obj);
+ LOG_ASSERT(real, "The real object has been deleted!");
return AutoJObject(env, real);
}
@@ -86,20 +71,4 @@ WebCore::String to_string(JNIEnv* env, jstring str)
return ret;
}
-int register_webcorejni(JNIEnv* env) {
- // Instantiate the WeakReference fields.
- jclass weakRef = env->FindClass("java/lang/ref/WeakReference");
- LOG_ASSERT(weakRef, "Could not find WeakReference");
- android::gWeakRefClass = (jclass)env->NewGlobalRef(weakRef);
- android::gWeakRefInit = env->GetMethodID(android::gWeakRefClass,
- "<init>", "(Ljava/lang/Object;)V");
- LOG_ASSERT(android::gWeakRefInit,
- "Could not find constructor for WeakReference");
- android::gWeakRefGet = env->GetMethodID(android::gWeakRefClass, "get",
- "()Ljava/lang/Object;");
- LOG_ASSERT(android::gWeakRefInit,
- "Could not find get method for WeakReference");
- return JNI_OK;
-}
-
}
diff --git a/WebKit/android/jni/WebCoreJni.h b/WebKit/android/jni/WebCoreJni.h
index c1dd07c..1a1bfc0 100644
--- a/WebKit/android/jni/WebCoreJni.h
+++ b/WebKit/android/jni/WebCoreJni.h
@@ -61,14 +61,10 @@ private:
friend AutoJObject getRealObject(JNIEnv*, jobject);
};
-// Get the real object stored in the WeakReference returned as an
+// Get the real object stored in the weak reference returned as an
// AutoJObject.
AutoJObject getRealObject(JNIEnv*, jobject);
-// Convert the given jobject to a WeakReference and create a new global
-// reference to that WeakReference.
-jobject adoptGlobalRef(JNIEnv*, jobject);
-
// Helper method for check java exceptions. Returns true if an exception
// occurred and logs the exception.
bool checkException(JNIEnv* env);
diff --git a/WebKit/android/jni/WebCoreJniOnLoad.cpp b/WebKit/android/jni/WebCoreJniOnLoad.cpp
index f02e92a..d69177e 100644
--- a/WebKit/android/jni/WebCoreJniOnLoad.cpp
+++ b/WebKit/android/jni/WebCoreJniOnLoad.cpp
@@ -79,7 +79,6 @@ extern int register_webhistory(JNIEnv*);
extern int register_webicondatabase(JNIEnv*);
extern int register_websettings(JNIEnv*);
extern int register_webview(JNIEnv*);
-extern int register_webcorejni(JNIEnv*);
#if ENABLE(DATABASE)
extern int register_webstorage(JNIEnv*);
#endif
@@ -100,7 +99,6 @@ static RegistrationMethod gWebCoreRegMethods[] = {
{ "JavaBridge", android::register_javabridge },
{ "WebFrame", android::register_webframe },
{ "WebCoreResourceLoader", android::register_resource_loader },
- { "WebCoreJni", android::register_webcorejni },
{ "WebViewCore", android::register_webviewcore },
{ "WebHistory", android::register_webhistory },
{ "WebIconDatabase", android::register_webicondatabase },
diff --git a/WebKit/android/jni/WebHistory.cpp b/WebKit/android/jni/WebHistory.cpp
index 71cd416..76a310b 100644
--- a/WebKit/android/jni/WebHistory.cpp
+++ b/WebKit/android/jni/WebHistory.cpp
@@ -44,6 +44,7 @@
#include "TextEncoding.h"
#include "WebCoreFrameBridge.h"
#include "WebCoreJni.h"
+#include "WebIconDatabase.h"
#include "jni_utility.h"
#include <JNIHelp.h>
@@ -226,7 +227,7 @@ jbyteArray WebHistory::Flatten(JNIEnv* env, WTF::Vector<char>& v, WebCore::Histo
WebHistoryItem::WebHistoryItem(JNIEnv* env, jobject obj,
WebCore::HistoryItem* item) : WebCore::AndroidWebHistoryBridge(item) {
- m_object = adoptGlobalRef(env, obj);
+ m_object = env->NewWeakGlobalRef(obj);
m_parent = 0;
}
@@ -235,7 +236,7 @@ WebHistoryItem::~WebHistoryItem() {
JNIEnv* env = JSC::Bindings::getJNIEnv();
if (!env)
return;
- env->DeleteGlobalRef(m_object);
+ env->DeleteWeakGlobalRef(m_object);
}
}
diff --git a/WebKit/android/jni/WebHistory.h b/WebKit/android/jni/WebHistory.h
index b961872..12bf00a 100644
--- a/WebKit/android/jni/WebHistory.h
+++ b/WebKit/android/jni/WebHistory.h
@@ -60,7 +60,7 @@ public:
WebHistoryItem* parent() const { return m_parent.get(); }
private:
RefPtr<WebHistoryItem> m_parent;
- jobject m_object;
+ jweak m_object;
};
};
diff --git a/WebKit/android/jni/WebIconDatabase.cpp b/WebKit/android/jni/WebIconDatabase.cpp
index e15d179..20258a4 100644
--- a/WebKit/android/jni/WebIconDatabase.cpp
+++ b/WebKit/android/jni/WebIconDatabase.cpp
@@ -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) {
diff --git a/WebKit/android/jni/WebIconDatabase.h b/WebKit/android/jni/WebIconDatabase.h
index 743c5eb..c91c4ae 100644
--- a/WebKit/android/jni/WebIconDatabase.h
+++ b/WebKit/android/jni/WebIconDatabase.h
@@ -59,9 +59,8 @@ namespace android {
// Deliver all the icon notifications
void deliverNotifications();
- // List of clients and a mutex to protect it.
+ // List of clients.
Vector<WebIconDatabaseClient*> mClients;
- android::Mutex mClientsMutex;
// Queue of page urls that have received an icon.
Vector<WebCore::String> mNotifications;
diff --git a/WebKit/android/jni/WebStorage.cpp b/WebKit/android/jni/WebStorage.cpp
index f175fd3..07e4880 100644
--- a/WebKit/android/jni/WebStorage.cpp
+++ b/WebKit/android/jni/WebStorage.cpp
@@ -93,9 +93,9 @@ static unsigned long long GetUsageForOrigin(JNIEnv* env, jobject obj, jstring or
if (manifestOrigin.get() == 0)
continue;
if (manifestOrigin->isSameSchemeHostPort(securityOrigin.get())) {
- int64_t size = 0;
- WebCore::cacheStorage().cacheGroupSize(manifestUrls[i].string(), &size);
- usage += size;
+ int64_t cacheSize = 0;
+ WebCore::cacheStorage().cacheGroupSize(manifestUrls[i].string(), &cacheSize);
+ usage += cacheSize;
}
}
return usage;
diff --git a/WebKit/android/jni/WebViewCore.cpp b/WebKit/android/jni/WebViewCore.cpp
index 5d2b8bb..8414068 100644
--- a/WebKit/android/jni/WebViewCore.cpp
+++ b/WebKit/android/jni/WebViewCore.cpp
@@ -147,6 +147,8 @@ FILE* gRenderTreeFile = 0;
namespace android {
+bool WebViewCore::s_isPaused = false;
+
static SkTDArray<WebViewCore*> gInstanceList;
void WebViewCore::addInstance(WebViewCore* inst) {
@@ -185,7 +187,7 @@ struct WebViewCoreFields {
// ----------------------------------------------------------------------------
struct WebViewCore::JavaGlue {
- jobject m_obj;
+ jweak m_obj;
jmethodID m_spawnScrollTo;
jmethodID m_scrollTo;
jmethodID m_scrollBy;
@@ -269,7 +271,7 @@ WebViewCore::WebViewCore(JNIEnv* env, jobject javaWebViewCore, WebCore::Frame* m
jclass clazz = env->GetObjectClass(javaWebViewCore);
m_javaGlue = new JavaGlue;
- m_javaGlue->m_obj = adoptGlobalRef(env, javaWebViewCore);
+ m_javaGlue->m_obj = env->NewWeakGlobalRef(javaWebViewCore);
m_javaGlue->m_spawnScrollTo = GetJMethod(env, clazz, "contentSpawnScrollTo", "(II)V");
m_javaGlue->m_scrollTo = GetJMethod(env, clazz, "contentScrollTo", "(II)V");
m_javaGlue->m_scrollBy = GetJMethod(env, clazz, "contentScrollBy", "(IIZ)V");
@@ -331,7 +333,7 @@ WebViewCore::~WebViewCore()
if (m_javaGlue->m_obj) {
JNIEnv* env = JSC::Bindings::getJNIEnv();
- env->DeleteGlobalRef(m_javaGlue->m_obj);
+ env->DeleteWeakGlobalRef(m_javaGlue->m_obj);
m_javaGlue->m_obj = 0;
}
delete m_javaGlue;
@@ -626,13 +628,11 @@ void WebViewCore::recordPictureSet(PictureSet* content)
DBG_NAV_LOG("call updateFrameCache");
updateFrameCache();
if (m_findIsUp) {
+ LOG_ASSERT(m_javaGlue->m_obj,
+ "A Java widget was not associated with this view bridge!");
JNIEnv* env = JSC::Bindings::getJNIEnv();
- AutoJObject obj = m_javaGlue->object(env);
- // if it is called during DESTROY is handled, the real object of WebViewCore
- // can be gone. Check before using it.
- if (!obj.get())
- return;
- env->CallVoidMethod(obj.get(), m_javaGlue->m_sendFindAgain);
+ env->CallVoidMethod(m_javaGlue->object(env).get(),
+ m_javaGlue->m_sendFindAgain);
checkException(env);
}
}
@@ -838,12 +838,9 @@ void WebViewCore::scrollTo(int x, int y, bool animate)
// LOGD("WebViewCore::scrollTo(%d %d)\n", x, y);
JNIEnv* env = JSC::Bindings::getJNIEnv();
- AutoJObject obj = m_javaGlue->object(env);
- // if it is called during DESTROY is handled, the real object of WebViewCore
- // can be gone. Check before using it.
- if (!obj.get())
- return;
- env->CallVoidMethod(obj.get(), animate ? m_javaGlue->m_spawnScrollTo : m_javaGlue->m_scrollTo, x, y);
+ env->CallVoidMethod(m_javaGlue->object(env).get(),
+ animate ? m_javaGlue->m_spawnScrollTo : m_javaGlue->m_scrollTo,
+ x, y);
checkException(env);
}
@@ -851,12 +848,7 @@ void WebViewCore::sendNotifyProgressFinished()
{
LOG_ASSERT(m_javaGlue->m_obj, "A Java widget was not associated with this view bridge!");
JNIEnv* env = JSC::Bindings::getJNIEnv();
- AutoJObject obj = m_javaGlue->object(env);
- // if it is called during DESTROY is handled, the real object of WebViewCore
- // can be gone. Check before using it.
- if (!obj.get())
- return;
- env->CallVoidMethod(obj.get(), m_javaGlue->m_sendNotifyProgressFinished);
+ env->CallVoidMethod(m_javaGlue->object(env).get(), m_javaGlue->m_sendNotifyProgressFinished);
checkException(env);
}
@@ -864,12 +856,7 @@ void WebViewCore::viewInvalidate(const WebCore::IntRect& rect)
{
LOG_ASSERT(m_javaGlue->m_obj, "A Java widget was not associated with this view bridge!");
JNIEnv* env = JSC::Bindings::getJNIEnv();
- AutoJObject obj = m_javaGlue->object(env);
- // if it is called during DESTROY is handled, the real object of WebViewCore
- // can be gone. Check before using it.
- if (!obj.get())
- return;
- env->CallVoidMethod(obj.get(),
+ env->CallVoidMethod(m_javaGlue->object(env).get(),
m_javaGlue->m_sendViewInvalidate,
rect.x(), rect.y(), rect.right(), rect.bottom());
checkException(env);
@@ -880,12 +867,7 @@ void WebViewCore::scrollBy(int dx, int dy, bool animate)
if (!(dx | dy))
return;
JNIEnv* env = JSC::Bindings::getJNIEnv();
- AutoJObject obj = m_javaGlue->object(env);
- // if it is called during DESTROY is handled, the real object of WebViewCore
- // can be gone. Check before using it.
- if (!obj.get())
- return;
- env->CallVoidMethod(obj.get(), m_javaGlue->m_scrollBy,
+ env->CallVoidMethod(m_javaGlue->object(env).get(), m_javaGlue->m_scrollBy,
dx, dy, animate);
checkException(env);
}
@@ -915,12 +897,7 @@ void WebViewCore::setRootLayer(int layer)
void WebViewCore::contentDraw()
{
JNIEnv* env = JSC::Bindings::getJNIEnv();
- AutoJObject obj = m_javaGlue->object(env);
- // if it is called during DESTROY is handled, the real object of WebViewCore
- // can be gone. Check before using it.
- if (!obj.get())
- return;
- env->CallVoidMethod(obj.get(), m_javaGlue->m_contentDraw);
+ env->CallVoidMethod(m_javaGlue->object(env).get(), m_javaGlue->m_contentDraw);
checkException(env);
}
@@ -969,18 +946,14 @@ void WebViewCore::didFirstLayout()
WebCore::FrameLoadType loadType = loader->loadType();
JNIEnv* env = JSC::Bindings::getJNIEnv();
- AutoJObject obj = m_javaGlue->object(env);
- // if it is called during DESTROY is handled, the real object of WebViewCore
- // can be gone. Check before using it.
- if (!obj.get())
- return;
- env->CallVoidMethod(obj.get(), m_javaGlue->m_didFirstLayout,
+ env->CallVoidMethod(m_javaGlue->object(env).get(), m_javaGlue->m_didFirstLayout,
loadType == WebCore::FrameLoadTypeStandard
// When redirect with locked history, we would like to reset the
// scale factor. This is important for www.yahoo.com as it is
// redirected to www.yahoo.com/?rs=1 on load.
|| loadType == WebCore::FrameLoadTypeRedirectWithLockedBackForwardList);
checkException(env);
+
DBG_NAV_LOG("call updateFrameCache");
m_check_domtree_version = false;
updateFrameCache();
@@ -993,12 +966,7 @@ void WebViewCore::updateViewport()
LOG_ASSERT(m_javaGlue->m_obj, "A Java widget was not associated with this view bridge!");
JNIEnv* env = JSC::Bindings::getJNIEnv();
- AutoJObject obj = m_javaGlue->object(env);
- // if it is called during DESTROY is handled, the real object of WebViewCore
- // can be gone. Check before using it.
- if (!obj.get())
- return;
- env->CallVoidMethod(obj.get(), m_javaGlue->m_updateViewport);
+ env->CallVoidMethod(m_javaGlue->object(env).get(), m_javaGlue->m_updateViewport);
checkException(env);
}
@@ -1008,12 +976,7 @@ void WebViewCore::restoreScale(int scale)
LOG_ASSERT(m_javaGlue->m_obj, "A Java widget was not associated with this view bridge!");
JNIEnv* env = JSC::Bindings::getJNIEnv();
- AutoJObject obj = m_javaGlue->object(env);
- // if it is called during DESTROY is handled, the real object of WebViewCore
- // can be gone. Check before using it.
- if (!obj.get())
- return;
- env->CallVoidMethod(obj.get(), m_javaGlue->m_restoreScale, scale);
+ env->CallVoidMethod(m_javaGlue->object(env).get(), m_javaGlue->m_restoreScale, scale);
checkException(env);
}
@@ -1023,12 +986,8 @@ void WebViewCore::restoreScreenWidthScale(int scale)
LOG_ASSERT(m_javaGlue->m_obj, "A Java widget was not associated with this view bridge!");
JNIEnv* env = JSC::Bindings::getJNIEnv();
- AutoJObject obj = m_javaGlue->object(env);
- // if it is called during DESTROY is handled, the real object of WebViewCore
- // can be gone. Check before using it.
- if (!obj.get())
- return;
- env->CallVoidMethod(obj.get(), m_javaGlue->m_restoreScreenWidthScale, scale);
+ env->CallVoidMethod(m_javaGlue->object(env).get(),
+ m_javaGlue->m_restoreScreenWidthScale, scale);
checkException(env);
}
@@ -1039,12 +998,7 @@ void WebViewCore::needTouchEvents(bool need)
#if ENABLE(TOUCH_EVENTS) // Android
JNIEnv* env = JSC::Bindings::getJNIEnv();
- AutoJObject obj = m_javaGlue->object(env);
- // if it is called during DESTROY is handled, the real object of WebViewCore
- // can be gone. Check before using it.
- if (!obj.get())
- return;
- env->CallVoidMethod(obj.get(), m_javaGlue->m_needTouchEvents, need);
+ env->CallVoidMethod(m_javaGlue->object(env).get(), m_javaGlue->m_needTouchEvents, need);
checkException(env);
#endif
}
@@ -1055,12 +1009,7 @@ void WebViewCore::requestKeyboard(bool showKeyboard, bool isTextView)
LOG_ASSERT(m_javaGlue->m_obj, "A Java widget was not associated with this view bridge!");
JNIEnv* env = JSC::Bindings::getJNIEnv();
- AutoJObject obj = m_javaGlue->object(env);
- // if it is called during DESTROY is handled, the real object of WebViewCore
- // can be gone. Check before using it.
- if (!obj.get())
- return;
- env->CallVoidMethod(obj.get(), m_javaGlue->m_requestKeyboard, showKeyboard,
+ env->CallVoidMethod(m_javaGlue->object(env).get(), m_javaGlue->m_requestKeyboard, showKeyboard,
isTextView);
checkException(env);
}
@@ -1588,209 +1537,6 @@ void WebViewCore::moveMouse(WebCore::Frame* frame, int x, int y)
updateCacheOnNodeChange();
}
-static int findTextBoxIndex(WebCore::Node* node, const WebCore::IntPoint& pt)
-{
- if (!node->isTextNode()) {
- DBG_NAV_LOGD("node=%p pt=(%d,%d) isText=false", node, pt.x(), pt.y());
- return -2; // error
- }
- WebCore::RenderText* renderText = (WebCore::RenderText*) node->renderer();
- if (!renderText) {
- DBG_NAV_LOGD("node=%p pt=(%d,%d) renderText=0", node, pt.x(), pt.y());
- return -3; // error
- }
- FloatPoint absPt = renderText->localToAbsolute();
- WebCore::InlineTextBox *textBox = renderText->firstTextBox();
- int globalX, globalY;
- CacheBuilder::GetGlobalOffset(node, &globalX, &globalY);
- int x = pt.x() - globalX;
- int y = pt.y() - globalY;
- do {
- int textBoxStart = textBox->start();
- int textBoxEnd = textBoxStart + textBox->len();
- if (textBoxEnd <= textBoxStart) {
- DBG_NAV_LOGD("textBoxStart=%d <= textBoxEnd=%d", textBoxStart,
- textBoxEnd);
- continue;
- }
- WebCore::IntRect bounds = textBox->selectionRect(absPt.x(), absPt.y(),
- textBoxStart, textBoxEnd);
- if (!bounds.contains(x, y)) {
- DBG_NAV_LOGD("[absPt=(%g,%g) textBoxStart=%d textBoxEnd=%d]"
- " !contains (x=%d, y=%d)",
- absPt.x(), absPt.y(), textBoxStart, textBoxEnd, x, y);
- continue;
- }
- int offset = textBox->offsetForPosition(x - absPt.x());
-#if DEBUG_NAV_UI
- int prior = offset > 0 ? textBox->positionForOffset(offset - 1) : -1;
- int current = textBox->positionForOffset(offset);
- int next = textBox->positionForOffset(offset + 1);
- DBG_NAV_LOGD("offset=%d pt.x=%d globalX=%d renderX=%g x=%d "
- "textBox->x()=%d textBox->start()=%d prior=%d current=%d next=%d",
- offset, pt.x(), globalX, absPt.x(), x,
- textBox->x(), textBox->start(), prior, current, next
- );
-#endif
- return textBox->start() + offset;
- } while ((textBox = textBox->nextTextBox()));
- return -1; // couldn't find point, may have walked off end
-}
-
-static inline bool isPunctuation(UChar c)
-{
- return WTF::Unicode::category(c) & (0
- | WTF::Unicode::Punctuation_Dash
- | WTF::Unicode::Punctuation_Open
- | WTF::Unicode::Punctuation_Close
- | WTF::Unicode::Punctuation_Connector
- | WTF::Unicode::Punctuation_Other
- | WTF::Unicode::Punctuation_InitialQuote
- | WTF::Unicode::Punctuation_FinalQuote
- );
-}
-
-static int centerX(const SkIRect& rect)
-{
- return (rect.fLeft + rect.fRight) >> 1;
-}
-
-static int centerY(const SkIRect& rect)
-{
- return (rect.fTop + rect.fBottom) >> 1;
-}
-
-static void ShowNode(Node* node)
-{
-#if DEBUG_NAV_UI
- WebCore::Node* match = node->document();
- int index = 1;
- while (match != node && (match = match->traverseNextNode()))
- index++;
- if (match != node)
- index = -1;
- const char* name = "text";
- WebCore::CString cstr;
- if (!node->isTextNode()) {
- cstr = node->localName().string().utf8();
- name = cstr.data();
- }
- node->getRect();
- const WebCore::IntRect& b = node->getRect();
- DBG_NAV_LOGD("%s %p (%d) (%d,%d,w=%d,h=%d)", name, node, index,
- b.x(), b.y(), b.width(), b.height());
-#endif
-}
-
-static WebCore::Node* ChildIsTextNode(WebCore::Node* node)
-{
- WebCore::Node* child = node;
- while (child && !child->isTextNode()) {
- ShowNode(child);
- child = child->traverseNextNode(node);
- }
- return child;
-}
-
-WebCore::String WebViewCore::getSelection(SkRegion* selRgn)
-{
- SkRegion::Iterator iter(*selRgn);
- // FIXME: switch this to use StringBuilder instead
- WebCore::String result;
- WebCore::Node* lastStartNode = 0;
- int lastStartEnd = -1;
- UChar lastChar = 0xffff;
- for (; !iter.done(); iter.next()) {
- const SkIRect& rect = iter.rect();
- DBG_NAV_LOGD("rect=(%d, %d, %d, %d)", rect.fLeft, rect.fTop,
- rect.fRight, rect.fBottom);
- int cy = centerY(rect);
- WebCore::IntPoint startPt, endPt;
- WebCore::Node* node, * endNode;
- for (int top = rect.fTop + 2; top != cy; top = cy) {
- startPt = WebCore::IntPoint(rect.fLeft + 1, top);
- WebCore::HitTestResult hitTestResult = m_mainFrame->eventHandler()->
- hitTestResultAtPoint(startPt, false);
- node = ChildIsTextNode(hitTestResult.innerNode());
- if (node)
- break;
- DBG_NAV_LOGD("node=%p (%s)", node, top != cy ? "top+1" : "cy");
- }
- if (!node) {
- DBG_NAV_LOG("!node");
- return result;
- }
- for (int bottom = rect.fBottom - 1; bottom != cy; bottom = cy) {
- for (int right = rect.fRight - 1; right != rect.fRight-2; --right) {
- endPt = WebCore::IntPoint(right, bottom);
- WebCore::HitTestResult hitTestResult = m_mainFrame->
- eventHandler()->hitTestResultAtPoint(endPt, false);
- endNode = ChildIsTextNode(hitTestResult.innerNode());
- if (endNode)
- break;
- DBG_NAV_LOGD("!endNode=%p (%s) (right-%d)", node,
- bottom != cy ? "bottom-1" : "cy", rect.fRight - right);
- }
- }
- if (!endNode) {
- DBG_NAV_LOG("!endNode");
- return result;
- }
- int start = findTextBoxIndex(node, startPt);
- if (start < 0)
- continue;
- int end = findTextBoxIndex(endNode, endPt);
- if (end < -1) // use node if endNode is not valid
- endNode = node;
- if (end <= 0)
- end = static_cast<WebCore::Text*>(endNode)->dataImpl()->length();
- DBG_NAV_LOGD("node=%p start=%d endNode=%p end=%d", node, start, endNode, end);
- WebCore::Node* startNode = node;
- do {
- if (!node->isTextNode())
- continue;
- if (node->getRect().isEmpty())
- continue;
- WebCore::Text* textNode = static_cast<WebCore::Text*>(node);
- WebCore::StringImpl* string = textNode->dataImpl();
- if (!string->length())
- continue;
- const UChar* chars = string->characters();
- int newLength = node == endNode ? end : string->length();
- if (node == startNode) {
- #if DEBUG_NAV_UI
- if (node == lastStartNode)
- DBG_NAV_LOGD("start=%d last=%d", start, lastStartEnd);
- #endif
- if (node == lastStartNode && start < lastStartEnd)
- break; // skip rect if text overlaps already written text
- lastStartNode = node;
- lastStartEnd = newLength - start;
- }
- if (newLength < start) {
- DBG_NAV_LOGD("newLen=%d < start=%d", newLength, start);
- break;
- }
- if (!isPunctuation(chars[start]))
- result.append(' ');
- result.append(chars + start, newLength - start);
- start = 0;
- } while (node != endNode && (node = node->traverseNextNode()));
- }
- result = result.simplifyWhiteSpace().stripWhiteSpace();
-#if DUMP_NAV_CACHE
- {
- char buffer[256];
- CacheBuilder::Debug debug;
- debug.init(buffer, sizeof(buffer));
- debug.print("copy: ");
- debug.wideString(result);
- DUMP_NAV_LOGD("%s", buffer);
- }
-#endif
- return result;
-}
-
void WebViewCore::setSelection(int start, int end)
{
WebCore::Node* focus = currentFocus();
@@ -2072,11 +1818,6 @@ void WebViewCore::listBoxRequest(WebCoreReply* reply, const uint16_t** labels, s
// Create an array of java Strings for the drop down.
JNIEnv* env = JSC::Bindings::getJNIEnv();
- AutoJObject obj = m_javaGlue->object(env);
- // if it is called during DESTROY is handled, the real object of WebViewCore
- // can be gone. Check before using it.
- if (!obj.get())
- return;
jobjectArray labelArray = makeLabelArray(env, labels, count);
// Create an array determining whether each item is enabled.
@@ -2101,11 +1842,15 @@ void WebViewCore::listBoxRequest(WebCoreReply* reply, const uint16_t** labels, s
}
env->ReleaseIntArrayElements(selectedArray, selArray, 0);
- env->CallVoidMethod(obj.get(), m_javaGlue->m_requestListBox, labelArray, enabledArray, selectedArray);
+ env->CallVoidMethod(m_javaGlue->object(env).get(),
+ m_javaGlue->m_requestListBox, labelArray, enabledArray,
+ selectedArray);
env->DeleteLocalRef(selectedArray);
} else {
// Pass up the single selection.
- env->CallVoidMethod(obj.get(), m_javaGlue->m_requestSingleListBox, labelArray, enabledArray, selectedCountOrSelection);
+ env->CallVoidMethod(m_javaGlue->object(env).get(),
+ m_javaGlue->m_requestSingleListBox, labelArray, enabledArray,
+ selectedCountOrSelection);
}
env->DeleteLocalRef(labelArray);
@@ -2325,14 +2070,11 @@ void WebViewCore::popupReply(const int* array, int count)
void WebViewCore::addMessageToConsole(const WebCore::String& message, unsigned int lineNumber, const WebCore::String& sourceID) {
JNIEnv* env = JSC::Bindings::getJNIEnv();
- AutoJObject obj = m_javaGlue->object(env);
- // if it is called during DESTROY is handled, the real object of WebViewCore
- // can be gone. Check before using it.
- if (!obj.get())
- return;
jstring jMessageStr = env->NewString((unsigned short *)message.characters(), message.length());
jstring jSourceIDStr = env->NewString((unsigned short *)sourceID.characters(), sourceID.length());
- env->CallVoidMethod(obj.get(), m_javaGlue->m_addMessageToConsole, jMessageStr, lineNumber, jSourceIDStr);
+ env->CallVoidMethod(m_javaGlue->object(env).get(),
+ m_javaGlue->m_addMessageToConsole, jMessageStr, lineNumber,
+ jSourceIDStr);
env->DeleteLocalRef(jMessageStr);
env->DeleteLocalRef(jSourceIDStr);
checkException(env);
@@ -2341,14 +2083,9 @@ void WebViewCore::addMessageToConsole(const WebCore::String& message, unsigned i
void WebViewCore::jsAlert(const WebCore::String& url, const WebCore::String& text)
{
JNIEnv* env = JSC::Bindings::getJNIEnv();
- AutoJObject obj = m_javaGlue->object(env);
- // if it is called during DESTROY is handled, the real object of WebViewCore
- // can be gone. Check before using it.
- if (!obj.get())
- return;
jstring jInputStr = env->NewString((unsigned short *)text.characters(), text.length());
jstring jUrlStr = env->NewString((unsigned short *)url.characters(), url.length());
- env->CallVoidMethod(obj.get(), m_javaGlue->m_jsAlert, jUrlStr, jInputStr);
+ env->CallVoidMethod(m_javaGlue->object(env).get(), m_javaGlue->m_jsAlert, jUrlStr, jInputStr);
env->DeleteLocalRef(jInputStr);
env->DeleteLocalRef(jUrlStr);
checkException(env);
@@ -2358,14 +2095,11 @@ void WebViewCore::exceededDatabaseQuota(const WebCore::String& url, const WebCor
{
#if ENABLE(DATABASE)
JNIEnv* env = JSC::Bindings::getJNIEnv();
- AutoJObject obj = m_javaGlue->object(env);
- // if it is called during DESTROY is handled, the real object of WebViewCore
- // can be gone. Check before using it.
- if (!obj.get())
- return;
jstring jDatabaseIdentifierStr = env->NewString((unsigned short *)databaseIdentifier.characters(), databaseIdentifier.length());
jstring jUrlStr = env->NewString((unsigned short *)url.characters(), url.length());
- env->CallVoidMethod(obj.get(), m_javaGlue->m_exceededDatabaseQuota, jUrlStr, jDatabaseIdentifierStr, currentQuota, estimatedSize);
+ env->CallVoidMethod(m_javaGlue->object(env).get(),
+ m_javaGlue->m_exceededDatabaseQuota, jUrlStr,
+ jDatabaseIdentifierStr, currentQuota, estimatedSize);
env->DeleteLocalRef(jDatabaseIdentifierStr);
env->DeleteLocalRef(jUrlStr);
checkException(env);
@@ -2376,12 +2110,8 @@ void WebViewCore::reachedMaxAppCacheSize(const unsigned long long spaceNeeded)
{
#if ENABLE(OFFLINE_WEB_APPLICATIONS)
JNIEnv* env = JSC::Bindings::getJNIEnv();
- AutoJObject obj = m_javaGlue->object(env);
- // if it is called during DESTROY is handled, the real object of WebViewCore
- // can be gone. Check before using it.
- if (!obj.get())
- return;
- env->CallVoidMethod(obj.get(), m_javaGlue->m_reachedMaxAppCacheSize, spaceNeeded);
+ env->CallVoidMethod(m_javaGlue->object(env).get(),
+ m_javaGlue->m_reachedMaxAppCacheSize, spaceNeeded);
checkException(env);
#endif
}
@@ -2390,25 +2120,15 @@ void WebViewCore::populateVisitedLinks(WebCore::PageGroup* group)
{
m_groupForVisitedLinks = group;
JNIEnv* env = JSC::Bindings::getJNIEnv();
- AutoJObject obj = m_javaGlue->object(env);
- // if it is called during DESTROY is handled, the real object of WebViewCore
- // can be gone. Check before using it.
- if (!obj.get())
- return;
- env->CallVoidMethod(obj.get(), m_javaGlue->m_populateVisitedLinks);
+ env->CallVoidMethod(m_javaGlue->object(env).get(), m_javaGlue->m_populateVisitedLinks);
checkException(env);
}
void WebViewCore::geolocationPermissionsShowPrompt(const WebCore::String& origin)
{
JNIEnv* env = JSC::Bindings::getJNIEnv();
- AutoJObject obj = m_javaGlue->object(env);
- // if it is called during DESTROY is handled, the real object of WebViewCore
- // can be gone. Check before using it.
- if (!obj.get())
- return;
jstring originString = env->NewString((unsigned short *)origin.characters(), origin.length());
- env->CallVoidMethod(obj.get(),
+ env->CallVoidMethod(m_javaGlue->object(env).get(),
m_javaGlue->m_geolocationPermissionsShowPrompt,
originString);
env->DeleteLocalRef(originString);
@@ -2418,12 +2138,7 @@ void WebViewCore::geolocationPermissionsShowPrompt(const WebCore::String& origin
void WebViewCore::geolocationPermissionsHidePrompt()
{
JNIEnv* env = JSC::Bindings::getJNIEnv();
- AutoJObject obj = m_javaGlue->object(env);
- // if it is called during DESTROY is handled, the real object of WebViewCore
- // can be gone. Check before using it.
- if (!obj.get())
- return;
- env->CallVoidMethod(obj.get(),
+ env->CallVoidMethod(m_javaGlue->object(env).get(),
m_javaGlue->m_geolocationPermissionsHidePrompt);
checkException(env);
}
@@ -2431,14 +2146,9 @@ void WebViewCore::geolocationPermissionsHidePrompt()
bool WebViewCore::jsConfirm(const WebCore::String& url, const WebCore::String& text)
{
JNIEnv* env = JSC::Bindings::getJNIEnv();
- AutoJObject obj = m_javaGlue->object(env);
- // if it is called during DESTROY is handled, the real object of WebViewCore
- // can be gone. Check before using it.
- if (!obj.get())
- return false;
jstring jInputStr = env->NewString((unsigned short *)text.characters(), text.length());
jstring jUrlStr = env->NewString((unsigned short *)url.characters(), url.length());
- jboolean result = env->CallBooleanMethod(obj.get(), m_javaGlue->m_jsConfirm, jUrlStr, jInputStr);
+ jboolean result = env->CallBooleanMethod(m_javaGlue->object(env).get(), m_javaGlue->m_jsConfirm, jUrlStr, jInputStr);
env->DeleteLocalRef(jInputStr);
env->DeleteLocalRef(jUrlStr);
checkException(env);
@@ -2448,16 +2158,10 @@ bool WebViewCore::jsConfirm(const WebCore::String& url, const WebCore::String& t
bool WebViewCore::jsPrompt(const WebCore::String& url, const WebCore::String& text, const WebCore::String& defaultValue, WebCore::String& result)
{
JNIEnv* env = JSC::Bindings::getJNIEnv();
- AutoJObject obj = m_javaGlue->object(env);
- // if it is called during DESTROY is handled, the real object of WebViewCore
- // can be gone. Check before using it.
- if (!obj.get())
- return false;
-
jstring jInputStr = env->NewString((unsigned short *)text.characters(), text.length());
jstring jDefaultStr = env->NewString((unsigned short *)defaultValue.characters(), defaultValue.length());
jstring jUrlStr = env->NewString((unsigned short *)url.characters(), url.length());
- jstring returnVal = (jstring) env->CallObjectMethod(obj.get(), m_javaGlue->m_jsPrompt, jUrlStr, jInputStr, jDefaultStr);
+ jstring returnVal = (jstring) env->CallObjectMethod(m_javaGlue->object(env).get(), m_javaGlue->m_jsPrompt, jUrlStr, jInputStr, jDefaultStr);
// If returnVal is null, it means that the user cancelled the dialog.
if (!returnVal)
return false;
@@ -2473,14 +2177,9 @@ bool WebViewCore::jsPrompt(const WebCore::String& url, const WebCore::String& te
bool WebViewCore::jsUnload(const WebCore::String& url, const WebCore::String& message)
{
JNIEnv* env = JSC::Bindings::getJNIEnv();
- AutoJObject obj = m_javaGlue->object(env);
- // if it is called during DESTROY is handled, the real object of WebViewCore
- // can be gone. Check before using it.
- if (!obj.get())
- return false;
jstring jInputStr = env->NewString((unsigned short *)message.characters(), message.length());
jstring jUrlStr = env->NewString((unsigned short *)url.characters(), url.length());
- jboolean result = env->CallBooleanMethod(obj.get(), m_javaGlue->m_jsUnload, jUrlStr, jInputStr);
+ jboolean result = env->CallBooleanMethod(m_javaGlue->object(env).get(), m_javaGlue->m_jsUnload, jUrlStr, jInputStr);
env->DeleteLocalRef(jInputStr);
env->DeleteLocalRef(jUrlStr);
checkException(env);
@@ -2490,12 +2189,7 @@ bool WebViewCore::jsUnload(const WebCore::String& url, const WebCore::String& me
bool WebViewCore::jsInterrupt()
{
JNIEnv* env = JSC::Bindings::getJNIEnv();
- AutoJObject obj = m_javaGlue->object(env);
- // if it is called during DESTROY is handled, the real object of WebViewCore
- // can be gone. Check before using it.
- if (!obj.get())
- return true; // default to interrupt
- jboolean result = env->CallBooleanMethod(obj.get(), m_javaGlue->m_jsInterrupt);
+ jboolean result = env->CallBooleanMethod(m_javaGlue->object(env).get(), m_javaGlue->m_jsInterrupt);
checkException(env);
return result;
}
@@ -2510,12 +2204,7 @@ jobject
WebViewCore::getWebViewJavaObject()
{
JNIEnv* env = JSC::Bindings::getJNIEnv();
- AutoJObject obj = m_javaGlue->object(env);
- // if it is called during DESTROY is handled, the real object of WebViewCore
- // can be gone. Check before using it.
- if (!obj.get())
- return 0;
- return env->GetObjectField(obj.get(), gWebViewCoreFields.m_webView);
+ return env->GetObjectField(m_javaGlue->object(env).get(), gWebViewCoreFields.m_webView);
}
void WebViewCore::updateTextSelection() {
@@ -2527,12 +2216,7 @@ void WebViewCore::updateTextSelection() {
return;
RenderTextControl* rtc = static_cast<RenderTextControl*>(renderer);
JNIEnv* env = JSC::Bindings::getJNIEnv();
- AutoJObject obj = m_javaGlue->object(env);
- // if it is called during DESTROY is handled, the real object of WebViewCore
- // can be gone. Check before using it.
- if (!obj.get())
- return;
- env->CallVoidMethod(obj.get(),
+ env->CallVoidMethod(m_javaGlue->object(env).get(),
m_javaGlue->m_updateTextSelection, reinterpret_cast<int>(focusNode),
rtc->selectionStart(), rtc->selectionEnd(), m_textGeneration);
checkException(env);
@@ -2544,21 +2228,15 @@ void WebViewCore::updateTextfield(WebCore::Node* ptr, bool changeToPassword,
if (m_blockTextfieldUpdates)
return;
JNIEnv* env = JSC::Bindings::getJNIEnv();
- AutoJObject obj = m_javaGlue->object(env);
- // if it is called during DESTROY is handled, the real object of WebViewCore
- // can be gone. Check before using it.
- if (!obj.get())
- return;
-
if (changeToPassword) {
- env->CallVoidMethod(obj.get(), m_javaGlue->m_updateTextfield,
+ env->CallVoidMethod(m_javaGlue->object(env).get(), m_javaGlue->m_updateTextfield,
(int) ptr, true, 0, m_textGeneration);
checkException(env);
return;
}
int length = text.length();
jstring string = env->NewString((unsigned short *) text.characters(), length);
- env->CallVoidMethod(obj.get(), m_javaGlue->m_updateTextfield,
+ env->CallVoidMethod(m_javaGlue->object(env).get(), m_javaGlue->m_updateTextfield,
(int) ptr, false, string, m_textGeneration);
env->DeleteLocalRef(string);
checkException(env);
@@ -2567,13 +2245,8 @@ void WebViewCore::updateTextfield(WebCore::Node* ptr, bool changeToPassword,
void WebViewCore::clearTextEntry()
{
JNIEnv* env = JSC::Bindings::getJNIEnv();
- AutoJObject obj = m_javaGlue->object(env);
- // if it is called during DESTROY is handled, the real object of WebViewCore
- // can be gone. Check before using it.
- if (!obj.get())
- return;
-
- env->CallVoidMethod(obj.get(), m_javaGlue->m_clearTextEntry);
+ env->CallVoidMethod(m_javaGlue->object(env).get(),
+ m_javaGlue->m_clearTextEntry);
}
void WebViewCore::setBackgroundColor(SkColor c)
@@ -2591,11 +2264,10 @@ void WebViewCore::setBackgroundColor(SkColor c)
jclass WebViewCore::getPluginClass(const WebCore::String& libName, const char* className)
{
JNIEnv* env = JSC::Bindings::getJNIEnv();
- AutoJObject obj = m_javaGlue->object(env);
jstring libString = env->NewString(libName.characters(), libName.length());
jstring classString = env->NewStringUTF(className);
- jobject pluginClass = env->CallObjectMethod(obj.get(),
+ jobject pluginClass = env->CallObjectMethod(m_javaGlue->object(env).get(),
m_javaGlue->m_getPluginClass,
libString, classString);
checkException(env);
@@ -2626,18 +2298,16 @@ void WebViewCore::showFullScreenPlugin(jobject childView, NPP npp, int x,
void WebViewCore::hideFullScreenPlugin()
{
JNIEnv* env = JSC::Bindings::getJNIEnv();
- AutoJObject obj = m_javaGlue->object(env);
-
- env->CallVoidMethod(obj.get(), m_javaGlue->m_hideFullScreenPlugin);
+ env->CallVoidMethod(m_javaGlue->object(env).get(),
+ m_javaGlue->m_hideFullScreenPlugin);
checkException(env);
}
void WebViewCore::updateFullScreenPlugin(int x, int y, int width, int height)
{
JNIEnv* env = JSC::Bindings::getJNIEnv();
- AutoJObject obj = m_javaGlue->object(env);
-
- env->CallVoidMethod(obj.get(), m_javaGlue->m_updateFullScreenPlugin, x, y,
+ env->CallVoidMethod(m_javaGlue->object(env).get(),
+ m_javaGlue->m_updateFullScreenPlugin, x, y,
width, height);
checkException(env);
}
@@ -2645,9 +2315,7 @@ void WebViewCore::updateFullScreenPlugin(int x, int y, int width, int height)
jobject WebViewCore::addSurface(jobject view, int x, int y, int width, int height)
{
JNIEnv* env = JSC::Bindings::getJNIEnv();
- AutoJObject obj = m_javaGlue->object(env);
-
- jobject result = env->CallObjectMethod(obj.get(),
+ jobject result = env->CallObjectMethod(m_javaGlue->object(env).get(),
m_javaGlue->m_addSurface,
view, x, y, width, height);
checkException(env);
@@ -2657,19 +2325,16 @@ jobject WebViewCore::addSurface(jobject view, int x, int y, int width, int heigh
void WebViewCore::updateSurface(jobject childView, int x, int y, int width, int height)
{
JNIEnv* env = JSC::Bindings::getJNIEnv();
- AutoJObject obj = m_javaGlue->object(env);
-
- env->CallVoidMethod(obj.get(), m_javaGlue->m_updateSurface, childView, x,
- y, width, height);
+ env->CallVoidMethod(m_javaGlue->object(env).get(),
+ m_javaGlue->m_updateSurface, childView,
+ x, y, width, height);
checkException(env);
}
void WebViewCore::destroySurface(jobject childView)
{
JNIEnv* env = JSC::Bindings::getJNIEnv();
- AutoJObject obj = m_javaGlue->object(env);
-
- env->CallVoidMethod(obj.get(), m_javaGlue->m_destroySurface, childView);
+ env->CallVoidMethod(m_javaGlue->object(env).get(), m_javaGlue->m_destroySurface, childView);
checkException(env);
}
@@ -3100,20 +2765,6 @@ static void SetBackgroundColor(JNIEnv *env, jobject obj, jint color)
viewImpl->setBackgroundColor((SkColor) color);
}
-static jstring GetSelection(JNIEnv *env, jobject obj, jobject selRgn)
-{
-#ifdef ANDROID_INSTRUMENT
- TimeCounterAuto counter(TimeCounter::WebViewCoreTimeCounter);
-#endif
- WebViewCore* viewImpl = GET_NATIVE_VIEW(env, obj);
- LOG_ASSERT(viewImpl, "viewImpl not set in %s", __FUNCTION__);
- SkRegion* selectionRegion = GraphicsJNI::getNativeRegion(env, selRgn);
- WebCore::String result = viewImpl->getSelection(selectionRegion);
- if (!result.isEmpty())
- return WebCoreStringToJString(env, result);
- return 0;
-}
-
static void DumpDomTree(JNIEnv *env, jobject obj, jboolean useFile)
{
WebViewCore* viewImpl = GET_NATIVE_VIEW(env, obj);
@@ -3240,6 +2891,8 @@ static void Pause(JNIEnv* env, jobject obj)
SkANP::InitEvent(&event, kLifecycle_ANPEventType);
event.data.lifecycle.action = kPause_ANPLifecycleAction;
GET_NATIVE_VIEW(env, obj)->sendPluginEvent(event);
+
+ WebViewCore::setIsPaused(true);
}
static void Resume(JNIEnv* env, jobject obj)
@@ -3255,6 +2908,8 @@ static void Resume(JNIEnv* env, jobject obj)
SkANP::InitEvent(&event, kLifecycle_ANPEventType);
event.data.lifecycle.action = kResume_ANPLifecycleAction;
GET_NATIVE_VIEW(env, obj)->sendPluginEvent(event);
+
+ WebViewCore::setIsPaused(false);
}
static void FreeMemory(JNIEnv* env, jobject obj)
@@ -3281,7 +2936,6 @@ static void ProvideVisitedHistory(JNIEnv *env, jobject obj, jobject hist)
env->ReleaseStringChars(item, str);
env->DeleteLocalRef(item);
}
- env->DeleteLocalRef(array);
}
// Notification from the UI thread that the plugin's full-screen surface has been discarded
@@ -3380,8 +3034,6 @@ static JNINativeMethod gJavaWebViewCoreMethods[] = {
(void*) SplitContent },
{ "nativeSetBackgroundColor", "(I)V",
(void*) SetBackgroundColor },
- { "nativeGetSelection", "(Landroid/graphics/Region;)Ljava/lang/String;",
- (void*) GetSelection },
{ "nativeRegisterURLSchemeAsLocal", "(Ljava/lang/String;)V",
(void*) RegisterURLSchemeAsLocal },
{ "nativeDumpDomTree", "(Z)V",
diff --git a/WebKit/android/jni/WebViewCore.h b/WebKit/android/jni/WebViewCore.h
index f1893ff..0569b4d 100644
--- a/WebKit/android/jni/WebViewCore.h
+++ b/WebKit/android/jni/WebViewCore.h
@@ -247,7 +247,6 @@ namespace android {
WebCore::String retrieveHref(WebCore::Frame* frame, WebCore::Node* node);
WebCore::String retrieveAnchorText(WebCore::Frame* frame, WebCore::Node* node);
WebCore::String requestLabel(WebCore::Frame* , WebCore::Node* );
- WebCore::String getSelection(SkRegion* );
// Create a single picture to represent the drawn DOM (used by navcache)
void recordPicture(SkPicture* picture);
@@ -454,6 +453,8 @@ namespace android {
// field safely from our respective threads
static Mutex gButtonMutex;
WTF::Vector<Container> m_buttons;
+ static bool isPaused() { return s_isPaused; }
+ static void setIsPaused(bool isPaused) { s_isPaused = isPaused; }
// end of shared members
// internal functions
@@ -510,6 +511,7 @@ namespace android {
unsigned m_domtree_version;
bool m_check_domtree_version;
PageGroup* m_groupForVisitedLinks;
+ static bool s_isPaused;
SkTDArray<PluginWidgetAndroid*> m_plugins;
WebCore::Timer<WebViewCore> m_pluginInvalTimer;
diff --git a/WebKit/android/nav/SelectText.cpp b/WebKit/android/nav/SelectText.cpp
index 9a9f8d2..d8b184a 100644
--- a/WebKit/android/nav/SelectText.cpp
+++ b/WebKit/android/nav/SelectText.cpp
@@ -35,14 +35,17 @@
#include "SkPoint.h"
#include "SkRect.h"
#include "SkRegion.h"
+#include "SkUtils.h"
class CommonCheck : public SkBounder {
public:
CommonCheck() : mMatrix(NULL), mPaint(NULL) {}
- virtual void setUp(const SkPaint& paint, const SkMatrix& matrix, SkScalar y) {
+ virtual void setUp(const SkPaint& paint, const SkMatrix& matrix, SkScalar y,
+ const void* text) {
mMatrix = &matrix;
mPaint = &paint;
+ mText = static_cast<const uint16_t*>(text);
mY = y;
mBase = mBottom = mTop = INT_MAX;
}
@@ -81,10 +84,11 @@ public:
protected:
const SkMatrix* mMatrix;
const SkPaint* mPaint;
+ const uint16_t* mText;
+ SkScalar mY;
int mBase;
int mBottom;
int mTop;
- SkScalar mY;
};
class FirstCheck : public CommonCheck {
@@ -162,6 +166,8 @@ public:
full.fRight = mLast.fLeft;
}
mSelectRegion->op(full, SkRegion::kUnion_Op);
+ DBG_NAV_LOGD("MultilineBuilder full=(%d,%d,r=%d,b=%d)",
+ full.fLeft, full.fTop, full.fRight, full.fBottom);
mLast = full;
mLastBase = base();
if (mStart == mEnd)
@@ -178,6 +184,66 @@ protected:
bool mCapture;
};
+class TextExtractor : public CommonCheck {
+public:
+ TextExtractor(const SkRegion& region) : mSelectRegion(region),
+ mSkipFirstSpace(true) { // don't start with a space
+ }
+
+ virtual void setUp(const SkPaint& paint, const SkMatrix& matrix, SkScalar y,
+ const void* text) {
+ INHERITED::setUp(paint, matrix, y, text);
+ SkPaint charPaint = paint;
+ charPaint.setTextEncoding(SkPaint::kUTF8_TextEncoding);
+ mMinSpaceWidth = charPaint.measureText(" ", 1) * 3 / 4;
+ }
+
+ virtual bool onIRect(const SkIRect& rect, uint16_t glyphID) {
+ SkIRect full;
+ full.set(rect.fLeft, top(), rect.fRight, bottom());
+ if (mSelectRegion.contains(full)) {
+ if (!mSkipFirstSpace
+ && ((mLast.fTop < top() && mLast.fBottom < top() + 2)
+ || (mLast.fLeft < rect.fLeft // glyphs are LTR
+ && mLast.fRight + mMinSpaceWidth < rect.fLeft))) {
+ DBG_NAV_LOGD("TextExtractor [%02x] append space", glyphID);
+ *mSelectText.append() = ' ';
+ } else
+ mSkipFirstSpace = false;
+ DBG_NAV_LOGD("TextExtractor [%02x] append full=(%d,%d,r=%d,b=%d)",
+ glyphID, full.fLeft, full.fTop, full.fRight, full.fBottom);
+ SkUnichar uni;
+ SkPaint utfPaint = *mPaint;
+ utfPaint.setTextEncoding(SkPaint::kUTF16_TextEncoding);
+ utfPaint.glyphsToUnichars(&glyphID, 1, &uni);
+ if (uni) {
+ uint16_t chars[2];
+ size_t count = SkUTF16_FromUnichar(uni, chars);
+ *mSelectText.append() = chars[0];
+ if (count == 2)
+ *mSelectText.append() = chars[1];
+ }
+ mLast = full;
+ } else
+ DBG_NAV_LOGD("TextExtractor [%02x] skip full=(%d,%d,r=%d,b=%d)",
+ glyphID, full.fLeft, full.fTop, full.fRight, full.fBottom);
+ return false;
+ }
+
+ WebCore::String text() {
+ return WebCore::String(mSelectText.begin(), mSelectText.count());
+ }
+
+protected:
+ const SkRegion& mSelectRegion;
+ SkTDArray<uint16_t> mSelectText;
+ SkIRect mLast;
+ SkScalar mMinSpaceWidth;
+ bool mSkipFirstSpace;
+private:
+ typedef CommonCheck INHERITED;
+};
+
class TextCanvas : public SkCanvas {
public:
@@ -218,14 +284,14 @@ public:
virtual void drawText(const void* text, size_t byteLength, SkScalar x,
SkScalar y, const SkPaint& paint) {
- mBounder.setUp(paint, getTotalMatrix(), y);
+ mBounder.setUp(paint, getTotalMatrix(), y, text);
SkCanvas::drawText(text, byteLength, x, y, paint);
}
virtual void drawPosTextH(const void* text, size_t byteLength,
const SkScalar xpos[], SkScalar constY,
const SkPaint& paint) {
- mBounder.setUp(paint, getTotalMatrix(), constY);
+ mBounder.setUp(paint, getTotalMatrix(), constY, text);
SkCanvas::drawPosTextH(text, byteLength, xpos, constY, paint);
}
@@ -262,3 +328,17 @@ SkIRect CopyPaste::findClosest(const SkPicture& picture, const SkIRect& area,
_check.offsetBounds(area.fLeft, area.fTop);
return _check.bestBounds();
}
+
+WebCore::String CopyPaste::text(const SkPicture& picture, const SkIRect& area,
+ const SkRegion& region) {
+ SkRegion copy = region;
+ copy.translate(-area.fLeft, -area.fTop);
+ const SkIRect& bounds = copy.getBounds();
+ DBG_NAV_LOGD("area=(%d, %d, %d, %d) region=(%d, %d, %d, %d)",
+ area.fLeft, area.fTop, area.fRight, area.fBottom,
+ bounds.fLeft, bounds.fTop, bounds.fRight, bounds.fBottom);
+ TextExtractor extractor(copy);
+ TextCanvas checker(&extractor, picture, area);
+ checker.drawPicture(const_cast<SkPicture&>(picture));
+ return extractor.text();
+}
diff --git a/WebKit/android/nav/SelectText.h b/WebKit/android/nav/SelectText.h
index 3365816..32d8311 100644
--- a/WebKit/android/nav/SelectText.h
+++ b/WebKit/android/nav/SelectText.h
@@ -26,6 +26,8 @@
#ifndef SELECT_TEXT_H
#define SELECT_TEXT_H
+#include "PlatformString.h"
+
class SkPicture;
struct SkIRect;
struct SkIPoint;
@@ -37,6 +39,8 @@ public:
const SkIRect& selStart, const SkIRect& selEnd, SkRegion* region);
static SkIRect findClosest(const SkPicture& , const SkIRect& area,
int x, int y);
+ static WebCore::String text(const SkPicture& , const SkIRect& area,
+ const SkRegion& );
};
#endif
diff --git a/WebKit/android/nav/WebView.cpp b/WebKit/android/nav/WebView.cpp
index 0426337..8931d72 100644
--- a/WebKit/android/nav/WebView.cpp
+++ b/WebKit/android/nav/WebView.cpp
@@ -34,6 +34,7 @@
#include "CachedFrame.h"
#include "CachedNode.h"
#include "CachedRoot.h"
+#include "CString.h"
#include "FindCanvas.h"
#include "Frame.h"
#include "GraphicsJNI.h"
@@ -98,7 +99,7 @@ enum FrameCachePermission {
};
struct JavaGlue {
- jobject m_obj;
+ jweak m_obj;
jmethodID m_clearTextEntry;
jmethodID m_overrideLoading;
jmethodID m_scrollBy;
@@ -127,7 +128,7 @@ WebView(JNIEnv* env, jobject javaWebView, int viewImpl)
{
jclass clazz = env->FindClass("android/webkit/WebView");
// m_javaGlue = new JavaGlue;
- m_javaGlue.m_obj = adoptGlobalRef(env, javaWebView);
+ m_javaGlue.m_obj = env->NewWeakGlobalRef(javaWebView);
m_javaGlue.m_scrollBy = GetJMethod(env, clazz, "setContentScrollBy", "(IIZ)Z");
m_javaGlue.m_clearTextEntry = GetJMethod(env, clazz, "clearTextEntry", "()V");
m_javaGlue.m_overrideLoading = GetJMethod(env, clazz, "overrideLoading", "(Ljava/lang/String;)V");
@@ -173,7 +174,7 @@ WebView(JNIEnv* env, jobject javaWebView, int viewImpl)
if (m_javaGlue.m_obj)
{
JNIEnv* env = JSC::Bindings::getJNIEnv();
- env->DeleteGlobalRef(m_javaGlue.m_obj);
+ env->DeleteWeakGlobalRef(m_javaGlue.m_obj);
m_javaGlue.m_obj = 0;
}
delete m_frameCacheUI;
@@ -214,12 +215,7 @@ void clearTextEntry()
{
DEBUG_NAV_UI_LOGD("%s", __FUNCTION__);
JNIEnv* env = JSC::Bindings::getJNIEnv();
- AutoJObject obj = m_javaGlue.object(env);
- // if it is called during or after DESTROY is handled, the real object of
- // WebView can be gone. Check before using it.
- if (!obj.get())
- return;
- env->CallVoidMethod(obj.get(), m_javaGlue.m_clearTextEntry);
+ env->CallVoidMethod(m_javaGlue.object(env).get(), m_javaGlue.m_clearTextEntry);
checkException(env);
}
@@ -646,12 +642,7 @@ int getScaledMaxXScroll()
{
LOG_ASSERT(m_javaGlue.m_obj, "A java object was not associated with this native WebView!");
JNIEnv* env = JSC::Bindings::getJNIEnv();
- AutoJObject obj = m_javaGlue.object(env);
- // if it is called during or after DESTROY is handled, the real object of
- // WebView can be gone. Check before using it.
- if (!obj.get())
- return 0;
- int result = env->CallIntMethod(obj.get(), m_javaGlue.m_getScaledMaxXScroll);
+ int result = env->CallIntMethod(m_javaGlue.object(env).get(), m_javaGlue.m_getScaledMaxXScroll);
checkException(env);
return result;
}
@@ -660,12 +651,7 @@ int getScaledMaxYScroll()
{
LOG_ASSERT(m_javaGlue.m_obj, "A java object was not associated with this native WebView!");
JNIEnv* env = JSC::Bindings::getJNIEnv();
- AutoJObject obj = m_javaGlue.object(env);
- // if it is called during or after DESTROY is handled, the real object of
- // WebView can be gone. Check before using it.
- if (!obj.get())
- return 0;
- int result = env->CallIntMethod(obj.get(), m_javaGlue.m_getScaledMaxYScroll);
+ int result = env->CallIntMethod(m_javaGlue.object(env).get(), m_javaGlue.m_getScaledMaxYScroll);
checkException(env);
return result;
}
@@ -674,12 +660,7 @@ void getVisibleRect(WebCore::IntRect* rect)
{
LOG_ASSERT(m_javaGlue.m_obj, "A java object was not associated with this native WebView!");
JNIEnv* env = JSC::Bindings::getJNIEnv();
- AutoJObject obj = m_javaGlue.object(env);
- // if it is called during or after DESTROY is handled, the real object of
- // WebView can be gone. Check before using it.
- if (!obj.get())
- return;
- jobject jRect = env->CallObjectMethod(obj.get(), m_javaGlue.m_getVisibleRect);
+ jobject jRect = env->CallObjectMethod(m_javaGlue.object(env).get(), m_javaGlue.m_getVisibleRect);
checkException(env);
int left = (int) env->GetIntField(jRect, m_javaGlue.m_rectLeft);
checkException(env);
@@ -946,7 +927,7 @@ bool motionUp(int x, int y, int slop)
if (!root)
return 0;
const CachedFrame* frame = 0;
- const CachedNode* result = slop ? findAt(root, rect, &frame, &rx, &ry) : 0;
+ const CachedNode* result = findAt(root, rect, &frame, &rx, &ry);
if (!result) {
DBG_NAV_LOGD("no nodes found root=%p", root);
setNavBounds(rect);
@@ -998,13 +979,9 @@ int getBlockLeftEdge(int x, int y, float scale)
void overrideUrlLoading(const WebCore::String& url)
{
JNIEnv* env = JSC::Bindings::getJNIEnv();
- AutoJObject obj = m_javaGlue.object(env);
- // if it is called during or after DESTROY is handled, the real object of
- // WebView can be gone. Check before using it.
- if (!obj.get())
- return;
jstring jName = env->NewString((jchar*) url.characters(), url.length());
- env->CallVoidMethod(obj.get(), m_javaGlue.m_overrideLoading, jName);
+ env->CallVoidMethod(m_javaGlue.object(env).get(),
+ m_javaGlue.m_overrideLoading, jName);
env->DeleteLocalRef(jName);
}
@@ -1051,9 +1028,15 @@ void moveSelection(int x, int y, bool extendSelection)
m_selEnd.fLeft, m_selEnd.fTop, m_selEnd.fRight, m_selEnd.fBottom);
}
-const SkRegion& getSelection()
+const String getSelection()
{
- return m_selRegion;
+ WebCore::IntRect r;
+ getVisibleRect(&r);
+ SkIRect area;
+ area.set(r.x(), r.y(), r.right(), r.bottom());
+ String result = CopyPaste::text(*m_navPictureUI, area, m_selRegion);
+ DBG_NAV_LOGD("text=%s", result.latin1().data());
+ return result;
}
void drawSelectionRegion(SkCanvas* canvas)
@@ -1128,15 +1111,10 @@ void getSelectionCaret(SkPath* path)
void sendMoveFocus(WebCore::Frame* framePtr, WebCore::Node* nodePtr)
{
- DBG_NAV_LOGD("framePtr=%p nodePtr=%p x=%d y=%d", framePtr, nodePtr, x, y);
+ DBG_NAV_LOGD("framePtr=%p nodePtr=%p", framePtr, nodePtr);
JNIEnv* env = JSC::Bindings::getJNIEnv();
- AutoJObject obj = m_javaGlue.object(env);
- // if it is called during or after DESTROY is handled, the real object of
- // WebView can be gone. Check before using it.
- if (!obj.get())
- return;
- env->CallVoidMethod(obj.get(), m_javaGlue.m_sendMoveFocus, (jint) framePtr,
- (jint) nodePtr);
+ env->CallVoidMethod(m_javaGlue.object(env).get(),
+ m_javaGlue.m_sendMoveFocus, (jint) framePtr, (jint) nodePtr);
checkException(env);
}
@@ -1144,12 +1122,7 @@ void sendMoveMouse(WebCore::Frame* framePtr, WebCore::Node* nodePtr, int x, int
{
DBG_NAV_LOGD("framePtr=%p nodePtr=%p x=%d y=%d", framePtr, nodePtr, x, y);
JNIEnv* env = JSC::Bindings::getJNIEnv();
- AutoJObject obj = m_javaGlue.object(env);
- // if it is called during or after DESTROY is handled, the real object of
- // WebView can be gone. Check before using it.
- if (!obj.get())
- return;
- env->CallVoidMethod(obj.get(), m_javaGlue.m_sendMoveMouse,
+ env->CallVoidMethod(m_javaGlue.object(env).get(), m_javaGlue.m_sendMoveMouse,
(jint) framePtr, (jint) nodePtr, x, y);
checkException(env);
}
@@ -1158,12 +1131,8 @@ void sendMoveMouseIfLatest(bool disableFocusController)
{
LOG_ASSERT(m_javaGlue.m_obj, "A java object was not associated with this native WebView!");
JNIEnv* env = JSC::Bindings::getJNIEnv();
- AutoJObject obj = m_javaGlue.object(env);
- // if it is called during or after DESTROY is handled, the real object of
- // WebView can be gone. Check before using it.
- if (!obj.get())
- return;
- env->CallVoidMethod(obj.get(), m_javaGlue.m_sendMoveMouseIfLatest, disableFocusController);
+ env->CallVoidMethod(m_javaGlue.object(env).get(),
+ m_javaGlue.m_sendMoveMouseIfLatest, disableFocusController);
checkException(env);
}
@@ -1175,12 +1144,7 @@ void sendMotionUp(
m_generation, framePtr, nodePtr, x, y);
LOG_ASSERT(m_javaGlue.m_obj, "A WebView was not associated with this WebViewNative!");
JNIEnv* env = JSC::Bindings::getJNIEnv();
- AutoJObject obj = m_javaGlue.object(env);
- // if it is called during or after DESTROY is handled, the real object of
- // WebView can be gone. Check before using it.
- if (!obj.get())
- return;
- env->CallVoidMethod(obj.get(), m_javaGlue.m_sendMotionUp,
+ env->CallVoidMethod(m_javaGlue.object(env).get(), m_javaGlue.m_sendMotionUp,
m_generation, (jint) framePtr, (jint) nodePtr, x, y);
checkException(env);
}
@@ -1249,12 +1213,7 @@ bool scrollBy(int dx, int dy)
LOG_ASSERT(m_javaGlue.m_obj, "A java object was not associated with this native WebView!");
JNIEnv* env = JSC::Bindings::getJNIEnv();
- AutoJObject obj = m_javaGlue.object(env);
- // if it is called during or after DESTROY is handled, the real object of
- // WebView can be gone. Check before using it.
- if (!obj.get())
- return false;
- bool result = env->CallBooleanMethod(obj.get(),
+ bool result = env->CallBooleanMethod(m_javaGlue.object(env).get(),
m_javaGlue.m_scrollBy, dx, dy, true);
checkException(env);
return result;
@@ -1291,49 +1250,30 @@ bool hasFocusNode()
void rebuildWebTextView()
{
JNIEnv* env = JSC::Bindings::getJNIEnv();
- AutoJObject obj = m_javaGlue.object(env);
- // if it is called during or after DESTROY is handled, the real object of
- // WebView can be gone. Check before using it.
- if (!obj.get())
- return;
- env->CallVoidMethod(obj.get(), m_javaGlue.m_rebuildWebTextView);
+ env->CallVoidMethod(m_javaGlue.object(env).get(),
+ m_javaGlue.m_rebuildWebTextView);
checkException(env);
}
void viewInvalidate()
{
JNIEnv* env = JSC::Bindings::getJNIEnv();
- AutoJObject obj = m_javaGlue.object(env);
- // if it is called during or after DESTROY is handled, the real object of
- // WebView can be gone. Check before using it.
- if (!obj.get())
- return;
- env->CallVoidMethod(obj.get(), m_javaGlue.m_viewInvalidate);
+ env->CallVoidMethod(m_javaGlue.object(env).get(), m_javaGlue.m_viewInvalidate);
checkException(env);
}
void viewInvalidateRect(int l, int t, int r, int b)
{
JNIEnv* env = JSC::Bindings::getJNIEnv();
- AutoJObject obj = m_javaGlue.object(env);
- // if it is called during or after DESTROY is handled, the real object of
- // WebView can be gone. Check before using it.
- if (!obj.get())
- return;
- env->CallVoidMethod(obj.get(), m_javaGlue.m_viewInvalidateRect, l, r, t, b);
+ env->CallVoidMethod(m_javaGlue.object(env).get(), m_javaGlue.m_viewInvalidateRect, l, r, t, b);
checkException(env);
}
void postInvalidateDelayed(int64_t delay, const WebCore::IntRect& bounds)
{
JNIEnv* env = JSC::Bindings::getJNIEnv();
- AutoJObject obj = m_javaGlue.object(env);
- // if it is called during or after DESTROY is handled, the real object of
- // WebView can be gone. Check before using it.
- if (!obj.get())
- return;
- env->CallVoidMethod(obj.get(), m_javaGlue.m_postInvalidateDelayed,
- delay, bounds.x(), bounds.y(), bounds.right(), bounds.bottom());
+ env->CallVoidMethod(m_javaGlue.object(env).get(), m_javaGlue.m_postInvalidateDelayed,
+ delay, bounds.x(), bounds.y(), bounds.right(), bounds.bottom());
checkException(env);
}
@@ -2107,7 +2047,8 @@ static jobject nativeGetSelection(JNIEnv *env, jobject obj)
{
WebView* view = GET_NATIVE_VIEW(env, obj);
LOG_ASSERT(view, "view not set in %s", __FUNCTION__);
- return GraphicsJNI::createRegion(env, new SkRegion(view->getSelection()));
+ String selection = view->getSelection();
+ return env->NewString((jchar*)selection.characters(), selection.length());
}
#ifdef ANDROID_DUMP_DISPLAY_TREE
@@ -2237,7 +2178,7 @@ static JNINativeMethod gJavaWebViewMethods[] = {
(void*) nativeFocusNodePointer },
{ "nativeGetCursorRingBounds", "()Landroid/graphics/Rect;",
(void*) nativeGetCursorRingBounds },
- { "nativeGetSelection", "()Landroid/graphics/Region;",
+ { "nativeGetSelection", "()Ljava/lang/String;",
(void*) nativeGetSelection },
{ "nativeHasCursorNode", "()Z",
(void*) nativeHasCursorNode },
diff --git a/WebKit/android/plugins/ANPSoundInterface.cpp b/WebKit/android/plugins/ANPSoundInterface.cpp
index 2e56e24..8e31d69 100644
--- a/WebKit/android/plugins/ANPSoundInterface.cpp
+++ b/WebKit/android/plugins/ANPSoundInterface.cpp
@@ -27,6 +27,7 @@
#include "config.h"
#include "android_npapi.h"
+#include "SkTypes.h"
#include "media/AudioTrack.h"
struct ANPAudioTrack {
diff --git a/WebKit/android/sort.cpp b/WebKit/android/sort.cpp
deleted file mode 100644
index 9a8a535..0000000
--- a/WebKit/android/sort.cpp
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright 2007, 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.
- */
-
-#include "config.h"
-
-namespace std
-{
- void sort(const void** start, const void** end, const void** temp, Comparator comp)
- {
- size_t endlen = end - start;
- size_t midlen = endlen / 2;
- const void** mid = start + midlen;
- if (midlen > 1)
- sort(start, mid, temp, comp);
- if (end - mid > 1)
- sort(mid, end, temp, comp);
- memcpy(temp, start, midlen * sizeof(*start));
- size_t i = 0;
- size_t j = midlen;
- size_t off = 0;
- while (i < midlen && j < endlen)
- start[off++] = (*comp)(start[j], temp[i]) ? start[j++] : temp[i++];
- if (i < midlen)
- memcpy(&start[off], &temp[i], (midlen - i) * sizeof(*start));
- }
-
- void sort(const void** start, const void** end, Comparator comp) {
- if (end - start > 1) {
- const void** temp = new sortType[(end - start) / 2];
- sort(start, end, temp, comp);
- delete[] temp;
- }
- }
-}
diff --git a/WebKit/android/stl/algorithm b/WebKit/android/stl/algorithm
deleted file mode 100644
index 131fe0d..0000000
--- a/WebKit/android/stl/algorithm
+++ /dev/null
@@ -1,277 +0,0 @@
-#ifdef __cplusplus
-
-/*
- *
- * Copyright (c) 1994
- * Hewlett-Packard Company
- *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation. Hewlett-Packard Company makes no
- * representations about the suitability of this software for any
- * purpose. It is provided "as is" without express or implied warranty.
- *
- *
- * Copyright (c) 1996-1998
- * Silicon Graphics Computer Systems, Inc.
- *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation. Silicon Graphics makes no
- * representations about the suitability of this software for any
- * purpose. It is provided "as is" without express or implied warranty.
- */
-
- // extracted from stl_algobase.h
- // full STL is not compatible with the ARM build
- // a limited number of STL functions is used by webkit: swap, max, and min are
- // included below for webkit compatibility
-
-#ifdef __GLIBCPP_INTERNAL_ALGOBASE_H
-#error "real STL defined"
-#endif
-
-#ifndef __ANDROID_ALGORITHM
-#define __ANDROID_ALGORITHM
-
-#ifndef __ANDROID_LIMITS
-#include <limits>
-#endif
-
-#ifndef _CPP_UTILITY
-#include <utility>
-#endif
-
-#include <SkScalar.h> // for SK_ScalarNaN
-#ifdef PREFIX_FOR_WEBCORE
-#include <SkTSearch.h>
-#endif
-
-#include <float.h>
-#include <math.h>
-#include <stdint.h>
-#include <stddef.h>
-
-#ifndef WCHAR_MAX
- #define WCHAR_MAX 0xFFFF
-#endif
-
-namespace std
-{
- template<typename _Tp>
- inline void
- swap(_Tp& __a, _Tp& __b)
- {
- _Tp __tmp = __a;
- __a = __b;
- __b = __tmp;
- }
-
- template<typename _Tp>
- inline void
- reverse(_Tp* __first, _Tp* __last)
- {
- while(true)
- {
- if (__first == __last || __first == --__last)
- return;
- else
- {
- _Tp __tmp = *__first;
- *__first = *__last;
- *__last = __tmp;
- }
- ++__first;
- }
- }
-
- #undef min
- #undef max
-
- template<typename _Tp>
- inline const _Tp&
- min(const _Tp& __a, const _Tp& __b)
- {
- return __b < __a ? __b : __a;
- }
-
- template<typename _Tp>
- inline const _Tp&
- max(const _Tp& __a, const _Tp& __b)
- {
- return __a < __b ? __b : __a;
- }
-
-template <class _InputIter, class _OutputIter>
-inline _OutputIter copy(_InputIter __first, _InputIter __last,
- _OutputIter __result)
-{
- for (size_t __n = __last - __first; __n > 0; --__n) {
- *__result = *__first;
- ++__first;
- ++__result;
- }
- return __result;
-}
-
-template <class _ForwardIter, class _Tp>
-void fill(_ForwardIter __first, _ForwardIter __last, const _Tp& __value) {
- for ( ; __first != __last; ++__first)
- *__first = __value;
-}
-
-#ifndef UINTPTR_MAX
-#define UINTPTR_MAX UINT32_MAX
-#endif
-
-#ifndef UINT32_MAX
-#define UINT32_MAX (0xffffffff)
-#endif
-
-template <typename T>
-struct numeric_limits {
- /// Returns the minimum value for type T.
- static inline T min (void) { return (T(0)); }
- /// Returns the minimum value for type T.
- static inline T max (void) { return (T(0)); }
- static const bool is_signed = false; ///< True if the type is signed.
- static const bool is_integer = false; ///< True if stores an exact value.
- static const bool is_integral = false; ///< True if fixed size and cast-copyable.
-};
-
-template <typename T>
-struct numeric_limits<T*> {
- static inline T* min (void) { return (NULL); }
- static inline T* max (void) { return (UINTPTR_MAX); }
- static const bool is_signed = false;
- static const bool is_integer = true;
- static const bool is_integral = true;
-};
-
-#define _NUMERIC_LIMITS(type, minVal, maxVal, quietNaN, bSigned, bInteger, bIntegral) \
-template <> \
-struct numeric_limits<type> { \
- static inline type infinity (void) { return (maxVal); } \
- static inline type min (void) { return (minVal); } \
- static inline type max (void) { return (maxVal); } \
- static inline type quiet_NaN() { return (quietNaN); } \
- static const bool is_signed = bSigned; \
- static const bool is_integer = bInteger; \
- static const bool is_integral = bIntegral; \
-}
-
-//--------------------------------------------------------------------------------------
-// type min max NaN signed integer integral
-//--------------------------------------------------------------------------------------
-_NUMERIC_LIMITS (bool, false, true, 0, false, true, true);
-_NUMERIC_LIMITS (char, SCHAR_MIN, SCHAR_MAX, 0, true, true, true);
-_NUMERIC_LIMITS (int, INT_MIN, INT_MAX, 0, true, true, true);
-_NUMERIC_LIMITS (short, SHRT_MIN, SHRT_MAX, 0, true, true, true);
-_NUMERIC_LIMITS (long, LONG_MIN, LONG_MAX, 0, true, true, true);
-#if HAVE_THREE_CHAR_TYPES
-_NUMERIC_LIMITS (signed char, SCHAR_MIN, SCHAR_MAX, 0, true, true, true);
-#endif
-_NUMERIC_LIMITS (unsigned char, 0, UCHAR_MAX, 0, false, true, true);
-_NUMERIC_LIMITS (unsigned int, 0, UINT_MAX, 0, false, true, true);
-_NUMERIC_LIMITS (unsigned short,0, USHRT_MAX, 0, false, true, true);
-_NUMERIC_LIMITS (unsigned long, 0, ULONG_MAX, 0, false, true, true);
-_NUMERIC_LIMITS (wchar_t, 0, WCHAR_MAX, 0, false, true, true);
-_NUMERIC_LIMITS (float, FLT_MIN, FLT_MAX, SK_ScalarNaN, true, false, true);
-_NUMERIC_LIMITS (double, DBL_MIN, DBL_MAX, SK_ScalarNaN, true, false, true);
-_NUMERIC_LIMITS (long double, LDBL_MIN, LDBL_MAX, SK_ScalarNaN, true, false, true);
-#ifdef HAVE_LONG_LONG
-_NUMERIC_LIMITS (long long, LLONG_MIN, LLONG_MAX, 0, true, true, true);
-_NUMERIC_LIMITS (unsigned long long, 0, ULLONG_MAX, 0, false, true, true);
-#endif
-//--------------------------------------------------------------------------------------
-
-using ::ptrdiff_t;
-
-typedef bool (* Comparator)(const void*, const void*);
-extern void sort(const void** start, const void** end, Comparator comp);
-
-#ifdef PREFIX_FOR_WEBCORE
- typedef const void* sortType;
-
- inline bool binary_search(const unsigned short* const base,
- const unsigned short* const end,
- short target)
- {
- return SkTSearch<unsigned short>(base, end - base, target, sizeof(unsigned short)) >= 0;
- }
-
-
- template<typename P> inline void sort (P** start, P**end,
- bool (* comp)(const P*, const P*))
- {
- sort((const void**) start, (const void**) end, (Comparator) comp);
- }
-
- template<typename P> void sort(P* start, P* end,
- bool (* comp)(const P&, const P&)) {
- stable_sort(start, end, *comp);
- }
-
- template<typename P> inline void stable_sort(P** start, P** end,
- bool (* comp)(P*, P*))
- {
- sort((const void**) start, (const void**) end, (Comparator) comp);
- }
-
- template<typename P> inline void stable_sort(P** start, P** end,
- bool (& comp)(const P*, const P*))
- {
- sort((const void**) start, (const void**) end, (Comparator) &comp);
- }
-
- template<typename P> void stable_sort(P* start, P* end, P* temp,
- bool (& comp)(const P&, const P&)) {
- size_t endlen = end - start;
- size_t midlen = endlen / 2;
- P* mid = start + midlen;
- if (midlen > 1)
- stable_sort(start, mid, temp, comp);
- if (end - mid > 1)
- stable_sort(mid, end, temp, comp);
- memcpy(temp, start, midlen * sizeof(*start));
- size_t i = 0;
- size_t j = midlen;
- size_t off = 0;
- while (i < midlen && j < endlen) {
- P* dst = (comp)(start[j], temp[i]) ? &start[j++] : &temp[i++];
- memcpy(&start[off++], dst, sizeof(*start));
- }
- if (i < midlen)
- memcpy(&start[off], &temp[i], (midlen - i) * sizeof(*start));
- }
-
- template<typename P> void stable_sort(P* start, P* end,
- bool (& comp)(const P&, const P&)) {
- if (end - start > 1) {
- size_t count = (end - start) / 2;
- P* temp = static_cast<P*>(malloc(count * sizeof(P)));
- stable_sort(start, end, temp, comp);
- free(temp);
- }
- }
-
- template<typename P> void stable_sort(P* start, P* end,
- bool (& comp)(P, P)) {
- stable_sort(start, end, (bool (&)(const P&, const P&))(comp));
- }
-
- class ostream {
- int this_class_intentionally_left_empty;
- };
-#endif
-
-}
-
-#endif
-
-#endif // __cplusplus
-
diff --git a/WebKit/android/stl/concept_checks.h b/WebKit/android/stl/concept_checks.h
deleted file mode 100644
index 72cc138..0000000
--- a/WebKit/android/stl/concept_checks.h
+++ /dev/null
@@ -1,812 +0,0 @@
-/*
- * Copyright 2009, The Android Open Source Project
- * Copyright (c) 1999
- * Silicon Graphics Computer Systems, Inc.
- *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation. Silicon Graphics makes no
- * representations about the suitability of this software for any
- * purpose. It is provided "as is" without express or implied warranty.
- */
-
-#ifndef __CONCEPT_CHECKS_H
-#define __CONCEPT_CHECKS_H
-
-/*
- Use these macro like assertions, but they assert properties
- on types (usually template arguments). In technical terms they
- verify whether a type "models" a "concept".
-
- This set of requirements and the terminology used here is derived
- from the book "Generic Programming and the STL" by Matt Austern
- (Addison Wesley). For further information please consult that
- book. The requirements also are intended to match the ANSI/ISO C++
- standard.
-
- This file covers the basic concepts and the iterator concepts.
- There are several other files that provide the requirements
- for the STL containers:
- container_concepts.h
- sequence_concepts.h
- assoc_container_concepts.h
-
- Jeremy Siek, 1999
-
- TO DO:
- - some issues with regards to concept classification and mutability
- including AssociativeContianer -> ForwardContainer
- and SortedAssociativeContainer -> ReversibleContainer
- - HashedAssociativeContainer
- - Allocator
- - Function Object Concepts
-
- */
-
-#ifndef __STL_USE_CONCEPT_CHECKS
-
-// Some compilers lack the features that are necessary for concept checks.
-// On those compilers we define the concept check macros to do nothing.
-#define __STL_REQUIRES(__type_var, __concept) do {} while(0)
-#define __STL_CLASS_REQUIRES(__type_var, __concept) \
- static int __##__type_var##_##__concept
-#define __STL_CONVERTIBLE(__type_x, __type_y) do {} while(0)
-#define __STL_REQUIRES_SAME_TYPE(__type_x, __type_y) do {} while(0)
-#define __STL_CLASS_REQUIRES_SAME_TYPE(__type_x, __type_y) \
- static int __##__type_x##__type_y##_require_same_type
-#define __STL_GENERATOR_CHECK(__func, __ret) do {} while(0)
-#define __STL_CLASS_GENERATOR_CHECK(__func, __ret) \
- static int __##__func##__ret##_generator_check
-#define __STL_UNARY_FUNCTION_CHECK(__func, __ret, __arg) do {} while(0)
-#define __STL_CLASS_UNARY_FUNCTION_CHECK(__func, __ret, __arg) \
- static int __##__func##__ret##__arg##_unary_function_check
-#define __STL_BINARY_FUNCTION_CHECK(__func, __ret, __first, __second) \
- do {} while(0)
-#define __STL_CLASS_BINARY_FUNCTION_CHECK(__func, __ret, __first, __second) \
- static int __##__func##__ret##__first##__second##_binary_function_check
-#define __STL_REQUIRES_BINARY_OP(__opname, __ret, __first, __second) \
- do {} while(0)
-#define __STL_CLASS_REQUIRES_BINARY_OP(__opname, __ret, __first, __second) \
- static int __##__opname##__ret##__first##__second##_require_binary_op
-
-#else /* __STL_USE_CONCEPT_CHECKS */
-
-// This macro tests whether the template argument "__type_var"
-// satisfies the requirements of "__concept". Here is a list of concepts
-// that we know how to check:
-// _Allocator
-// _Assignable
-// _DefaultConstructible
-// _EqualityComparable
-// _LessThanComparable
-// _TrivialIterator
-// _InputIterator
-// _OutputIterator
-// _ForwardIterator
-// _BidirectionalIterator
-// _RandomAccessIterator
-// _Mutable_TrivialIterator
-// _Mutable_ForwardIterator
-// _Mutable_BidirectionalIterator
-// _Mutable_RandomAccessIterator
-
-#define __STL_REQUIRES(__type_var, __concept) \
-do { \
- void (*__x)( __type_var ) = __concept##_concept_specification< __type_var >\
- ::__concept##_requirement_violation; __x = __x; } while (0)
-
-// Use this to check whether type X is convertible to type Y
-#define __STL_CONVERTIBLE(__type_x, __type_y) \
-do { \
- void (*__x)( __type_x , __type_y ) = _STL_CONVERT_ERROR< __type_x , \
- __type_y >::__type_X_is_not_convertible_to_type_Y; \
- __x = __x; } while (0)
-
-// Use this to test whether two template arguments are the same type
-#define __STL_REQUIRES_SAME_TYPE(__type_x, __type_y) \
-do { \
- void (*__x)( __type_x , __type_y ) = _STL_SAME_TYPE_ERROR< __type_x, \
- __type_y >::__type_X_not_same_as_type_Y; \
- __x = __x; } while (0)
-
-
-// function object checks
-#define __STL_GENERATOR_CHECK(__func, __ret) \
-do { \
- __ret (*__x)( __func&) = \
- _STL_GENERATOR_ERROR< \
- __func, __ret>::__generator_requirement_violation; \
- __x = __x; } while (0)
-
-
-#define __STL_UNARY_FUNCTION_CHECK(__func, __ret, __arg) \
-do { \
- __ret (*__x)( __func&, const __arg& ) = \
- _STL_UNARY_FUNCTION_ERROR< \
- __func, __ret, __arg>::__unary_function_requirement_violation; \
- __x = __x; } while (0)
-
-
-#define __STL_BINARY_FUNCTION_CHECK(__func, __ret, __first, __second) \
-do { \
- __ret (*__x)( __func&, const __first&, const __second& ) = \
- _STL_BINARY_FUNCTION_ERROR< \
- __func, __ret, __first, __second>::__binary_function_requirement_violation; \
- __x = __x; } while (0)
-
-
-#define __STL_REQUIRES_BINARY_OP(__opname, __ret, __first, __second) \
- do { \
- __ret (*__x)( __first&, __second& ) = _STL_BINARY##__opname##_ERROR< \
- __ret, __first, __second>::__binary_operator_requirement_violation; \
- __ret (*__y)( const __first&, const __second& ) = \
- _STL_BINARY##__opname##_ERROR< __ret, __first, __second>:: \
- __const_binary_operator_requirement_violation; \
- __y = __y; __x = __x; } while (0)
-
-
-#ifdef __STL_NO_FUNCTION_PTR_IN_CLASS_TEMPLATE
-
-#define __STL_CLASS_REQUIRES(__type_var, __concept)
-#define __STL_CLASS_REQUIRES_SAME_TYPE(__type_x, __type_y)
-#define __STL_CLASS_GENERATOR_CHECK(__func, __ret)
-#define __STL_CLASS_UNARY_FUNCTION_CHECK(__func, __ret, __arg)
-#define __STL_CLASS_BINARY_FUNCTION_CHECK(__func, __ret, __first, __second)
-#define __STL_CLASS_REQUIRES_BINARY_OP(__opname, __ret, __first, __second)
-
-#else
-
-// Use this macro inside of template classes, where you would
-// like to place requirements on the template arguments to the class
-// Warning: do not pass pointers and such (e.g. T*) in as the __type_var,
-// since the type_var is used to construct identifiers. Instead typedef
-// the pointer type, then use the typedef name for the __type_var.
-#define __STL_CLASS_REQUIRES(__type_var, __concept) \
- typedef void (* __func##__type_var##__concept)( __type_var ); \
- template <__func##__type_var##__concept _Tp1> \
- struct __dummy_struct_##__type_var##__concept { }; \
- static __dummy_struct_##__type_var##__concept< \
- __concept##_concept_specification< \
- __type_var>::__concept##_requirement_violation> \
- __dummy_ptr_##__type_var##__concept
-
-
-#define __STL_CLASS_REQUIRES_SAME_TYPE(__type_x, __type_y) \
- typedef void (* __func_##__type_x##__type_y##same_type)( __type_x, \
- __type_y ); \
- template < __func_##__type_x##__type_y##same_type _Tp1> \
- struct __dummy_struct_##__type_x##__type_y##_same_type { }; \
- static __dummy_struct_##__type_x##__type_y##_same_type< \
- _STL_SAME_TYPE_ERROR<__type_x, __type_y>::__type_X_not_same_as_type_Y> \
- __dummy_ptr_##__type_x##__type_y##_same_type
-
-
-#define __STL_CLASS_GENERATOR_CHECK(__func, __ret) \
- typedef __ret (* __f_##__func##__ret##_generator)( __func& ); \
- template <__f_##__func##__ret##_generator _Tp1> \
- struct __dummy_struct_##__func##__ret##_generator { }; \
- static __dummy_struct_##__func##__ret##_generator< \
- _STL_GENERATOR_ERROR< \
- __func, __ret>::__generator_requirement_violation> \
- __dummy_ptr_##__func##__ret##_generator
-
-
-#define __STL_CLASS_UNARY_FUNCTION_CHECK(__func, __ret, __arg) \
- typedef __ret (* __f_##__func##__ret##__arg##_unary_check)( __func&, \
- const __arg& ); \
- template <__f_##__func##__ret##__arg##_unary_check _Tp1> \
- struct __dummy_struct_##__func##__ret##__arg##_unary_check { }; \
- static __dummy_struct_##__func##__ret##__arg##_unary_check< \
- _STL_UNARY_FUNCTION_ERROR< \
- __func, __ret, __arg>::__unary_function_requirement_violation> \
- __dummy_ptr_##__func##__ret##__arg##_unary_check
-
-
-#define __STL_CLASS_BINARY_FUNCTION_CHECK(__func, __ret, __first, __second) \
- typedef __ret (* __f_##__func##__ret##__first##__second##_binary_check)( __func&, const __first&,\
- const __second& ); \
- template <__f_##__func##__ret##__first##__second##_binary_check _Tp1> \
- struct __dummy_struct_##__func##__ret##__first##__second##_binary_check { }; \
- static __dummy_struct_##__func##__ret##__first##__second##_binary_check< \
- _STL_BINARY_FUNCTION_ERROR<__func, __ret, __first, __second>:: \
- __binary_function_requirement_violation> \
- __dummy_ptr_##__func##__ret##__first##__second##_binary_check
-
-
-#define __STL_CLASS_REQUIRES_BINARY_OP(__opname, __ret, __first, __second) \
- typedef __ret (* __f_##__func##__ret##__first##__second##_binary_op)(const __first&, \
- const __second& ); \
- template <__f_##__func##__ret##__first##__second##_binary_op _Tp1> \
- struct __dummy_struct_##__func##__ret##__first##__second##_binary_op { }; \
- static __dummy_struct_##__func##__ret##__first##__second##_binary_op< \
- _STL_BINARY##__opname##_ERROR<__ret, __first, __second>:: \
- __binary_operator_requirement_violation> \
- __dummy_ptr_##__func##__ret##__first##__second##_binary_op
-
-#endif
-
-/* helper class for finding non-const version of a type. Need to have
- something to assign to etc. when testing constant iterators. */
-
-template <class _Tp>
-struct _Mutable_trait {
- typedef _Tp _Type;
-};
-template <class _Tp>
-struct _Mutable_trait<const _Tp> {
- typedef _Tp _Type;
-};
-
-
-/* helper function for avoiding compiler warnings about unused variables */
-template <class _Type>
-void __sink_unused_warning(_Type) { }
-
-template <class _TypeX, class _TypeY>
-struct _STL_CONVERT_ERROR {
- static void
- __type_X_is_not_convertible_to_type_Y(_TypeX __x, _TypeY) {
- _TypeY __y = __x;
- __sink_unused_warning(__y);
- }
-};
-
-
-template <class _Type> struct __check_equal { };
-
-template <class _TypeX, class _TypeY>
-struct _STL_SAME_TYPE_ERROR {
- static void
- __type_X_not_same_as_type_Y(_TypeX , _TypeY ) {
- __check_equal<_TypeX> t1 = __check_equal<_TypeY>();
- }
-};
-
-
-// Some Functon Object Checks
-
-template <class _Func, class _Ret>
-struct _STL_GENERATOR_ERROR {
- static _Ret __generator_requirement_violation(_Func& __f) {
- return __f();
- }
-};
-
-template <class _Func>
-struct _STL_GENERATOR_ERROR<_Func, void> {
- static void __generator_requirement_violation(_Func& __f) {
- __f();
- }
-};
-
-
-template <class _Func, class _Ret, class _Arg>
-struct _STL_UNARY_FUNCTION_ERROR {
- static _Ret
- __unary_function_requirement_violation(_Func& __f,
- const _Arg& __arg) {
- return __f(__arg);
- }
-};
-
-template <class _Func, class _Arg>
-struct _STL_UNARY_FUNCTION_ERROR<_Func, void, _Arg> {
- static void
- __unary_function_requirement_violation(_Func& __f,
- const _Arg& __arg) {
- __f(__arg);
- }
-};
-
-template <class _Func, class _Ret, class _First, class _Second>
-struct _STL_BINARY_FUNCTION_ERROR {
- static _Ret
- __binary_function_requirement_violation(_Func& __f,
- const _First& __first,
- const _Second& __second) {
- return __f(__first, __second);
- }
-};
-
-template <class _Func, class _First, class _Second>
-struct _STL_BINARY_FUNCTION_ERROR<_Func, void, _First, _Second> {
- static void
- __binary_function_requirement_violation(_Func& __f,
- const _First& __first,
- const _Second& __second) {
- __f(__first, __second);
- }
-};
-
-
-#define __STL_DEFINE_BINARY_OP_CHECK(_OP, _NAME) \
-template <class _Ret, class _First, class _Second> \
-struct _STL_BINARY##_NAME##_ERROR { \
- static _Ret \
- __const_binary_operator_requirement_violation(const _First& __first, \
- const _Second& __second) { \
- return __first _OP __second; \
- } \
- static _Ret \
- __binary_operator_requirement_violation(_First& __first, \
- _Second& __second) { \
- return __first _OP __second; \
- } \
-}
-
-__STL_DEFINE_BINARY_OP_CHECK(==, _OP_EQUAL);
-__STL_DEFINE_BINARY_OP_CHECK(!=, _OP_NOT_EQUAL);
-__STL_DEFINE_BINARY_OP_CHECK(<, _OP_LESS_THAN);
-__STL_DEFINE_BINARY_OP_CHECK(<=, _OP_LESS_EQUAL);
-__STL_DEFINE_BINARY_OP_CHECK(>, _OP_GREATER_THAN);
-__STL_DEFINE_BINARY_OP_CHECK(>=, _OP_GREATER_EQUAL);
-__STL_DEFINE_BINARY_OP_CHECK(+, _OP_PLUS);
-__STL_DEFINE_BINARY_OP_CHECK(*, _OP_TIMES);
-__STL_DEFINE_BINARY_OP_CHECK(/, _OP_DIVIDE);
-__STL_DEFINE_BINARY_OP_CHECK(-, _OP_SUBTRACT);
-__STL_DEFINE_BINARY_OP_CHECK(%, _OP_MOD);
-// ...
-
-// TODO, add unary operators (prefix and postfix)
-
-/*
- The presence of this class is just to trick EDG into displaying
- these error messages before any other errors. Without the
- classes, the errors in the functions get reported after
- other class errors deep inside the library. The name
- choice just makes for an eye catching error message :)
- */
-struct _STL_ERROR {
-
- template <class _Type>
- static _Type
- __default_constructor_requirement_violation(_Type) {
- return _Type();
- }
- template <class _Type>
- static _Type
- __assignment_operator_requirement_violation(_Type __a) {
- __a = __a;
- return __a;
- }
- template <class _Type>
- static _Type
- __copy_constructor_requirement_violation(_Type __a) {
- _Type __c(__a);
- return __c;
- }
- template <class _Type>
- static _Type
- __const_parameter_required_for_copy_constructor(_Type /* __a */,
- const _Type& __b) {
- _Type __c(__b);
- return __c;
- }
- template <class _Type>
- static _Type
- __const_parameter_required_for_assignment_operator(_Type __a,
- const _Type& __b) {
- __a = __b;
- return __a;
- }
- template <class _Type>
- static _Type
- __less_than_comparable_requirement_violation(_Type __a, _Type __b) {
- if (__a < __b || __a > __b || __a <= __b || __a >= __b) return __a;
- return __b;
- }
- template <class _Type>
- static _Type
- __equality_comparable_requirement_violation(_Type __a, _Type __b) {
- if (__a == __b || __a != __b) return __a;
- return __b;
- }
- template <class _Iterator>
- static void
- __dereference_operator_requirement_violation(_Iterator __i) {
- __sink_unused_warning(*__i);
- }
- template <class _Iterator>
- static void
- __dereference_operator_and_assignment_requirement_violation(_Iterator __i) {
- *__i = *__i;
- }
- template <class _Iterator>
- static void
- __preincrement_operator_requirement_violation(_Iterator __i) {
- ++__i;
- }
- template <class _Iterator>
- static void
- __postincrement_operator_requirement_violation(_Iterator __i) {
- __i++;
- }
- template <class _Iterator>
- static void
- __predecrement_operator_requirement_violation(_Iterator __i) {
- --__i;
- }
- template <class _Iterator>
- static void
- __postdecrement_operator_requirement_violation(_Iterator __i) {
- __i--;
- }
- template <class _Iterator, class _Type>
- static void
- __postincrement_operator_and_assignment_requirement_violation(_Iterator __i,
- _Type __t) {
- *__i++ = __t;
- }
- template <class _Iterator, class _Distance>
- static _Iterator
- __iterator_addition_assignment_requirement_violation(_Iterator __i,
- _Distance __n) {
- __i += __n;
- return __i;
- }
- template <class _Iterator, class _Distance>
- static _Iterator
- __iterator_addition_requirement_violation(_Iterator __i, _Distance __n) {
- __i = __i + __n;
- __i = __n + __i;
- return __i;
- }
- template <class _Iterator, class _Distance>
- static _Iterator
- __iterator_subtraction_assignment_requirement_violation(_Iterator __i,
- _Distance __n) {
- __i -= __n;
- return __i;
- }
- template <class _Iterator, class _Distance>
- static _Iterator
- __iterator_subtraction_requirement_violation(_Iterator __i, _Distance __n) {
- __i = __i - __n;
- return __i;
- }
- template <class _Iterator, class _Distance>
- static _Distance
- __difference_operator_requirement_violation(_Iterator __i, _Iterator __j,
- _Distance __n) {
- __n = __i - __j;
- return __n;
- }
- template <class _Exp, class _Type, class _Distance>
- static _Type
- __element_access_operator_requirement_violation(_Exp __x, _Type*,
- _Distance __n) {
- return __x[__n];
- }
- template <class _Exp, class _Type, class _Distance>
- static void
- __element_assignment_operator_requirement_violation(_Exp __x,
- _Type* __t,
- _Distance __n) {
- __x[__n] = *__t;
- }
-
-}; /* _STL_ERROR */
-
-/* Associated Type Requirements */
-
-__STL_BEGIN_NAMESPACE
-template <class _Iterator> struct iterator_traits;
-__STL_END_NAMESPACE
-
-template <class _Iter>
-struct __value_type_type_definition_requirement_violation {
- typedef typename __STD::iterator_traits<_Iter>::value_type value_type;
-};
-
-template <class _Iter>
-struct __difference_type_type_definition_requirement_violation {
- typedef typename __STD::iterator_traits<_Iter>::difference_type
- difference_type;
-};
-
-template <class _Iter>
-struct __reference_type_definition_requirement_violation {
- typedef typename __STD::iterator_traits<_Iter>::reference reference;
-};
-
-template <class _Iter>
-struct __pointer_type_definition_requirement_violation {
- typedef typename __STD::iterator_traits<_Iter>::pointer pointer;
-};
-
-template <class _Iter>
-struct __iterator_category_type_definition_requirement_violation {
- typedef typename __STD::iterator_traits<_Iter>::iterator_category
- iterator_category;
-};
-
-/* Assignable Requirements */
-
-
-template <class _Type>
-struct _Assignable_concept_specification {
- static void _Assignable_requirement_violation(_Type __a) {
- _STL_ERROR::__assignment_operator_requirement_violation(__a);
- _STL_ERROR::__copy_constructor_requirement_violation(__a);
- _STL_ERROR::__const_parameter_required_for_copy_constructor(__a,__a);
- _STL_ERROR::__const_parameter_required_for_assignment_operator(__a,__a);
- }
-};
-
-/* DefaultConstructible Requirements */
-
-
-template <class _Type>
-struct _DefaultConstructible_concept_specification {
- static void _DefaultConstructible_requirement_violation(_Type __a) {
- _STL_ERROR::__default_constructor_requirement_violation(__a);
- }
-};
-
-/* EqualityComparable Requirements */
-
-template <class _Type>
-struct _EqualityComparable_concept_specification {
- static void _EqualityComparable_requirement_violation(_Type __a) {
- _STL_ERROR::__equality_comparable_requirement_violation(__a, __a);
- }
-};
-
-/* LessThanComparable Requirements */
-template <class _Type>
-struct _LessThanComparable_concept_specification {
- static void _LessThanComparable_requirement_violation(_Type __a) {
- _STL_ERROR::__less_than_comparable_requirement_violation(__a, __a);
- }
-};
-
-/* TrivialIterator Requirements */
-
-template <class _TrivialIterator>
-struct _TrivialIterator_concept_specification {
-static void
-_TrivialIterator_requirement_violation(_TrivialIterator __i) {
- typedef typename
- __value_type_type_definition_requirement_violation<_TrivialIterator>::
- value_type __T;
- // Refinement of Assignable
- _Assignable_concept_specification<_TrivialIterator>::
- _Assignable_requirement_violation(__i);
- // Refinement of DefaultConstructible
- _DefaultConstructible_concept_specification<_TrivialIterator>::
- _DefaultConstructible_requirement_violation(__i);
- // Refinement of EqualityComparable
- _EqualityComparable_concept_specification<_TrivialIterator>::
- _EqualityComparable_requirement_violation(__i);
- // Valid Expressions
- _STL_ERROR::__dereference_operator_requirement_violation(__i);
-}
-};
-
-template <class _TrivialIterator>
-struct _Mutable_TrivialIterator_concept_specification {
-static void
-_Mutable_TrivialIterator_requirement_violation(_TrivialIterator __i) {
- _TrivialIterator_concept_specification<_TrivialIterator>::
- _TrivialIterator_requirement_violation(__i);
- // Valid Expressions
- _STL_ERROR::__dereference_operator_and_assignment_requirement_violation(__i);
-}
-};
-
-/* InputIterator Requirements */
-
-template <class _InputIterator>
-struct _InputIterator_concept_specification {
-static void
-_InputIterator_requirement_violation(_InputIterator __i) {
- // Refinement of TrivialIterator
- _TrivialIterator_concept_specification<_InputIterator>::
- _TrivialIterator_requirement_violation(__i);
- // Associated Types
- __difference_type_type_definition_requirement_violation<_InputIterator>();
- __reference_type_definition_requirement_violation<_InputIterator>();
- __pointer_type_definition_requirement_violation<_InputIterator>();
- __iterator_category_type_definition_requirement_violation<_InputIterator>();
- // Valid Expressions
- _STL_ERROR::__preincrement_operator_requirement_violation(__i);
- _STL_ERROR::__postincrement_operator_requirement_violation(__i);
-}
-};
-
-/* OutputIterator Requirements */
-
-template <class _OutputIterator>
-struct _OutputIterator_concept_specification {
-static void
-_OutputIterator_requirement_violation(_OutputIterator __i) {
- // Refinement of Assignable
- _Assignable_concept_specification<_OutputIterator>::
- _Assignable_requirement_violation(__i);
- // Associated Types
- __iterator_category_type_definition_requirement_violation<_OutputIterator>();
- // Valid Expressions
- _STL_ERROR::__dereference_operator_requirement_violation(__i);
- _STL_ERROR::__preincrement_operator_requirement_violation(__i);
- _STL_ERROR::__postincrement_operator_requirement_violation(__i);
- _STL_ERROR::
- __postincrement_operator_and_assignment_requirement_violation(__i, *__i);
-}
-};
-
-/* ForwardIterator Requirements */
-
-template <class _ForwardIterator>
-struct _ForwardIterator_concept_specification {
-static void
-_ForwardIterator_requirement_violation(_ForwardIterator __i) {
- // Refinement of InputIterator
- _InputIterator_concept_specification<_ForwardIterator>::
- _InputIterator_requirement_violation(__i);
-}
-};
-
-template <class _ForwardIterator>
-struct _Mutable_ForwardIterator_concept_specification {
-static void
-_Mutable_ForwardIterator_requirement_violation(_ForwardIterator __i) {
- _ForwardIterator_concept_specification<_ForwardIterator>::
- _ForwardIterator_requirement_violation(__i);
- // Refinement of OutputIterator
- _OutputIterator_concept_specification<_ForwardIterator>::
- _OutputIterator_requirement_violation(__i);
-}
-};
-
-/* BidirectionalIterator Requirements */
-
-template <class _BidirectionalIterator>
-struct _BidirectionalIterator_concept_specification {
-static void
-_BidirectionalIterator_requirement_violation(_BidirectionalIterator __i) {
- // Refinement of ForwardIterator
- _ForwardIterator_concept_specification<_BidirectionalIterator>::
- _ForwardIterator_requirement_violation(__i);
- // Valid Expressions
- _STL_ERROR::__predecrement_operator_requirement_violation(__i);
- _STL_ERROR::__postdecrement_operator_requirement_violation(__i);
-}
-};
-
-template <class _BidirectionalIterator>
-struct _Mutable_BidirectionalIterator_concept_specification {
-static void
-_Mutable_BidirectionalIterator_requirement_violation(
- _BidirectionalIterator __i)
-{
- _BidirectionalIterator_concept_specification<_BidirectionalIterator>::
- _BidirectionalIterator_requirement_violation(__i);
- // Refinement of mutable_ForwardIterator
- _Mutable_ForwardIterator_concept_specification<_BidirectionalIterator>::
- _Mutable_ForwardIterator_requirement_violation(__i);
- typedef typename
- __value_type_type_definition_requirement_violation<
- _BidirectionalIterator>::value_type __T;
- typename _Mutable_trait<__T>::_Type* __tmp_ptr = 0;
- // Valid Expressions
- _STL_ERROR::
- __postincrement_operator_and_assignment_requirement_violation(__i,
- *__tmp_ptr);
-}
-};
-
-/* RandomAccessIterator Requirements */
-
-template <class _RandAccIter>
-struct _RandomAccessIterator_concept_specification {
-static void
-_RandomAccessIterator_requirement_violation(_RandAccIter __i) {
- // Refinement of BidirectionalIterator
- _BidirectionalIterator_concept_specification<_RandAccIter>::
- _BidirectionalIterator_requirement_violation(__i);
- // Refinement of LessThanComparable
- _LessThanComparable_concept_specification<_RandAccIter>::
- _LessThanComparable_requirement_violation(__i);
- typedef typename
- __value_type_type_definition_requirement_violation<_RandAccIter>
- ::value_type
- value_type;
- typedef typename
- __difference_type_type_definition_requirement_violation<_RandAccIter>
- ::difference_type
- _Dist;
- typedef typename _Mutable_trait<_Dist>::_Type _MutDist;
-
- // Valid Expressions
- _STL_ERROR::__iterator_addition_assignment_requirement_violation(__i,
- _MutDist());
- _STL_ERROR::__iterator_addition_requirement_violation(__i,
- _MutDist());
- _STL_ERROR::
- __iterator_subtraction_assignment_requirement_violation(__i,
- _MutDist());
- _STL_ERROR::__iterator_subtraction_requirement_violation(__i,
- _MutDist());
- _STL_ERROR::__difference_operator_requirement_violation(__i, __i,
- _MutDist());
- typename _Mutable_trait<value_type>::_Type* __dummy_ptr = 0;
- _STL_ERROR::__element_access_operator_requirement_violation(__i,
- __dummy_ptr,
- _MutDist());
-}
-};
-
-template <class _RandAccIter>
-struct _Mutable_RandomAccessIterator_concept_specification {
-static void
-_Mutable_RandomAccessIterator_requirement_violation(_RandAccIter __i)
-{
- _RandomAccessIterator_concept_specification<_RandAccIter>::
- _RandomAccessIterator_requirement_violation(__i);
- // Refinement of mutable_BidirectionalIterator
- _Mutable_BidirectionalIterator_concept_specification<_RandAccIter>::
- _Mutable_BidirectionalIterator_requirement_violation(__i);
- typedef typename
- __value_type_type_definition_requirement_violation<_RandAccIter>
- ::value_type
- value_type;
- typedef typename
- __difference_type_type_definition_requirement_violation<_RandAccIter>
- ::difference_type
- _Dist;
-
- typename _Mutable_trait<value_type>::_Type* __tmp_ptr = 0;
- // Valid Expressions
- _STL_ERROR::__element_assignment_operator_requirement_violation(__i,
- __tmp_ptr, _Dist());
-}
-};
-
-#define __STL_TYPEDEF_REQUIREMENT(__REQUIREMENT) \
-template <class Type> \
-struct __##__REQUIREMENT##__typedef_requirement_violation { \
- typedef typename Type::__REQUIREMENT __REQUIREMENT; \
-}
-
-__STL_TYPEDEF_REQUIREMENT(value_type);
-__STL_TYPEDEF_REQUIREMENT(difference_type);
-__STL_TYPEDEF_REQUIREMENT(size_type);
-__STL_TYPEDEF_REQUIREMENT(reference);
-__STL_TYPEDEF_REQUIREMENT(const_reference);
-__STL_TYPEDEF_REQUIREMENT(pointer);
-__STL_TYPEDEF_REQUIREMENT(const_pointer);
-
-
-template <class _Alloc>
-struct _Allocator_concept_specification {
-static void
-_Allocator_requirement_violation(_Alloc __a) {
- // Refinement of DefaultConstructible
- _DefaultConstructible_concept_specification<_Alloc>::
- _DefaultConstructible_requirement_violation(__a);
- // Refinement of EqualityComparable
- _EqualityComparable_concept_specification<_Alloc>::
- _EqualityComparable_requirement_violation(__a);
- // Associated Types
- __value_type__typedef_requirement_violation<_Alloc>();
- __difference_type__typedef_requirement_violation<_Alloc>();
- __size_type__typedef_requirement_violation<_Alloc>();
- __reference__typedef_requirement_violation<_Alloc>();
- __const_reference__typedef_requirement_violation<_Alloc>();
- __pointer__typedef_requirement_violation<_Alloc>();
- __const_pointer__typedef_requirement_violation<_Alloc>();
- typedef typename _Alloc::value_type _Tp;
- //__STL_REQUIRES_SAME_TYPE(typename _Alloc::__STL_TEMPLATE rebind<_Tp>::other,
- // _Alloc);
-}
-};
-
-#endif /* __STL_USE_CONCEPT_CHECKS */
-
-#endif /* __CONCEPT_CHECKS_H */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/WebKit/android/stl/cstring b/WebKit/android/stl/cstring
deleted file mode 100644
index 77c9175..0000000
--- a/WebKit/android/stl/cstring
+++ /dev/null
@@ -1,128 +0,0 @@
-// -*- C++ -*- forwarding header.
-
-// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002
-// Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 2, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License along
-// with this library; see the file COPYING. If not, write to the Free
-// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-// USA.
-
-// As a special exception, you may use this file as part of a free software
-// library without restriction. Specifically, if other files instantiate
-// templates or use macros or inline functions from this file, or you compile
-// this file and link it with other files to produce an executable, this
-// file does not by itself cause the resulting executable to be covered by
-// the GNU General Public License. This exception does not however
-// invalidate any other reasons why the executable file might be covered by
-// the GNU General Public License.
-
-//
-// ISO C++ 14882: 20.4.6 C library
-//
-
-/** @file cstring
- * This is a Standard C++ Library file. You should @c #include this file
- * in your programs, rather than any of the "*.h" implementation files.
- *
- * This is the C++ version of the Standard C Library header @c string.h,
- * and its contents are (mostly) the same as that header, but are all
- * contained in the namespace @c std.
- */
-
-#ifndef _GLIBCXX_CSTRING
-#define _GLIBCXX_CSTRING 1
-
-#pragma GCC system_header
-
-#include <cstddef>
-
-#include <string.h>
-
-// Get rid of those macros defined in <string.h> in lieu of real functions.
-#undef memcpy
-#undef memmove
-#undef strcpy
-#undef strncpy
-#undef strcat
-#undef strncat
-#undef memcmp
-#undef strcmp
-#undef strcoll
-#undef strncmp
-#undef strxfrm
-#undef memchr
-#undef strchr
-#undef strcspn
-#undef strpbrk
-#undef strrchr
-#undef strspn
-#undef strstr
-#undef strtok
-#undef memset
-#undef strerror
-#undef strlen
-
-namespace std
-{
- using ::memcpy;
- using ::memmove;
- using ::strcpy;
- using ::strncpy;
- using ::strcat;
- using ::strncat;
- using ::memcmp;
- using ::strcmp;
-// using ::strcoll;
- using ::strncmp;
-// using ::strxfrm;
- using ::strcspn;
- using ::strspn;
- using ::strtok;
- using ::memset;
- using ::strerror;
- using ::strlen;
-
- using ::memchr;
-
- inline void*
- memchr(void* __p, int __c, size_t __n)
- { return memchr(const_cast<const void*>(__p), __c, __n); }
-
- using ::strchr;
-
- inline char*
- strchr(char* __s1, int __n)
- { return __builtin_strchr(const_cast<const char*>(__s1), __n); }
-
- using ::strpbrk;
-
- inline char*
- strpbrk(char* __s1, const char* __s2)
- { return __builtin_strpbrk(const_cast<const char*>(__s1), __s2); }
-
- using ::strrchr;
-
- inline char*
- strrchr(char* __s1, int __n)
- { return __builtin_strrchr(const_cast<const char*>(__s1), __n); }
-
- using ::strstr;
-
- inline char*
- strstr(char* __s1, const char* __s2)
- { return __builtin_strstr(const_cast<const char*>(__s1), __s2); }
-}
-
-#endif
diff --git a/WebKit/android/stl/heap.h b/WebKit/android/stl/heap.h
deleted file mode 100644
index 70d2249..0000000
--- a/WebKit/android/stl/heap.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- *
- * Copyright 2009, The Android Open Source Project
- * Copyright (c) 1994
- * Hewlett-Packard Company
- *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation. Hewlett-Packard Company makes no
- * representations about the suitability of this software for any
- * purpose. It is provided "as is" without express or implied warranty.
- *
- * Copyright (c) 1997
- * Silicon Graphics Computer Systems, Inc.
- *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation. Silicon Graphics makes no
- * representations about the suitability of this software for any
- * purpose. It is provided "as is" without express or implied warranty.
- */
-
-#ifndef __SGI_STL_HEAP_H
-#define __SGI_STL_HEAP_H
-
-#include <concept_checks.h>
-#include <stl_config.h>
-#include <stl_heap.h>
-
-#ifdef __STL_USE_NAMESPACES
-
-using __STD::push_heap;
-using __STD::pop_heap;
-using __STD::make_heap;
-using __STD::sort_heap;
-
-#endif /* __STL_USE_NAMESPACES */
-
-
-#endif /* __SGI_STL_HEAP_H */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/WebKit/android/stl/memory b/WebKit/android/stl/memory
deleted file mode 100644
index b224c33..0000000
--- a/WebKit/android/stl/memory
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- * Copyright (c) 1997-1999
- * Silicon Graphics Computer Systems, Inc.
- *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation. Silicon Graphics makes no
- * representations about the suitability of this software for any
- * purpose. It is provided "as is" without express or implied warranty.
- *
- */
-
-//minimal file to get build to work
-
-#ifdef _CPP_MEMORY
-#error "real STL defined"
-#endif
-
-#ifndef __ANDROID_MEMORY
-#define __ANDROID_MEMORY
-//we good to do this?
-#define __STL_MEMBER_TEMPLATES
-
-#define __STL_NOTHROW
-
-/*#if defined(__SGI_STL_USE_AUTO_PTR_CONVERSIONS) && \*/
-
-#if defined(__STL_MEMBER_TEMPLATES)
-template<class _Tp1> struct auto_ptr_ref {
- _Tp1* _M_ptr;
- auto_ptr_ref(_Tp1* __p) : _M_ptr(__p) {}
-};
-#endif
-
-namespace std {
-
-template <class _Tp> class auto_ptr {
-private:
- _Tp* _M_ptr;
-
-public:
- typedef _Tp element_type;
-
- explicit auto_ptr(_Tp* __p = 0) __STL_NOTHROW : _M_ptr(__p) {}
- auto_ptr(auto_ptr& __a) __STL_NOTHROW : _M_ptr(__a.release()) {}
-
-#ifdef __STL_MEMBER_TEMPLATES
- template <class _Tp1> auto_ptr(auto_ptr<_Tp1>& __a) __STL_NOTHROW
- : _M_ptr(__a.release()) {}
-#endif /* __STL_MEMBER_TEMPLATES */
-
- auto_ptr& operator=(auto_ptr& __a) __STL_NOTHROW {
- if (&__a != this) {
- delete _M_ptr;
- _M_ptr = __a.release();
- }
- return *this;
- }
-
-#ifdef __STL_MEMBER_TEMPLATES
- template <class _Tp1>
- auto_ptr& operator=(auto_ptr<_Tp1>& __a) __STL_NOTHROW {
- if (__a.get() != this->get()) {
- delete _M_ptr;
- _M_ptr = __a.release();
- }
- return *this;
- }
-#endif /* __STL_MEMBER_TEMPLATES */
-
- // Note: The C++ standard says there is supposed to be an empty throw
- // specification here, but omitting it is standard conforming. Its
- // presence can be detected only if _Tp::~_Tp() throws, but (17.4.3.6/2)
- // this is prohibited.
- ~auto_ptr() { delete _M_ptr; }
-
- _Tp& operator*() const __STL_NOTHROW {
- return *_M_ptr;
- }
- _Tp* operator->() const __STL_NOTHROW {
- return _M_ptr;
- }
- _Tp* get() const __STL_NOTHROW {
- return _M_ptr;
- }
- _Tp* release() __STL_NOTHROW {
- _Tp* __tmp = _M_ptr;
- _M_ptr = 0;
- return __tmp;
- }
- void reset(_Tp* __p = 0) __STL_NOTHROW {
- if (__p != _M_ptr) {
- delete _M_ptr;
- _M_ptr = __p;
- }
- }
-
-/*#if defined(__SGI_STL_USE_AUTO_PTR_CONVERSIONS) && \*/
-#if defined(__STL_MEMBER_TEMPLATES)
-
-public:
- auto_ptr(auto_ptr_ref<_Tp> __ref) __STL_NOTHROW
- : _M_ptr(__ref._M_ptr) {}
-
- auto_ptr& operator=(auto_ptr_ref<_Tp> __ref) __STL_NOTHROW {
- if (__ref._M_ptr != this->get()) {
- delete _M_ptr;
- _M_ptr = __ref._M_ptr;
- }
- return *this;
- }
-
- template <class _Tp1> operator auto_ptr_ref<_Tp1>() __STL_NOTHROW
- { return auto_ptr_ref<_Tp1>(this->release()); }
- template <class _Tp1> operator auto_ptr<_Tp1>() __STL_NOTHROW
- { return auto_ptr<_Tp1>(this->release()); }
-
-#endif /* auto ptr conversions && member templates */
-
-};
-
-} //namespace std
-
-#endif /* __ANDROID_MEMORY */
-
-
-// Local Variables:
-// mode:C++
-// End:
-
diff --git a/WebKit/android/stl/new.h b/WebKit/android/stl/new.h
deleted file mode 100644
index 599a890..0000000
--- a/WebKit/android/stl/new.h
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Copyright 2007, 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 APPLE COMPUTER, INC. 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.
- */
-
diff --git a/WebKit/android/stl/stl_config.h b/WebKit/android/stl/stl_config.h
deleted file mode 100644
index 448babc..0000000
--- a/WebKit/android/stl/stl_config.h
+++ /dev/null
@@ -1,577 +0,0 @@
-/*
- *
- * Copyright 2009, The Android Open Source Project
- * Copyright (c) 1994
- * Hewlett-Packard Company
- *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation. Hewlett-Packard Company makes no
- * representations about the suitability of this software for any
- * purpose. It is provided "as is" without express or implied warranty.
- *
- * Copyright (c) 1997
- * Silicon Graphics
- *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation. Silicon Graphics makes no
- * representations about the suitability of this software for any
- * purpose. It is provided "as is" without express or implied warranty.
- *
- */
-
-#ifndef __STL_CONFIG_H
-# define __STL_CONFIG_H
-
-// Flags:
-// * __STL_NO_BOOL: defined if the compiler doesn't have bool as a builtin
-// type.
-// * __STL_HAS_WCHAR_T: defined if the compier has wchar_t as a builtin type.
-// * __STL_NO_DRAND48: defined if the compiler doesn't have the drand48
-// function.
-// * __STL_STATIC_TEMPLATE_MEMBER_BUG: defined if the compiler can't handle
-// static members of template classes.
-// * __STL_STATIC_CONST_INIT_BUG: defined if the compiler can't handle a
-// constant-initializer in the declaration of a static const data member
-// of integer type. (See section 9.4.2, paragraph 4, of the C++ standard.)
-// * __STL_CLASS_PARTIAL_SPECIALIZATION: defined if the compiler supports
-// partial specialization of template classes.
-// * __STL_PARTIAL_SPECIALIZATION_SYNTAX: defined if the compiler
-// supports partial specialization syntax for full specialization of
-// class templates. (Even if it doesn't actually support partial
-// specialization itself.)
-// * __STL_FUNCTION_TMPL_PARTIAL_ORDER: defined if the compiler supports
-// partial ordering of function templates. (a.k.a partial specialization
-// of function templates.)
-// * __STL_MEMBER_TEMPLATES: defined if the compiler supports template
-// member functions of classes.
-// * __STL_MEMBER_TEMPLATE_CLASSES: defined if the compiler supports
-// nested classes that are member templates of other classes.
-// * __STL_TEMPLATE_FRIENDS: defined if the compiler supports templatized
-// friend declarations.
-// * __STL_EXPLICIT_FUNCTION_TMPL_ARGS: defined if the compiler
-// supports calling a function template by providing its template
-// arguments explicitly.
-// * __STL_LIMITED_DEFAULT_TEMPLATES: defined if the compiler is unable
-// to handle default template parameters that depend on previous template
-// parameters.
-// * __STL_NON_TYPE_TMPL_PARAM_BUG: defined if the compiler has trouble with
-// function template argument deduction for non-type template parameters.
-// * __SGI_STL_NO_ARROW_OPERATOR: defined if the compiler is unable
-// to support the -> operator for iterators.
-// * __STL_DEFAULT_CONSTRUCTOR_BUG: defined if T() does not work properly
-// when T is a builtin type.
-// * __STL_USE_EXCEPTIONS: defined if the compiler (in the current compilation
-// mode) supports exceptions.
-// * __STL_USE_NAMESPACES: defined if the compiler has the necessary
-// support for namespaces.
-// * __STL_NO_EXCEPTION_HEADER: defined if the compiler does not have a
-// standard-conforming header <exception>.
-// * __STL_NO_BAD_ALLOC: defined if the compiler does not have a <new>
-// header, or if <new> does not contain a bad_alloc class. If a bad_alloc
-// class exists, it is assumed to be in namespace std.
-// * __STL_SGI_THREADS: defined if this is being compiled for an SGI IRIX
-// system in multithreaded mode, using native SGI threads instead of
-// pthreads.
-// * __STL_WIN32THREADS: defined if this is being compiled on a WIN32
-// compiler in multithreaded mode.
-// * __STL_PTHREADS: defined if we should use portable pthreads
-// synchronization.
-// * __STL_UITHREADS: defined if we should use UI / solaris / UnixWare threads
-// synchronization. UIthreads are similar to pthreads, but are based
-// on an earlier version of the Posix threads standard.
-// * __STL_LONG_LONG if the compiler has long long and unsigned long long
-// types. (They're not in the C++ standard, but they are expected to be
-// included in the forthcoming C9X standard.)
-// * __STL_THREADS is defined if thread safety is needed.
-// * __STL_VOLATILE is defined to be "volatile" if threads are being
-// used, and the empty string otherwise.
-// * __STL_USE_CONCEPT_CHECKS enables some extra compile-time error
-// checking to make sure that user-defined template arguments satisfy
-// all of the appropriate requirements. This may result in more
-// comprehensible error messages. It incurs no runtime overhead. This
-// feature requires member templates and partial specialization.
-// * __STL_NO_USING_CLAUSE_IN_CLASS: The compiler does not handle "using"
-// clauses inside of class definitions.
-// * __STL_NO_FRIEND_TEMPLATE_CLASS: The compiler does not handle friend
-// declaractions where the friend is a template class.
-// * __STL_NO_FUNCTION_PTR_IN_CLASS_TEMPLATE: The compiler does not
-// support the use of a function pointer type as the argument
-// for a template.
-// * __STL_MEMBER_TEMPLATE_KEYWORD: standard C++ requires the template
-// keyword in a few new places (14.2.4). This flag is set for
-// compilers that support (and require) this usage.
-
-
-// User-settable macros that control compilation:
-// * __STL_USE_SGI_ALLOCATORS: if defined, then the STL will use older
-// SGI-style allocators, instead of standard-conforming allocators,
-// even if the compiler supports all of the language features needed
-// for standard-conforming allocators.
-// * __STL_NO_NAMESPACES: if defined, don't put the library in namespace
-// std, even if the compiler supports namespaces.
-// * __STL_NO_RELOPS_NAMESPACE: if defined, don't put the relational
-// operator templates (>, <=. >=, !=) in namespace std::rel_ops, even
-// if the compiler supports namespaces and partial ordering of
-// function templates.
-// * __STL_ASSERTIONS: if defined, then enable runtime checking through the
-// __stl_assert macro.
-// * _PTHREADS: if defined, use Posix threads for multithreading support.
-// * _UITHREADS:if defined, use SCO/Solaris/UI threads for multithreading
-// support
-// * _NOTHREADS: if defined, don't use any multithreading support.
-// * _STL_NO_CONCEPT_CHECKS: if defined, disables the error checking that
-// we get from __STL_USE_CONCEPT_CHECKS.
-// * __STL_USE_NEW_IOSTREAMS: if defined, then the STL will use new,
-// standard-conforming iostreams (e.g. the <iosfwd> header). If not
-// defined, the STL will use old cfront-style iostreams (e.g. the
-// <iostream.h> header).
-
-// Other macros defined by this file:
-
-// * bool, true, and false, if __STL_NO_BOOL is defined.
-// * typename, as a null macro if it's not already a keyword.
-// * explicit, as a null macro if it's not already a keyword.
-// * namespace-related macros (__STD, __STL_BEGIN_NAMESPACE, etc.)
-// * exception-related macros (__STL_TRY, __STL_UNWIND, etc.)
-// * __stl_assert, either as a test or as a null macro, depending on
-// whether or not __STL_ASSERTIONS is defined.
-
-# if defined(_PTHREADS) && !defined(_NOTHREADS)
-# define __STL_PTHREADS
-# endif
-
-# if defined(_UITHREADS) && !defined(_PTHREADS) && !defined(_NOTHREADS)
-# define __STL_UITHREADS
-# endif
-
-# if defined(__sgi) && !defined(__GNUC__)
-# include <standards.h>
-# if !defined(_BOOL)
-# define __STL_NO_BOOL
-# endif
-# if defined(_MIPS_SIM) && _MIPS_SIM == _ABIO32
-# define __STL_STATIC_CONST_INIT_BUG
-# endif
-# if defined(_WCHAR_T_IS_KEYWORD)
-# define __STL_HAS_WCHAR_T
-# endif
-# if !defined(_TYPENAME_IS_KEYWORD)
-# define __STL_NEED_TYPENAME
-# endif
-# ifdef _PARTIAL_SPECIALIZATION_OF_CLASS_TEMPLATES
-# define __STL_CLASS_PARTIAL_SPECIALIZATION
-# endif
-# if (_COMPILER_VERSION >= 730) && defined(_MIPS_SIM) && _MIPS_SIM != _ABIO32
-# define __STL_FUNCTION_TMPL_PARTIAL_ORDER
-# endif
-# ifdef _MEMBER_TEMPLATES
-# define __STL_MEMBER_TEMPLATES
-# define __STL_TEMPLATE_FRIENDS
-# define __STL_MEMBER_TEMPLATE_CLASSES
-# endif
-# if defined(_MEMBER_TEMPLATE_KEYWORD)
-# define __STL_MEMBER_TEMPLATE_KEYWORD
-# endif
-# if defined(_STANDARD_C_PLUS_PLUS)
-# define __STL_EXPLICIT_FUNCTION_TMPL_ARGS
-# endif
-# if (_COMPILER_VERSION >= 730) && defined(_MIPS_SIM) && _MIPS_SIM != _ABIO32
-# define __STL_MEMBER_TEMPLATE_KEYWORD
-# endif
-# if COMPILER_VERSION < 720 || (defined(_MIPS_SIM) && _MIPS_SIM == _ABIO32)
-# define __STL_DEFAULT_CONSTRUCTOR_BUG
-# endif
-# if !defined(_EXPLICIT_IS_KEYWORD)
-# define __STL_NEED_EXPLICIT
-# endif
-# ifdef __EXCEPTIONS
-# define __STL_USE_EXCEPTIONS
-# endif
-# if (_COMPILER_VERSION >= 721) && defined(_NAMESPACES)
-# define __STL_HAS_NAMESPACES
-# endif
-# if (_COMPILER_VERSION < 721) || \
- !defined(__STL_HAS_NAMESPACES) || defined(__STL_NO_NAMESPACES)
-# define __STL_NO_EXCEPTION_HEADER
-# endif
-# if _COMPILER_VERSION < 730 || !defined(_STANDARD_C_PLUS_PLUS) || \
- !defined(_NAMESPACES)
-# define __STL_NO_BAD_ALLOC
-# endif
-# if !defined(_NOTHREADS) && !defined(__STL_PTHREADS)
-# define __STL_SGI_THREADS
-# endif
-# if defined(_LONGLONG) && defined(_SGIAPI) && _SGIAPI
-# define __STL_LONG_LONG
-# endif
-# if _COMPILER_VERSION >= 730 && defined(_STANDARD_C_PLUS_PLUS)
-# define __STL_USE_NEW_IOSTREAMS
-# endif
-# if _COMPILER_VERSION >= 730 && defined(_STANDARD_C_PLUS_PLUS)
-# define __STL_CAN_THROW_RANGE_ERRORS
-# endif
-# if _COMPILER_VERSION >= 730 && defined(_STANDARD_C_PLUS_PLUS)
-# define __SGI_STL_USE_AUTO_PTR_CONVERSIONS
-# endif
-# endif
-
-
-/*
- * Jochen Schlick '1999 - added new #defines (__STL)_UITHREADS (for
- * providing SCO / Solaris / UI thread support)
- * - added the necessary defines for the SCO UDK 7
- * compiler (and its template friend behavior)
- * - all UDK7 specific STL changes are based on the
- * macro __USLC__ being defined
- */
-// SCO UDK 7 compiler (UnixWare 7x, OSR 5, UnixWare 2x)
-# if defined(__USLC__)
-# define __STL_HAS_WCHAR_T
-# define __STL_CLASS_PARTIAL_SPECIALIZATION
-# define __STL_PARTIAL_SPECIALIZATION_SYNTAX
-# define __STL_FUNCTION_TMPL_PARTIAL_ORDER
-# define __STL_MEMBER_TEMPLATES
-# define __STL_MEMBER_TEMPLATE_CLASSES
-# define __STL_USE_EXCEPTIONS
-# define __STL_HAS_NAMESPACES
-# define __STL_USE_NAMESPACES
-# define __STL_LONG_LONG
-# if defined(_REENTRANT)
-# define _UITHREADS /* if UnixWare < 7.0.1 */
-# define __STL_UITHREADS
-// use the following defines instead of the UI threads defines when
-// you want to use POSIX threads
-//# define _PTHREADS /* only if UnixWare >=7.0.1 */
-//# define __STL_PTHREADS
-# endif
-# endif
-
-
-
-# ifdef __GNUC__
-# if __GNUC__ == 2 && __GNUC_MINOR__ <= 7
-# define __STL_STATIC_TEMPLATE_MEMBER_BUG
-# endif
-# if __GNUC__ < 2
-# define __STL_NEED_TYPENAME
-# define __STL_NEED_EXPLICIT
-# endif
-# if __GNUC__ == 2 && __GNUC_MINOR__ <= 8
-# define __STL_NO_EXCEPTION_HEADER
-# define __STL_NO_BAD_ALLOC
-# endif
-# if __GNUC__ == 2 && __GNUC_MINOR__ >= 8 || __GNUC__ > 2
-# define __STL_CLASS_PARTIAL_SPECIALIZATION
-# define __STL_FUNCTION_TMPL_PARTIAL_ORDER
-# define __STL_EXPLICIT_FUNCTION_TMPL_ARGS
-# define __STL_MEMBER_TEMPLATES
-# define __STL_CAN_THROW_RANGE_ERRORS
- // g++ 2.8.1 supports member template functions, but not member
- // template nested classes.
-# if __GNUC_MINOR__ >= 9 || __GNUC__ > 2
-# define __STL_MEMBER_TEMPLATE_CLASSES
-# define __STL_TEMPLATE_FRIENDS
-# define __SGI_STL_USE_AUTO_PTR_CONVERSIONS
-# define __STL_HAS_NAMESPACES
-//# define __STL_USE_NEW_IOSTREAMS
-# endif
-# endif
-# define __STL_DEFAULT_CONSTRUCTOR_BUG
-# ifdef __EXCEPTIONS
-# define __STL_USE_EXCEPTIONS
-# endif
-# ifdef _REENTRANT
-# define __STL_PTHREADS
-# endif
-# if (__GNUC__ < 2) || (__GNUC__ == 2 && __GNUC_MINOR__ < 95)
-# define __STL_NO_FUNCTION_PTR_IN_CLASS_TEMPLATE
-# endif
-# endif
-
-# if defined(__SUNPRO_CC)
-# define __STL_NO_BOOL
-# define __STL_NEED_TYPENAME
-# define __STL_NEED_EXPLICIT
-# define __STL_USE_EXCEPTIONS
-# ifdef _REENTRANT
-# define __STL_PTHREADS
-# endif
-# define __SGI_STL_NO_ARROW_OPERATOR
-# define __STL_PARTIAL_SPECIALIZATION_SYNTAX
-# define __STL_NO_EXCEPTION_HEADER
-# define __STL_NO_BAD_ALLOC
-# endif
-
-# if defined(__COMO__)
-# define __STL_MEMBER_TEMPLATES
-# define __STL_MEMBER_TEMPLATE_CLASSES
-# define __STL_TEMPLATE_FRIENDS
-# define __STL_CLASS_PARTIAL_SPECIALIZATION
-# define __STL_USE_EXCEPTIONS
-# define __STL_HAS_NAMESPACES
-# endif
-
-// Intel compiler, which uses the EDG front end.
-# if defined(__ICL)
-# define __STL_LONG_LONG
-# define __STL_MEMBER_TEMPLATES
-# define __STL_MEMBER_TEMPLATE_CLASSES
-# define __STL_TEMPLATE_FRIENDS
-# define __STL_FUNCTION_TMPL_PARTIAL_ORDER
-# define __STL_CLASS_PARTIAL_SPECIALIZATION
-# define __STL_NO_DRAND48
-# define __STL_HAS_NAMESPACES
-# define __STL_USE_EXCEPTIONS
-# define __STL_MEMBER_TEMPLATE_KEYWORD
-# ifdef _CPPUNWIND
-# define __STL_USE_EXCEPTIONS
-# endif
-# ifdef _MT
-# define __STL_WIN32THREADS
-# endif
-# endif
-
-// Mingw32, egcs compiler using the Microsoft C runtime
-# if defined(__MINGW32__)
-# define __STL_NO_DRAND48
-# ifdef _MT
-# define __STL_WIN32THREADS
-# endif
-# endif
-
-// Cygwin32, egcs compiler on MS Windows
-# if defined(__CYGWIN__)
-# define __STL_NO_DRAND48
-# endif
-
-
-
-// Microsoft compiler.
-# if defined(_MSC_VER) && !defined(__ICL) && !defined(__MWERKS__)
-# define __STL_NO_DRAND48
-# define __STL_STATIC_CONST_INIT_BUG
-# define __STL_NEED_TYPENAME
-# define __STL_NO_USING_CLAUSE_IN_CLASS
-# define __STL_NO_FRIEND_TEMPLATE_CLASS
-# if _MSC_VER < 1100 /* 1000 is version 4.0, 1100 is 5.0, 1200 is 6.0. */
-# define __STL_NEED_EXPLICIT
-# define __STL_NO_BOOL
-# define __STL_NO_BAD_ALLOC
-# endif
-# if _MSC_VER > 1000
-# include <yvals.h>
-# define __STL_DONT_USE_BOOL_TYPEDEF
-# endif
-# define __STL_NON_TYPE_TMPL_PARAM_BUG
-# define __SGI_STL_NO_ARROW_OPERATOR
-# define __STL_DEFAULT_CONSTRUCTOR_BUG
-# ifdef _CPPUNWIND
-# define __STL_USE_EXCEPTIONS
-# endif
-# ifdef _MT
-# define __STL_WIN32THREADS
-# endif
-# if _MSC_VER >= 1200
-# define __STL_PARTIAL_SPECIALIZATION_SYNTAX
-# define __STL_HAS_NAMESPACES
-# define __STL_CAN_THROW_RANGE_ERRORS
-# define NOMINMAX
-# undef min
-# undef max
-// disable warning 'initializers put in unrecognized initialization area'
-# pragma warning ( disable : 4075 )
-// disable warning 'empty controlled statement found'
-# pragma warning ( disable : 4390 )
-// disable warning 'debug symbol greater than 255 chars'
-# pragma warning ( disable : 4786 )
-# endif
-# if _MSC_VER < 1100
-# define __STL_NO_EXCEPTION_HEADER
-# define __STL_NO_BAD_ALLOC
-# endif
- // Because of a Microsoft front end bug, we must not provide a
- // namespace qualifier when declaring a friend function.
-# define __STD_QUALIFIER
-# endif
-
-# if defined(__BORLANDC__)
-# define __STL_NO_BAD_ALLOC
-# define __STL_NO_DRAND48
-# define __STL_DEFAULT_CONSTRUCTOR_BUG
-# if __BORLANDC__ >= 0x540 /* C++ Builder 4.0 */
-# define __STL_CLASS_PARTIAL_SPECIALIZATION
-# define __STL_FUNCTION_TMPL_PARTIAL_ORDER
-# define __STL_EXPLICIT_FUNCTION_TMPL_ARGS
-# define __STL_MEMBER_TEMPLATES
-# define __STL_TEMPLATE_FRIENDS
-# else
-# define __STL_NEED_TYPENAME
-# define __STL_LIMITED_DEFAULT_TEMPLATES
-# define __SGI_STL_NO_ARROW_OPERATOR
-# define __STL_NON_TYPE_TMPL_PARAM_BUG
-# endif
-# ifdef _CPPUNWIND
-# define __STL_USE_EXCEPTIONS
-# endif
-# ifdef __MT__
-# define __STL_WIN32THREADS
-# endif
-# endif
-
-# if defined(__STL_NO_BOOL) && !defined(__STL_DONT_USE_BOOL_TYPEDEF)
- typedef int bool;
-# define true 1
-# define false 0
-# endif
-
-# ifdef __STL_NEED_TYPENAME
-# define typename
-# endif
-
-# ifdef __STL_LIMITED_DEFAULT_TEMPLATES
-# define __STL_DEPENDENT_DEFAULT_TMPL(_Tp)
-# else
-# define __STL_DEPENDENT_DEFAULT_TMPL(_Tp) = _Tp
-# endif
-
-# ifdef __STL_MEMBER_TEMPLATE_KEYWORD
-# define __STL_TEMPLATE template
-# else
-# define __STL_TEMPLATE
-# endif
-
-# ifdef __STL_NEED_EXPLICIT
-# define explicit
-# endif
-
-# ifdef __STL_EXPLICIT_FUNCTION_TMPL_ARGS
-# define __STL_NULL_TMPL_ARGS <>
-# else
-# define __STL_NULL_TMPL_ARGS
-# endif
-
-# if defined(__STL_CLASS_PARTIAL_SPECIALIZATION) \
- || defined (__STL_PARTIAL_SPECIALIZATION_SYNTAX)
-# define __STL_TEMPLATE_NULL template<>
-# else
-# define __STL_TEMPLATE_NULL
-# endif
-
-// Use standard-conforming allocators if we have the necessary language
-// features. __STL_USE_SGI_ALLOCATORS is a hook so that users can
-// disable new-style allocators, and continue to use the same kind of
-// allocators as before, without having to edit library headers.
-# if defined(__STL_CLASS_PARTIAL_SPECIALIZATION) && \
- defined(__STL_MEMBER_TEMPLATES) && \
- defined(__STL_MEMBER_TEMPLATE_CLASSES) && \
- !defined(__STL_NO_BOOL) && \
- !defined(__STL_NON_TYPE_TMPL_PARAM_BUG) && \
- !defined(__STL_LIMITED_DEFAULT_TEMPLATES) && \
- !defined(__STL_USE_SGI_ALLOCATORS)
-# define __STL_USE_STD_ALLOCATORS
-# endif
-
-# ifndef __STL_DEFAULT_ALLOCATOR
-# ifdef __STL_USE_STD_ALLOCATORS
-# define __STL_DEFAULT_ALLOCATOR(T) allocator< T >
-# else
-# define __STL_DEFAULT_ALLOCATOR(T) alloc
-# endif
-# endif
-
-// __STL_NO_NAMESPACES is a hook so that users can disable namespaces
-// without having to edit library headers. __STL_NO_RELOPS_NAMESPACE is
-// a hook so that users can disable the std::rel_ops namespace, keeping
-// the relational operator template in namespace std, without having to
-// edit library headers.
-# if defined(__STL_HAS_NAMESPACES) && !defined(__STL_NO_NAMESPACES)
-# define __STL_USE_NAMESPACES
-# define __STD std
-# define __STL_BEGIN_NAMESPACE namespace std {
-# define __STL_END_NAMESPACE }
-# if defined(__STL_FUNCTION_TMPL_PARTIAL_ORDER) && \
- !defined(__STL_NO_RELOPS_NAMESPACE)
-# define __STL_USE_NAMESPACE_FOR_RELOPS
-# define __STL_BEGIN_RELOPS_NAMESPACE namespace std { namespace rel_ops {
-# define __STL_END_RELOPS_NAMESPACE } }
-# define __STD_RELOPS std::rel_ops
-# else /* Use std::rel_ops namespace */
-# define __STL_USE_NAMESPACE_FOR_RELOPS
-# define __STL_BEGIN_RELOPS_NAMESPACE namespace std {
-# define __STL_END_RELOPS_NAMESPACE }
-# define __STD_RELOPS std
-# endif /* Use std::rel_ops namespace */
-# else
-# define __STD
-# define __STL_BEGIN_NAMESPACE
-# define __STL_END_NAMESPACE
-# undef __STL_USE_NAMESPACE_FOR_RELOPS
-# define __STL_BEGIN_RELOPS_NAMESPACE
-# define __STL_END_RELOPS_NAMESPACE
-# define __STD_RELOPS
-# undef __STL_USE_NAMESPACES
-# endif
-
-// Some versions of the EDG front end sometimes require an explicit
-// namespace spec where they shouldn't. This macro facilitates that.
-// If the bug becomes irrelevant, then all uses of __STD_QUALIFIER
-// should be removed. The 7.3 beta SGI compiler has this bug, but the
-// MR version is not expected to have it.
-
-# if defined(__STL_USE_NAMESPACES) && !defined(__STD_QUALIFIER)
-# define __STD_QUALIFIER std::
-# else
-# define __STD_QUALIFIER
-# endif
-
-# ifdef __STL_USE_EXCEPTIONS
-# define __STL_TRY try
-# define __STL_CATCH_ALL catch(...)
-# define __STL_THROW(x) throw x
-# define __STL_RETHROW throw
-# define __STL_NOTHROW throw()
-# define __STL_UNWIND(action) catch(...) { action; throw; }
-# else
-# define __STL_TRY
-# define __STL_CATCH_ALL if (false)
-# define __STL_THROW(x)
-# define __STL_RETHROW
-# define __STL_NOTHROW
-# define __STL_UNWIND(action)
-# endif
-
-#ifdef __STL_ASSERTIONS
-# include <stdio.h>
-# define __stl_assert(expr) \
- if (!(expr)) { fprintf(stderr, "%s:%d STL assertion failure: %s\n", \
- __FILE__, __LINE__, # expr); abort(); }
-#else
-# define __stl_assert(expr)
-#endif
-
-#if defined(__STL_WIN32THREADS) || defined(__STL_SGI_THREADS) \
- || defined(__STL_PTHREADS) || defined(__STL_UITHREADS)
-# define __STL_THREADS
-# define __STL_VOLATILE volatile
-#else
-# define __STL_VOLATILE
-#endif
-
-#if defined(__STL_CLASS_PARTIAL_SPECIALIZATION) \
- && defined(__STL_MEMBER_TEMPLATES) \
- && !defined(_STL_NO_CONCEPT_CHECKS)
-# define __STL_USE_CONCEPT_CHECKS
-#endif
-
-
-#endif /* __STL_CONFIG_H */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/WebKit/android/stl/stl_heap.h b/WebKit/android/stl/stl_heap.h
deleted file mode 100644
index 9e3cf13..0000000
--- a/WebKit/android/stl/stl_heap.h
+++ /dev/null
@@ -1,298 +0,0 @@
-/*
- *
- * Copyright 2009, The Android Open Source Project
- * Copyright (c) 1994
- * Hewlett-Packard Company
- *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation. Hewlett-Packard Company makes no
- * representations about the suitability of this software for any
- * purpose. It is provided "as is" without express or implied warranty.
- *
- * Copyright (c) 1997
- * Silicon Graphics Computer Systems, Inc.
- *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation. Silicon Graphics makes no
- * representations about the suitability of this software for any
- * purpose. It is provided "as is" without express or implied warranty.
- */
-
-/* NOTE: This is an internal header file, included by other STL headers.
- * You should not attempt to use it directly.
- */
-
-#ifndef __SGI_STL_INTERNAL_HEAP_H
-#define __SGI_STL_INTERNAL_HEAP_H
-
-__STL_BEGIN_NAMESPACE
-
-#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
-#pragma set woff 1209
-#endif
-
-// Heap-manipulation functions: push_heap, pop_heap, make_heap, sort_heap.
-
-template <class _RandomAccessIterator, class _Distance, class _Tp>
-void
-__push_heap(_RandomAccessIterator __first,
- _Distance __holeIndex, _Distance __topIndex, _Tp __value)
-{
- _Distance __parent = (__holeIndex - 1) / 2;
- while (__holeIndex > __topIndex && *(__first + __parent) < __value) {
- *(__first + __holeIndex) = *(__first + __parent);
- __holeIndex = __parent;
- __parent = (__holeIndex - 1) / 2;
- }
- *(__first + __holeIndex) = __value;
-}
-
-template <class _RandomAccessIterator, class _Distance, class _Tp>
-inline void
-__push_heap_aux(_RandomAccessIterator __first,
- _RandomAccessIterator __last, _Distance*, _Tp*)
-{
- __push_heap(__first, _Distance((__last - __first) - 1), _Distance(0),
- _Tp(*(__last - 1)));
-}
-
-template <class _RandomAccessIterator>
-inline void
-push_heap(_RandomAccessIterator __first, _RandomAccessIterator __last)
-{
- __STL_REQUIRES(_RandomAccessIterator, _Mutable_RandomAccessIterator);
- __STL_REQUIRES(typename iterator_traits<_RandomAccessIterator>::value_type,
- _LessThanComparable);
- __push_heap_aux(__first, __last,
- __DISTANCE_TYPE(__first), __VALUE_TYPE(__first));
-}
-
-template <class _RandomAccessIterator, class _Distance, class _Tp,
- class _Compare>
-void
-__push_heap(_RandomAccessIterator __first, _Distance __holeIndex,
- _Distance __topIndex, _Tp __value, _Compare __comp)
-{
- _Distance __parent = (__holeIndex - 1) / 2;
- while (__holeIndex > __topIndex && __comp(*(__first + __parent), __value)) {
- *(__first + __holeIndex) = *(__first + __parent);
- __holeIndex = __parent;
- __parent = (__holeIndex - 1) / 2;
- }
- *(__first + __holeIndex) = __value;
-}
-
-template <class _RandomAccessIterator, class _Compare,
- class _Distance, class _Tp>
-inline void
-__push_heap_aux(_RandomAccessIterator __first,
- _RandomAccessIterator __last, _Compare __comp,
- _Distance*, _Tp*)
-{
- __push_heap(__first, _Distance((__last - __first) - 1), _Distance(0),
- _Tp(*(__last - 1)), __comp);
-}
-
-template <class _RandomAccessIterator, class _Compare>
-inline void
-push_heap(_RandomAccessIterator __first, _RandomAccessIterator __last,
- _Compare __comp)
-{
- __STL_REQUIRES(_RandomAccessIterator, _Mutable_RandomAccessIterator);
- __push_heap_aux(__first, __last, __comp,
- __DISTANCE_TYPE(__first), __VALUE_TYPE(__first));
-}
-
-template <class _RandomAccessIterator, class _Distance, class _Tp>
-void
-__adjust_heap(_RandomAccessIterator __first, _Distance __holeIndex,
- _Distance __len, _Tp __value)
-{
- _Distance __topIndex = __holeIndex;
- _Distance __secondChild = 2 * __holeIndex + 2;
- while (__secondChild < __len) {
- if (*(__first + __secondChild) < *(__first + (__secondChild - 1)))
- __secondChild--;
- *(__first + __holeIndex) = *(__first + __secondChild);
- __holeIndex = __secondChild;
- __secondChild = 2 * (__secondChild + 1);
- }
- if (__secondChild == __len) {
- *(__first + __holeIndex) = *(__first + (__secondChild - 1));
- __holeIndex = __secondChild - 1;
- }
- __push_heap(__first, __holeIndex, __topIndex, __value);
-}
-
-template <class _RandomAccessIterator, class _Tp, class _Distance>
-inline void
-__pop_heap(_RandomAccessIterator __first, _RandomAccessIterator __last,
- _RandomAccessIterator __result, _Tp __value, _Distance*)
-{
- *__result = *__first;
- __adjust_heap(__first, _Distance(0), _Distance(__last - __first), __value);
-}
-
-template <class _RandomAccessIterator, class _Tp>
-inline void
-__pop_heap_aux(_RandomAccessIterator __first, _RandomAccessIterator __last,
- _Tp*)
-{
- __pop_heap(__first, __last - 1, __last - 1,
- _Tp(*(__last - 1)), __DISTANCE_TYPE(__first));
-}
-
-template <class _RandomAccessIterator>
-inline void pop_heap(_RandomAccessIterator __first,
- _RandomAccessIterator __last)
-{
- __STL_REQUIRES(_RandomAccessIterator, _Mutable_RandomAccessIterator);
- __STL_REQUIRES(typename iterator_traits<_RandomAccessIterator>::value_type,
- _LessThanComparable);
- __pop_heap_aux(__first, __last, __VALUE_TYPE(__first));
-}
-
-template <class _RandomAccessIterator, class _Distance,
- class _Tp, class _Compare>
-void
-__adjust_heap(_RandomAccessIterator __first, _Distance __holeIndex,
- _Distance __len, _Tp __value, _Compare __comp)
-{
- _Distance __topIndex = __holeIndex;
- _Distance __secondChild = 2 * __holeIndex + 2;
- while (__secondChild < __len) {
- if (__comp(*(__first + __secondChild), *(__first + (__secondChild - 1))))
- __secondChild--;
- *(__first + __holeIndex) = *(__first + __secondChild);
- __holeIndex = __secondChild;
- __secondChild = 2 * (__secondChild + 1);
- }
- if (__secondChild == __len) {
- *(__first + __holeIndex) = *(__first + (__secondChild - 1));
- __holeIndex = __secondChild - 1;
- }
- __push_heap(__first, __holeIndex, __topIndex, __value, __comp);
-}
-
-template <class _RandomAccessIterator, class _Tp, class _Compare,
- class _Distance>
-inline void
-__pop_heap(_RandomAccessIterator __first, _RandomAccessIterator __last,
- _RandomAccessIterator __result, _Tp __value, _Compare __comp,
- _Distance*)
-{
- *__result = *__first;
- __adjust_heap(__first, _Distance(0), _Distance(__last - __first),
- __value, __comp);
-}
-
-template <class _RandomAccessIterator, class _Tp, class _Compare>
-inline void
-__pop_heap_aux(_RandomAccessIterator __first,
- _RandomAccessIterator __last, _Tp*, _Compare __comp)
-{
- __pop_heap(__first, __last - 1, __last - 1, _Tp(*(__last - 1)), __comp,
- __DISTANCE_TYPE(__first));
-}
-
-template <class _RandomAccessIterator, class _Compare>
-inline void
-pop_heap(_RandomAccessIterator __first,
- _RandomAccessIterator __last, _Compare __comp)
-{
- __STL_REQUIRES(_RandomAccessIterator, _Mutable_RandomAccessIterator);
- __pop_heap_aux(__first, __last, __VALUE_TYPE(__first), __comp);
-}
-
-template <class _RandomAccessIterator, class _Tp, class _Distance>
-void
-__make_heap(_RandomAccessIterator __first,
- _RandomAccessIterator __last, _Tp*, _Distance*)
-{
- if (__last - __first < 2) return;
- _Distance __len = __last - __first;
- _Distance __parent = (__len - 2)/2;
-
- while (true) {
- __adjust_heap(__first, __parent, __len, _Tp(*(__first + __parent)));
- if (__parent == 0) return;
- __parent--;
- }
-}
-
-template <class _RandomAccessIterator>
-inline void
-make_heap(_RandomAccessIterator __first, _RandomAccessIterator __last)
-{
- __STL_REQUIRES(_RandomAccessIterator, _Mutable_RandomAccessIterator);
- __STL_REQUIRES(typename iterator_traits<_RandomAccessIterator>::value_type,
- _LessThanComparable);
- __make_heap(__first, __last,
- __VALUE_TYPE(__first), __DISTANCE_TYPE(__first));
-}
-
-template <class _RandomAccessIterator, class _Compare,
- class _Tp, class _Distance>
-void
-__make_heap(_RandomAccessIterator __first, _RandomAccessIterator __last,
- _Compare __comp, _Tp*, _Distance*)
-{
- if (__last - __first < 2) return;
- _Distance __len = __last - __first;
- _Distance __parent = (__len - 2)/2;
-
- while (true) {
- __adjust_heap(__first, __parent, __len, _Tp(*(__first + __parent)),
- __comp);
- if (__parent == 0) return;
- __parent--;
- }
-}
-
-template <class _RandomAccessIterator, class _Compare>
-inline void
-make_heap(_RandomAccessIterator __first,
- _RandomAccessIterator __last, _Compare __comp)
-{
- __STL_REQUIRES(_RandomAccessIterator, _Mutable_RandomAccessIterator);
- __make_heap(__first, __last, __comp,
- __VALUE_TYPE(__first), __DISTANCE_TYPE(__first));
-}
-
-template <class _RandomAccessIterator>
-void sort_heap(_RandomAccessIterator __first, _RandomAccessIterator __last)
-{
- __STL_REQUIRES(_RandomAccessIterator, _Mutable_RandomAccessIterator);
- __STL_REQUIRES(typename iterator_traits<_RandomAccessIterator>::value_type,
- _LessThanComparable);
- while (__last - __first > 1)
- pop_heap(__first, __last--);
-}
-
-template <class _RandomAccessIterator, class _Compare>
-void
-sort_heap(_RandomAccessIterator __first,
- _RandomAccessIterator __last, _Compare __comp)
-{
- __STL_REQUIRES(_RandomAccessIterator, _Mutable_RandomAccessIterator);
- while (__last - __first > 1)
- pop_heap(__first, __last--, __comp);
-}
-
-#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
-#pragma reset woff 1209
-#endif
-
-__STL_END_NAMESPACE
-
-#endif /* __SGI_STL_INTERNAL_HEAP_H */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/WebKit/android/stl/stl_iterator_base.h b/WebKit/android/stl/stl_iterator_base.h
deleted file mode 100644
index 746d1d4..0000000
--- a/WebKit/android/stl/stl_iterator_base.h
+++ /dev/null
@@ -1,274 +0,0 @@
-/*
- *
- * Copyright 2009, The Android Open Source Project
- * Copyright (c) 1994
- * Hewlett-Packard Company
- *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation. Hewlett-Packard Company makes no
- * representations about the suitability of this software for any
- * purpose. It is provided "as is" without express or implied warranty.
- *
- *
- * Copyright (c) 1996-1998
- * Silicon Graphics Computer Systems, Inc.
- *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation. Silicon Graphics makes no
- * representations about the suitability of this software for any
- * purpose. It is provided "as is" without express or implied warranty.
- */
-
-/* NOTE: This is an internal header file, included by other STL headers.
- * You should not attempt to use it directly.
- */
-
-#ifndef __SGI_STL_INTERNAL_ITERATOR_BASE_H
-#define __SGI_STL_INTERNAL_ITERATOR_BASE_H
-
-// This file contains all of the general iterator-related utilities.
-// The internal file stl_iterator.h contains predefined iterators,
-// such as front_insert_iterator and istream_iterator.
-
-#include <concept_checks.h>
-
-struct input_iterator_tag {};
-struct output_iterator_tag {};
-struct forward_iterator_tag : public input_iterator_tag {};
-struct bidirectional_iterator_tag : public forward_iterator_tag {};
-struct random_access_iterator_tag : public bidirectional_iterator_tag {};
-
-// The base classes input_iterator, output_iterator, forward_iterator,
-// bidirectional_iterator, and random_access_iterator are not part of
-// the C++ standard. (They have been replaced by struct iterator.)
-// They are included for backward compatibility with the HP STL.
-
-template <class _Tp, class _Distance> struct input_iterator {
- typedef input_iterator_tag iterator_category;
- typedef _Tp value_type;
- typedef _Distance difference_type;
- typedef _Tp* pointer;
- typedef _Tp& reference;
-};
-
-struct output_iterator {
- typedef output_iterator_tag iterator_category;
- typedef void value_type;
- typedef void difference_type;
- typedef void pointer;
- typedef void reference;
-};
-
-template <class _Tp, class _Distance> struct forward_iterator {
- typedef forward_iterator_tag iterator_category;
- typedef _Tp value_type;
- typedef _Distance difference_type;
- typedef _Tp* pointer;
- typedef _Tp& reference;
-};
-
-
-template <class _Tp, class _Distance> struct bidirectional_iterator {
- typedef bidirectional_iterator_tag iterator_category;
- typedef _Tp value_type;
- typedef _Distance difference_type;
- typedef _Tp* pointer;
- typedef _Tp& reference;
-};
-
-template <class _Tp, class _Distance> struct random_access_iterator {
- typedef random_access_iterator_tag iterator_category;
- typedef _Tp value_type;
- typedef _Distance difference_type;
- typedef _Tp* pointer;
- typedef _Tp& reference;
-};
-
-template <class _Category, class _Tp, class _Distance = ptrdiff_t,
- class _Pointer = _Tp*, class _Reference = _Tp&>
-struct iterator {
- typedef _Category iterator_category;
- typedef _Tp value_type;
- typedef _Distance difference_type;
- typedef _Pointer pointer;
- typedef _Reference reference;
-};
-
-template <class _Iterator>
-struct iterator_traits {
- typedef typename _Iterator::iterator_category iterator_category;
- typedef typename _Iterator::value_type value_type;
- typedef typename _Iterator::difference_type difference_type;
- typedef typename _Iterator::pointer pointer;
- typedef typename _Iterator::reference reference;
-};
-
-template <class _Tp>
-struct iterator_traits<_Tp*> {
- typedef random_access_iterator_tag iterator_category;
- typedef _Tp value_type;
- typedef ptrdiff_t difference_type;
- typedef _Tp* pointer;
- typedef _Tp& reference;
-};
-
-template <class _Tp>
-struct iterator_traits<const _Tp*> {
- typedef random_access_iterator_tag iterator_category;
- typedef _Tp value_type;
- typedef ptrdiff_t difference_type;
- typedef const _Tp* pointer;
- typedef const _Tp& reference;
-};
-
-// The overloaded functions iterator_category, distance_type, and
-// value_type are not part of the C++ standard. (They have been
-// replaced by struct iterator_traits.) They are included for
-// backward compatibility with the HP STL.
-
-// We introduce internal names for these functions.
-
-template <class _Iter>
-inline typename iterator_traits<_Iter>::iterator_category
-__iterator_category(const _Iter&)
-{
- typedef typename iterator_traits<_Iter>::iterator_category _Category;
- return _Category();
-}
-
-template <class _Iter>
-inline typename iterator_traits<_Iter>::difference_type*
-__distance_type(const _Iter&)
-{
- return static_cast<typename iterator_traits<_Iter>::difference_type*>(0);
-}
-
-template <class _Iter>
-inline typename iterator_traits<_Iter>::value_type*
-__value_type(const _Iter&)
-{
- return static_cast<typename iterator_traits<_Iter>::value_type*>(0);
-}
-
-template <class _Iter>
-inline typename iterator_traits<_Iter>::iterator_category
-iterator_category(const _Iter& __i) { return __iterator_category(__i); }
-
-
-template <class _Iter>
-inline typename iterator_traits<_Iter>::difference_type*
-distance_type(const _Iter& __i) { return __distance_type(__i); }
-
-template <class _Iter>
-inline typename iterator_traits<_Iter>::value_type*
-value_type(const _Iter& __i) { return __value_type(__i); }
-
-#define __ITERATOR_CATEGORY(__i) __iterator_category(__i)
-#define __DISTANCE_TYPE(__i) __distance_type(__i)
-#define __VALUE_TYPE(__i) __value_type(__i)
-
-template <class _InputIterator, class _Distance>
-inline void __distance(_InputIterator __first, _InputIterator __last,
- _Distance& __n, input_iterator_tag)
-{
- while (__first != __last) { ++__first; ++__n; }
-}
-
-template <class _RandomAccessIterator, class _Distance>
-inline void __distance(_RandomAccessIterator __first,
- _RandomAccessIterator __last,
- _Distance& __n, random_access_iterator_tag)
-{
- __STL_REQUIRES(_RandomAccessIterator, _RandomAccessIterator);
- __n += __last - __first;
-}
-
-template <class _InputIterator, class _Distance>
-inline void distance(_InputIterator __first,
- _InputIterator __last, _Distance& __n)
-{
- __STL_REQUIRES(_InputIterator, _InputIterator);
- __distance(__first, __last, __n, iterator_category(__first));
-}
-
-#ifdef __STL_CLASS_PARTIAL_SPECIALIZATION
-
-template <class _InputIterator>
-inline typename iterator_traits<_InputIterator>::difference_type
-__distance(_InputIterator __first, _InputIterator __last, input_iterator_tag)
-{
- typename iterator_traits<_InputIterator>::difference_type __n = 0;
- while (__first != __last) {
- ++__first; ++__n;
- }
- return __n;
-}
-
-template <class _RandomAccessIterator>
-inline typename iterator_traits<_RandomAccessIterator>::difference_type
-__distance(_RandomAccessIterator __first, _RandomAccessIterator __last,
- random_access_iterator_tag) {
- __STL_REQUIRES(_RandomAccessIterator, _RandomAccessIterator);
- return __last - __first;
-}
-
-template <class _InputIterator>
-inline typename iterator_traits<_InputIterator>::difference_type
-distance(_InputIterator __first, _InputIterator __last) {
- typedef typename iterator_traits<_InputIterator>::iterator_category
- _Category;
- __STL_REQUIRES(_InputIterator, _InputIterator);
- return __distance(__first, __last, _Category());
-}
-
-#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */
-
-template <class _InputIter, class _Distance>
-inline void __advance(_InputIter& __i, _Distance __n, input_iterator_tag) {
- while (__n--) ++__i;
-}
-
-#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
-#pragma set woff 1183
-#endif
-
-template <class _BidirectionalIterator, class _Distance>
-inline void __advance(_BidirectionalIterator& __i, _Distance __n,
- bidirectional_iterator_tag) {
- __STL_REQUIRES(_BidirectionalIterator, _BidirectionalIterator);
- if (__n >= 0)
- while (__n--) ++__i;
- else
- while (__n++) --__i;
-}
-
-#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
-#pragma reset woff 1183
-#endif
-
-template <class _RandomAccessIterator, class _Distance>
-inline void __advance(_RandomAccessIterator& __i, _Distance __n,
- random_access_iterator_tag) {
- __STL_REQUIRES(_RandomAccessIterator, _RandomAccessIterator);
- __i += __n;
-}
-
-template <class _InputIterator, class _Distance>
-inline void advance(_InputIterator& __i, _Distance __n) {
- __STL_REQUIRES(_InputIterator, _InputIterator);
- __advance(__i, __n, iterator_category(__i));
-}
-
-#endif /* __SGI_STL_INTERNAL_ITERATOR_BASE_H */
-
-
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/WebKit/android/stl/strings.h b/WebKit/android/stl/strings.h
deleted file mode 100644
index 599a890..0000000
--- a/WebKit/android/stl/strings.h
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Copyright 2007, 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 APPLE COMPUTER, INC. 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.
- */
-