diff options
author | Steve Block <steveblock@google.com> | 2011-05-12 12:43:55 +0100 |
---|---|---|
committer | Steve Block <steveblock@google.com> | 2011-05-12 12:43:55 +0100 |
commit | 95c170a70196646a7aff404fae24d2856195f6ce (patch) | |
tree | f78e6d1410fa4d5116488a8eed2b2706c79266f0 /WebKit/android | |
parent | 121b0cf4517156d0ac5111caf9830c51b69bae8f (diff) | |
download | external_webkit-95c170a70196646a7aff404fae24d2856195f6ce.zip external_webkit-95c170a70196646a7aff404fae24d2856195f6ce.tar.gz external_webkit-95c170a70196646a7aff404fae24d2856195f6ce.tar.bz2 |
Clean up WebViewCore
This is in preparation for the fix for null weak global references.
No functional change.
Bug: 4336862
Change-Id: Icaf11948b0488d10ef112372275a254114a7efb3
Diffstat (limited to 'WebKit/android')
-rw-r--r-- | WebKit/android/jni/WebViewCore.cpp | 21 | ||||
-rw-r--r-- | WebKit/android/jni/WebViewCore.h | 58 |
2 files changed, 35 insertions, 44 deletions
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 |