diff options
Diffstat (limited to 'Source/WebKit/android')
-rw-r--r-- | Source/WebKit/android/jni/WebCoreJniOnLoad.cpp | 2 | ||||
-rw-r--r-- | Source/WebKit/android/jni/WebViewCore.cpp | 59 | ||||
-rw-r--r-- | Source/WebKit/android/jni/WebViewCore.h | 9 | ||||
-rw-r--r-- | Source/WebKit/android/nav/WebView.cpp | 75 |
4 files changed, 11 insertions, 134 deletions
diff --git a/Source/WebKit/android/jni/WebCoreJniOnLoad.cpp b/Source/WebKit/android/jni/WebCoreJniOnLoad.cpp index e9d7bc3..bb71bf5 100644 --- a/Source/WebKit/android/jni/WebCoreJniOnLoad.cpp +++ b/Source/WebKit/android/jni/WebCoreJniOnLoad.cpp @@ -304,7 +304,7 @@ EXPORT void benchmark(const char* url, int reloadCount, int width, int height) { bmp.setConfig(SkBitmap::kARGB_8888_Config, width, height); bmp.allocPixels(); SkCanvas canvas(bmp); - PlatformGraphicsContext ctx(&canvas, NULL); + PlatformGraphicsContext ctx(&canvas); GraphicsContext gc(&ctx); frame->view()->paintContents(&gc, IntRect(0, 0, width, height)); diff --git a/Source/WebKit/android/jni/WebViewCore.cpp b/Source/WebKit/android/jni/WebViewCore.cpp index d7a61aa..0708d5c 100644 --- a/Source/WebKit/android/jni/WebViewCore.cpp +++ b/Source/WebKit/android/jni/WebViewCore.cpp @@ -336,7 +336,6 @@ static jmethodID GetJMethod(JNIEnv* env, jclass clazz, const char name[], const } Mutex WebViewCore::gFrameCacheMutex; -Mutex WebViewCore::gButtonMutex; Mutex WebViewCore::gCursorBoundsMutex; WebViewCore::WebViewCore(JNIEnv* env, jobject javaWebViewCore, WebCore::Frame* mainframe) @@ -560,19 +559,10 @@ void WebViewCore::recordPicture(SkPicture* picture) view->contentsHeight(), PICT_RECORD_FLAGS); SkAutoMemoryUsageProbe mup(__FUNCTION__); - // Copy m_buttons so we can pass it to our graphics context. - gButtonMutex.lock(); - WTF::Vector<Container> buttons(m_buttons); - gButtonMutex.unlock(); - - WebCore::PlatformGraphicsContext pgc(arp.getRecordingCanvas(), &buttons); + WebCore::PlatformGraphicsContext pgc(arp.getRecordingCanvas()); WebCore::GraphicsContext gc(&pgc); view->platformWidget()->draw(&gc, WebCore::IntRect(0, 0, view->contentsWidth(), view->contentsHeight())); - - gButtonMutex.lock(); - updateButtonList(&buttons); - gButtonMutex.unlock(); } void WebViewCore::recordPictureSet(PictureSet* content) @@ -786,43 +776,6 @@ void WebViewCore::recordPictureSet(PictureSet* content) } } -void WebViewCore::updateButtonList(WTF::Vector<Container>* buttons) -{ - // All the entries in buttons are either updates of previous entries in - // m_buttons or they need to be added to it. - Container* end = buttons->end(); - for (Container* updatedContainer = buttons->begin(); - updatedContainer != end; updatedContainer++) { - bool updated = false; - // Search for a previous entry that references the same node as our new - // data - Container* lastPossibleMatch = m_buttons.end(); - for (Container* possibleMatch = m_buttons.begin(); - possibleMatch != lastPossibleMatch; possibleMatch++) { - if (updatedContainer->matches(possibleMatch->node())) { - // Update our record, and skip to the next one. - possibleMatch->setRect(updatedContainer->rect()); - updated = true; - break; - } - } - if (!updated) { - // This is a brand new button, so append it to m_buttons - m_buttons.append(*updatedContainer); - } - } - size_t i = 0; - // count will decrease each time one is removed, so check count each time. - while (i < m_buttons.size()) { - if (m_buttons[i].canBeRemoved()) { - m_buttons[i] = m_buttons.last(); - m_buttons.removeLast(); - } else { - i++; - } - } -} - // note: updateCursorBounds is called directly by the WebView thread // This needs to be called each time we call CachedRoot::setCursor() with // non-null CachedNode/CachedFrame, since otherwise the WebViewCore's data @@ -877,11 +830,7 @@ SkPicture* WebViewCore::rebuildPicture(const SkIRect& inval) SkAutoMemoryUsageProbe mup(__FUNCTION__); SkCanvas* recordingCanvas = arp.getRecordingCanvas(); - gButtonMutex.lock(); - WTF::Vector<Container> buttons(m_buttons); - gButtonMutex.unlock(); - - WebCore::PlatformGraphicsContext pgc(recordingCanvas, &buttons); + WebCore::PlatformGraphicsContext pgc(recordingCanvas); WebCore::GraphicsContext gc(&pgc); recordingCanvas->translate(-inval.fLeft, -inval.fTop); recordingCanvas->save(); @@ -892,10 +841,6 @@ SkPicture* WebViewCore::rebuildPicture(const SkIRect& inval) m_rebuildInval.getBounds().fLeft, m_rebuildInval.getBounds().fTop, m_rebuildInval.getBounds().fRight, m_rebuildInval.getBounds().fBottom); - gButtonMutex.lock(); - updateButtonList(&buttons); - gButtonMutex.unlock(); - return picture; } diff --git a/Source/WebKit/android/jni/WebViewCore.h b/Source/WebKit/android/jni/WebViewCore.h index ea57c11..acde590 100644 --- a/Source/WebKit/android/jni/WebViewCore.h +++ b/Source/WebKit/android/jni/WebViewCore.h @@ -595,21 +595,12 @@ namespace android { IntPoint m_cursorLocation; void* m_cursorNode; static Mutex gCursorBoundsMutex; - // These two fields go together: we use the mutex to protect access to - // m_buttons, so that we, and webview.cpp can look/modify the m_buttons - // field safely from our respective threads - static Mutex gButtonMutex; - WTF::Vector<Container> m_buttons; // end of shared members // internal functions private: CacheBuilder& cacheBuilder(); WebCore::Node* currentFocus(); - // Compare the new set of buttons to the old one. All of the new - // buttons either replace our old ones or should be added to our list. - // Then check the old buttons to see if any are no longer needed. - void updateButtonList(WTF::Vector<Container>* buttons); // 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); diff --git a/Source/WebKit/android/nav/WebView.cpp b/Source/WebKit/android/nav/WebView.cpp index 10f679d..60bdd3e 100644 --- a/Source/WebKit/android/nav/WebView.cpp +++ b/Source/WebKit/android/nav/WebView.cpp @@ -303,58 +303,6 @@ void debugDump() } #endif -// Traverse our stored array of buttons that are in our picture, and update -// their subpictures according to their current state. -// Called from the UI thread. This is the one place in the UI thread where we -// access the buttons stored in the WebCore thread. -// hasFocus keeps track of whether the WebView has focus && windowFocus. -// If not, we do not want to draw the button in a selected or pressed state -void nativeRecordButtons(bool hasFocus, bool pressed, bool invalidate) -{ - bool cursorIsOnButton = false; - const CachedFrame* cachedFrame; - const CachedNode* cachedCursor = 0; - // Lock the mutex, since we now share with the WebCore thread. - m_viewImpl->gButtonMutex.lock(); - if (m_viewImpl->m_buttons.size() && m_buttonSkin) { - // FIXME: In a future change, we should keep track of whether the selection - // has changed to short circuit (note that we would still need to update - // if we received new buttons from the WebCore thread). - WebCore::Node* cursor = 0; - CachedRoot* root = getFrameCache(DontAllowNewer); - if (root) { - cachedCursor = root->currentCursor(&cachedFrame); - if (cachedCursor) - cursor = (WebCore::Node*) cachedCursor->nodePointer(); - } - - // Traverse the array, and update each button, depending on whether it - // is selected. - Container* end = m_viewImpl->m_buttons.end(); - for (Container* ptr = m_viewImpl->m_buttons.begin(); ptr != end; ptr++) { - RenderSkinAndroid::State state = RenderSkinAndroid::kNormal; - if (ptr->matches(cursor)) { - cursorIsOnButton = true; - // If the WebView is out of focus/window focus, set the state to - // normal, but still keep track of the fact that the selected is a - // button - if (hasFocus) { - if (pressed || m_ring.m_isPressed) - state = RenderSkinAndroid::kPressed; - else if (SkTime::GetMSecs() < m_ringAnimationEnd) - state = RenderSkinAndroid::kFocused; - } - } - ptr->updateFocusState(state, m_buttonSkin); - } - } - m_viewImpl->gButtonMutex.unlock(); - if (invalidate && cachedCursor && cursorIsOnButton) { - const WebCore::IntRect& b = cachedCursor->bounds(cachedFrame); - viewInvalidateRect(b.x(), b.y(), b.maxX(), b.maxY()); - } -} - void scrollToCurrentMatch() { if (!m_findOnPage.currentMatchIsInLayer()) { @@ -528,7 +476,7 @@ bool drawGL(WebCore::IntRect& viewRect, WebCore::IntRect* invalRect, WebCore::In return false; if (!m_glWebViewState) { - m_glWebViewState = new GLWebViewState(&m_viewImpl->gButtonMutex); + m_glWebViewState = new GLWebViewState(); m_glWebViewState->glExtras()->setCursorRingExtra(&m_ring); m_glWebViewState->glExtras()->setFindOnPageExtra(&m_findOnPage); if (m_baseLayer->content()) { @@ -638,8 +586,7 @@ PictureSet* draw(SkCanvas* canvas, SkColor bgColor, int extras, bool split) break; case DrawExtrasCursorRing: if (drawCursorPreamble(root) && m_ring.setup()) { - if (!m_ring.m_isButton) - extra = &m_ring; + extra = &m_ring; drawCursorPostamble(); } break; @@ -2296,14 +2243,6 @@ static bool nativeMoveCursor(JNIEnv *env, jobject obj, return view->moveCursor(key, count, ignoreScroll); } -static void nativeRecordButtons(JNIEnv* env, jobject obj, jint nativeView, - bool hasFocus, bool pressed, bool invalidate) -{ - WebView* view = (WebView*) nativeView; - LOG_ASSERT(view, "view not set in %s", __FUNCTION__); - view->nativeRecordButtons(hasFocus, pressed, invalidate); -} - static void nativeSetFindIsUp(JNIEnv *env, jobject obj, jboolean isUp) { WebView* view = GET_NATIVE_VIEW(env, obj); @@ -2639,16 +2578,20 @@ static bool nativeSetProperty(JNIEnv *env, jobject obj, jstring jkey, jstring jv TilesManager::instance()->setInvertedScreen(false); return true; } - if (key == "inverted_contrast") { + else if (key == "inverted_contrast") { float contrast = value.toFloat(); TilesManager::instance()->setInvertedScreenContrast(contrast); return true; } - if (key == "enable_cpu_upload_path") { + else if (key == "enable_cpu_upload_path") { TilesManager::instance()->transferQueue()->setTextureUploadType( value == "true" ? CpuUpload : GpuUpload); return true; } + else if (key == "use_minimal_memory") { + TilesManager::instance()->setUseMinimalMemory(value == "true"); + return true; + } return false; } @@ -2886,8 +2829,6 @@ static JNINativeMethod gJavaWebViewMethods[] = { (void*) nativeMoveSelection }, { "nativePointInNavCache", "(III)Z", (void*) nativePointInNavCache }, - { "nativeRecordButtons", "(IZZZ)V", - (void*) nativeRecordButtons }, { "nativeResetSelection", "()V", (void*) nativeResetSelection }, { "nativeSelectableText", "()Landroid/graphics/Point;", |