diff options
-rw-r--r-- | WebKit/android/jni/DeviceMotionClientImpl.h | 5 | ||||
-rw-r--r-- | WebKit/android/jni/DeviceOrientationClientImpl.h | 5 | ||||
-rw-r--r-- | WebKit/android/jni/JavaBridge.cpp | 23 | ||||
-rw-r--r-- | WebKit/android/jni/WebViewCore.cpp | 21 | ||||
-rw-r--r-- | WebKit/android/jni/WebViewCore.h | 58 | ||||
-rw-r--r-- | WebKit/android/plugins/ANPSoundInterface.cpp | 2 |
6 files changed, 52 insertions, 62 deletions
diff --git a/WebKit/android/jni/DeviceMotionClientImpl.h b/WebKit/android/jni/DeviceMotionClientImpl.h index 04d3a67..c979098 100644 --- a/WebKit/android/jni/DeviceMotionClientImpl.h +++ b/WebKit/android/jni/DeviceMotionClientImpl.h @@ -42,6 +42,7 @@ class WebViewCore; class DeviceMotionClientImpl : public DeviceMotionClient { public: DeviceMotionClientImpl(WebViewCore*); + virtual ~DeviceMotionClientImpl(); void onMotionChange(PassRefPtr<DeviceMotionData>); void suspend(); @@ -54,9 +55,7 @@ public: virtual void setController(DeviceMotionController* controller) { m_controller = controller; } virtual void deviceMotionControllerDestroyed() { } -protected: - virtual ~DeviceMotionClientImpl(); - +private: jobject getJavaInstance(); void releaseJavaInstance(); diff --git a/WebKit/android/jni/DeviceOrientationClientImpl.h b/WebKit/android/jni/DeviceOrientationClientImpl.h index ba86083..0e3f6b3 100644 --- a/WebKit/android/jni/DeviceOrientationClientImpl.h +++ b/WebKit/android/jni/DeviceOrientationClientImpl.h @@ -42,6 +42,7 @@ class WebViewCore; class DeviceOrientationClientImpl : public DeviceOrientationClient { public: DeviceOrientationClientImpl(WebViewCore*); + virtual ~DeviceOrientationClientImpl(); void onOrientationChange(PassRefPtr<DeviceOrientation>); void suspend(); @@ -54,9 +55,7 @@ public: virtual void setController(DeviceOrientationController* controller) { m_controller = controller; } virtual void deviceOrientationControllerDestroyed() { } -protected: - virtual ~DeviceOrientationClientImpl(); - +private: jobject getJavaInstance(); void releaseJavaInstance(); diff --git a/WebKit/android/jni/JavaBridge.cpp b/WebKit/android/jni/JavaBridge.cpp index d27dbc7..2fa12fc 100644 --- a/WebKit/android/jni/JavaBridge.cpp +++ b/WebKit/android/jni/JavaBridge.cpp @@ -125,6 +125,7 @@ private: jmethodID mGetKeyStrengthList; jmethodID mGetSignedPublicKey; jmethodID mResolveFilePathForContentUri; + AutoJObject javaObject(JNIEnv* env) { return getRealObject(env, mJavaObject); } }; static void (*sSharedTimerFiredCallback)(); @@ -183,7 +184,7 @@ void JavaBridge::setSharedTimer(long long timemillis) { JNIEnv* env = JSC::Bindings::getJNIEnv(); - AutoJObject obj = getRealObject(env, mJavaObject); + AutoJObject obj = javaObject(env); env->CallVoidMethod(obj.get(), mSetSharedTimer, timemillis); } @@ -191,7 +192,7 @@ void JavaBridge::stopSharedTimer() { JNIEnv* env = JSC::Bindings::getJNIEnv(); - AutoJObject obj = getRealObject(env, mJavaObject); + AutoJObject obj = javaObject(env); env->CallVoidMethod(obj.get(), mStopSharedTimer); } @@ -203,7 +204,7 @@ JavaBridge::setCookies(WebCore::KURL const& url, WTF::String const& value) jstring jUrlStr = wtfStringToJstring(env, urlStr); jstring jValueStr = wtfStringToJstring(env, value); - AutoJObject obj = getRealObject(env, mJavaObject); + AutoJObject obj = javaObject(env); env->CallVoidMethod(obj.get(), mSetCookies, jUrlStr, jValueStr); env->DeleteLocalRef(jUrlStr); env->DeleteLocalRef(jValueStr); @@ -216,7 +217,7 @@ JavaBridge::cookies(WebCore::KURL const& url) const WTF::String& urlStr = url.string(); jstring jUrlStr = wtfStringToJstring(env, urlStr); - AutoJObject obj = getRealObject(env, mJavaObject); + AutoJObject obj = javaObject(env); jstring string = (jstring)(env->CallObjectMethod(obj.get(), mCookies, jUrlStr)); WTF::String ret = jstringToWtfString(env, string); @@ -229,7 +230,7 @@ bool JavaBridge::cookiesEnabled() { JNIEnv* env = JSC::Bindings::getJNIEnv(); - AutoJObject obj = getRealObject(env, mJavaObject); + AutoJObject obj = javaObject(env); jboolean ret = env->CallBooleanMethod(obj.get(), mCookiesEnabled); return (ret != 0); } @@ -239,7 +240,7 @@ JavaBridge::getPluginDirectories() { WTF::Vector<WTF::String> directories; JNIEnv* env = JSC::Bindings::getJNIEnv(); - AutoJObject obj = getRealObject(env, mJavaObject); + AutoJObject obj = javaObject(env); jobjectArray array = (jobjectArray) env->CallObjectMethod(obj.get(), mGetPluginDirectories); int count = env->GetArrayLength(array); @@ -257,7 +258,7 @@ WTF::String JavaBridge::getPluginSharedDataDirectory() { JNIEnv* env = JSC::Bindings::getJNIEnv(); - AutoJObject obj = getRealObject(env, mJavaObject); + AutoJObject obj = javaObject(env); jstring ret = (jstring)env->CallObjectMethod(obj.get(), mGetPluginSharedDataDirectory); WTF::String path = jstringToWtfString(env, ret); checkException(env); @@ -279,14 +280,14 @@ void JavaBridge::signalServiceFuncPtrQueue() // is the only usage on most threads, so we need to ensure a JNI // environment is setup. JNIEnv* env = JSC::Bindings::getJNIEnv(); - AutoJObject obj = getRealObject(env, mJavaObject); + AutoJObject obj = javaObject(env); env->CallVoidMethod(obj.get(), mSignalFuncPtrQueue); } WTF::Vector<WTF::String>JavaBridge::getSupportedKeyStrengthList() { WTF::Vector<WTF::String> list; JNIEnv* env = JSC::Bindings::getJNIEnv(); - AutoJObject obj = getRealObject(env, mJavaObject); + AutoJObject obj = javaObject(env); jobjectArray array = (jobjectArray) env->CallObjectMethod(obj.get(), mGetKeyStrengthList); int count = env->GetArrayLength(array); @@ -306,7 +307,7 @@ WTF::String JavaBridge::getSignedPublicKeyAndChallengeString(unsigned index, jstring jChallenge = wtfStringToJstring(env, challenge); const WTF::String& urlStr = url.string(); jstring jUrl = wtfStringToJstring(env, urlStr); - AutoJObject obj = getRealObject(env, mJavaObject); + AutoJObject obj = javaObject(env); jstring key = (jstring) env->CallObjectMethod(obj.get(), mGetSignedPublicKey, index, jChallenge, jUrl); WTF::String ret = jstringToWtfString(env, key); @@ -319,7 +320,7 @@ WTF::String JavaBridge::getSignedPublicKeyAndChallengeString(unsigned index, WTF::String JavaBridge::resolveFilePathForContentUri(const WTF::String& uri) { JNIEnv* env = JSC::Bindings::getJNIEnv(); jstring jUri = wtfStringToJstring(env, uri); - AutoJObject obj = getRealObject(env, mJavaObject); + AutoJObject obj = javaObject(env); jstring path = static_cast<jstring>(env->CallObjectMethod(obj.get(), mResolveFilePathForContentUri, jUri)); WTF::String ret = jstringToWtfString(env, path); env->DeleteLocalRef(jUri); diff --git a/WebKit/android/jni/WebViewCore.cpp b/WebKit/android/jni/WebViewCore.cpp index 57a3ca8..f2680b5 100644 --- a/WebKit/android/jni/WebViewCore.cpp +++ b/WebKit/android/jni/WebViewCore.cpp @@ -491,7 +491,7 @@ void WebViewCore::reset(bool fromConstructor) m_scrollOffsetY = 0; m_screenWidth = 0; m_screenHeight = 0; - m_groupForVisitedLinks = NULL; + m_groupForVisitedLinks = 0; m_currentNodeDomNavigationAxis = 0; } @@ -1976,7 +1976,7 @@ PluginWidgetAndroid* WebViewCore::getPluginWidget(NPP npp) return (*iter); } } - return NULL; + return 0; } static PluginView* nodeIsPlugin(Node* node) { @@ -2042,7 +2042,7 @@ void WebViewCore::moveMouse(WebCore::Frame* frame, int x, int y) { DBG_NAV_LOGD("frame=%p x=%d y=%d scrollOffset=(%d,%d)", frame, x, y, m_scrollOffsetX, m_scrollOffsetY); - if (!frame || CacheBuilder::validNode(m_mainFrame, frame, NULL) == false) + if (!frame || !CacheBuilder::validNode(m_mainFrame, frame, 0)) frame = m_mainFrame; // mouse event expects the position in the window coordinate m_mousePos = WebCore::IntPoint(x - m_scrollOffsetX, y - m_scrollOffsetY); @@ -3172,8 +3172,7 @@ static bool shouldSuppressKeyboard(const WebCore::Node* node) { // in which case, 'fake' is set to true bool WebViewCore::handleMouseClick(WebCore::Frame* framePtr, WebCore::Node* nodePtr, bool fake) { - bool valid = framePtr == NULL - || CacheBuilder::validNode(m_mainFrame, framePtr, nodePtr); + bool valid = !framePtr || CacheBuilder::validNode(m_mainFrame, framePtr, nodePtr); WebFrame* webFrame = WebFrame::getWebFrame(m_mainFrame); if (valid && nodePtr) { // Need to special case area tags because an image map could have an area element in the middle @@ -3258,7 +3257,7 @@ void WebViewCore::popupReply(const int* array, int count) if (m_popupReply) { m_popupReply->replyIntArray(array, count); Release(m_popupReply); - m_popupReply = NULL; + m_popupReply = 0; } } @@ -3433,7 +3432,7 @@ bool WebViewCore::jsInterrupt() AutoJObject WebViewCore::getJavaObject() { - return getRealObject(JSC::Bindings::getJNIEnv(), m_javaGlue->m_obj); + return m_javaGlue->object(JSC::Bindings::getJNIEnv()); } jobject @@ -4331,7 +4330,7 @@ static void ProvideVisitedHistory(JNIEnv *env, jobject obj, jobject hist) jsize len = env->GetArrayLength(array); for (jsize i = 0; i < len; i++) { jstring item = static_cast<jstring>(env->GetObjectArrayElement(array, i)); - const UChar* str = static_cast<const UChar*>(env->GetStringChars(item, NULL)); + const UChar* str = static_cast<const UChar*>(env->GetStringChars(item, 0)); jsize len = env->GetStringLength(item); viewImpl->addVisitedLink(str, len); env->ReleaseStringChars(item, str); @@ -4368,10 +4367,10 @@ static jobject GetTouchHighlightRects(JNIEnv* env, jobject obj, jint x, jint y, { WebViewCore* viewImpl = GET_NATIVE_VIEW(env, obj); if (!viewImpl) - return NULL; + return 0; Vector<IntRect> rects = viewImpl->getTouchHighlightRects(x, y, slop); if (rects.isEmpty()) - return NULL; + return 0; jclass arrayClass = env->FindClass("java/util/ArrayList"); LOG_ASSERT(arrayClass, "Could not find java/util/ArrayList"); @@ -4587,7 +4586,7 @@ int registerWebViewCore(JNIEnv* env) gWebViewCoreStaticMethods.m_isSupportedMediaMimeType = env->GetStaticMethodID(widget, "isSupportedMediaMimeType", "(Ljava/lang/String;)Z"); - LOG_FATAL_IF(gWebViewCoreStaticMethods.m_isSupportedMediaMimeType == NULL, + LOG_FATAL_IF(!gWebViewCoreStaticMethods.m_isSupportedMediaMimeType, "Could not find static method isSupportedMediaMimeType from WebViewCore"); env->DeleteLocalRef(widget); diff --git a/WebKit/android/jni/WebViewCore.h b/WebKit/android/jni/WebViewCore.h index 136ea79..8d8f303 100644 --- a/WebKit/android/jni/WebViewCore.h +++ b/WebKit/android/jni/WebViewCore.h @@ -294,9 +294,6 @@ namespace android { // Create a single picture to represent the drawn DOM (used by navcache) void recordPicture(SkPicture* picture); - // Create a set of pictures to represent the drawn DOM, driven by - // the invalidated region and the time required to draw (used to draw) - void recordPictureSet(PictureSet* master); void moveFocus(WebCore::Frame* frame, WebCore::Node* node); void moveMouse(WebCore::Frame* frame, int x, int y); void moveMouseIfLatest(int moveGeneration, @@ -509,8 +506,6 @@ namespace android { // return a list of rects matching the touch point (x, y) with the slop Vector<IntRect> getTouchHighlightRects(int x, int y, int slop); - // other public functions - public: // Open a file chooser for selecting a file to upload void openFileChooser(PassRefPtr<WebCore::FileChooser> ); @@ -553,6 +548,28 @@ namespace android { bool multiple, const int selected[], size_t selectedCountOrSelection); bool shouldPaintCaret() { return m_shouldPaintCaret; } void setShouldPaintCaret(bool should) { m_shouldPaintCaret = should; } + bool isPaused() const { return m_isPaused; } + void setIsPaused(bool isPaused) { m_isPaused = isPaused; } + bool drawIsPaused() const; + // The actual content (without title bar) size in doc coordinate + int screenWidth() const { return m_screenWidth; } + int screenHeight() const { return m_screenHeight; } +#if USE(CHROME_NETWORK_STACK) + void setWebRequestContextUserAgent(); + void setWebRequestContextCacheMode(int mode); + WebRequestContext* webRequestContext(); +#endif + // Attempts to scroll the layer to the x,y coordinates of rect. The + // layer is the id of the LayerAndroid. + void scrollRenderLayer(int layer, const SkRect& rect); + // call only from webkit thread (like add/remove), return true if inst + // is still alive + static bool isInstance(WebViewCore*); + // if there exists at least one WebViewCore instance then we return the + // application context, otherwise NULL is returned. + static jobject getApplicationContext(); + // Check whether a media mimeType is supported in Android media framework. + static bool isSupportedMediaMimeType(const WTF::String& mimeType); // these members are shared with webview.cpp static Mutex gFrameCacheMutex; @@ -575,22 +592,6 @@ namespace android { // field safely from our respective threads static Mutex gButtonMutex; WTF::Vector<Container> m_buttons; - bool isPaused() const { return m_isPaused; } - void setIsPaused(bool isPaused) { m_isPaused = isPaused; } - bool drawIsPaused() const; - // The actual content (without title bar) size in doc coordinate - int screenWidth() const { return m_screenWidth; } - int screenHeight() const { return m_screenHeight; } -#if USE(CHROME_NETWORK_STACK) - void setWebRequestContextUserAgent(); - void setWebRequestContextCacheMode(int mode); - WebRequestContext* webRequestContext(); -#endif - - // Attempts to scroll the layer to the x,y coordinates of rect. The - // layer is the id of the LayerAndroid. - void scrollRenderLayer(int layer, const SkRect& rect); - // end of shared members // internal functions @@ -602,6 +603,9 @@ namespace android { // Then check the old buttons to see if any are no longer needed. void updateButtonList(WTF::Vector<Container>* buttons); void reset(bool fromConstructor); + // Create a set of pictures to represent the drawn DOM, driven by + // the invalidated region and the time required to draw (used to draw) + void recordPictureSet(PictureSet* master); friend class ListBoxReply; struct JavaGlue; @@ -699,22 +703,10 @@ namespace android { scoped_refptr<WebRequestContext> m_webRequestContext; #endif - private: // called from constructor, to add this to a global list static void addInstance(WebViewCore*); // called from destructor, to remove this from a global list static void removeInstance(WebViewCore*); - public: - // call only from webkit thread (like add/remove), return true if inst - // is still alive - static bool isInstance(WebViewCore*); - - // if there exists at least on WebViewCore instance then we return the - // application context, otherwise NULL is returned. - static jobject getApplicationContext(); - - // Check whether a media mimeType is supported in Android media framework. - static bool isSupportedMediaMimeType(const WTF::String& mimeType); }; } // namespace android diff --git a/WebKit/android/plugins/ANPSoundInterface.cpp b/WebKit/android/plugins/ANPSoundInterface.cpp index c109880..c238872 100644 --- a/WebKit/android/plugins/ANPSoundInterface.cpp +++ b/WebKit/android/plugins/ANPSoundInterface.cpp @@ -30,7 +30,7 @@ #include "SkTypes.h" #include "media/AudioTrack.h" -#include <hardware/audio.h> +#include <system/audio.h> struct ANPAudioTrack { void* mUser; |