summaryrefslogtreecommitdiffstats
path: root/Source/WebCore/platform
diff options
context:
space:
mode:
authorJohn Reck <jreck@google.com>2011-11-07 23:25:15 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2011-11-07 23:25:15 +0000
commitd7abaddf5e1d8a8e5caf8c2af18699d98be8b8bf (patch)
tree57a1657112eb5d7cd596050b52c3b3ab2f9bf8cf /Source/WebCore/platform
parent557336db0d2cffe6f0e9213da1cb34676a02f178 (diff)
parent82ccbd8ce95211b4b5afad6a653462fd3beb771b (diff)
downloadexternal_webkit-d7abaddf5e1d8a8e5caf8c2af18699d98be8b8bf.zip
external_webkit-d7abaddf5e1d8a8e5caf8c2af18699d98be8b8bf.tar.gz
external_webkit-d7abaddf5e1d8a8e5caf8c2af18699d98be8b8bf.tar.bz2
am 82ccbd8c: Remove the global button lock
* commit '82ccbd8ce95211b4b5afad6a653462fd3beb771b': Remove the global button lock
Diffstat (limited to 'Source/WebCore/platform')
-rw-r--r--Source/WebCore/platform/android/RenderThemeAndroid.cpp15
-rw-r--r--Source/WebCore/platform/graphics/android/GLWebViewState.cpp5
-rw-r--r--Source/WebCore/platform/graphics/android/GLWebViewState.h3
-rw-r--r--Source/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp2
-rw-r--r--Source/WebCore/platform/graphics/android/PlatformGraphicsContext.cpp29
-rw-r--r--Source/WebCore/platform/graphics/android/PlatformGraphicsContext.h109
-rw-r--r--Source/WebCore/platform/graphics/android/android_graphics.cpp16
7 files changed, 15 insertions, 164 deletions
diff --git a/Source/WebCore/platform/android/RenderThemeAndroid.cpp b/Source/WebCore/platform/android/RenderThemeAndroid.cpp
index 7ef814e..481ecbf 100644
--- a/Source/WebCore/platform/android/RenderThemeAndroid.cpp
+++ b/Source/WebCore/platform/android/RenderThemeAndroid.cpp
@@ -234,17 +234,18 @@ bool RenderThemeAndroid::paintButton(RenderObject* obj, const PaintInfo& info, c
// If it is a disabled button, simply paint it to the master picture.
Node* node = obj->node();
Element* formControlElement = static_cast<Element*>(node);
- if (formControlElement && !formControlElement->isEnabledFormControl()) {
+ if (formControlElement) {
android::WebFrame* webFrame = getWebFrame(node);
if (webFrame) {
RenderSkinAndroid* skins = webFrame->renderSkins();
- if (skins)
- skins->renderSkinButton()->draw(getCanvasFromInfo(info), rect,
- RenderSkinAndroid::kDisabled);
+ if (skins) {
+ RenderSkinAndroid::State state = RenderSkinAndroid::kNormal;
+ if (!formControlElement->isEnabledFormControl())
+ state = RenderSkinAndroid::kDisabled;
+ skins->renderSkinButton()->draw(getCanvasFromInfo(info), rect, state);
+ }
}
- } else
- // Store all the important information in the platform context.
- info.context->platformContext()->storeButtonInfo(node, rect);
+ }
// We always return false so we do not request to be redrawn.
return false;
diff --git a/Source/WebCore/platform/graphics/android/GLWebViewState.cpp b/Source/WebCore/platform/graphics/android/GLWebViewState.cpp
index a1766d0..a44a743 100644
--- a/Source/WebCore/platform/graphics/android/GLWebViewState.cpp
+++ b/Source/WebCore/platform/graphics/android/GLWebViewState.cpp
@@ -69,7 +69,7 @@ namespace WebCore {
using namespace android;
-GLWebViewState::GLWebViewState(android::Mutex* buttonMutex)
+GLWebViewState::GLWebViewState()
: m_zoomManager(this)
, m_paintingBaseLayer(0)
, m_currentBaseLayer(0)
@@ -78,7 +78,6 @@ GLWebViewState::GLWebViewState(android::Mutex* buttonMutex)
, m_usePageA(true)
, m_frameworkInval(0, 0, 0, 0)
, m_frameworkLayersInval(0, 0, 0, 0)
- , m_globalButtonMutex(buttonMutex)
, m_baseLayerUpdate(true)
, m_backgroundColor(SK_ColorWHITE)
, m_isScrolling(false)
@@ -241,9 +240,7 @@ unsigned int GLWebViewState::paintBaseLayerContent(SkCanvas* canvas)
SkSafeRef(base);
m_baseLayerLock.unlock();
if (base) {
- m_globalButtonMutex->lock();
base->drawCanvas(canvas);
- m_globalButtonMutex->unlock();
}
SkSafeUnref(base);
return m_currentPictureCounter;
diff --git a/Source/WebCore/platform/graphics/android/GLWebViewState.h b/Source/WebCore/platform/graphics/android/GLWebViewState.h
index b2aab88..5f7ca71 100644
--- a/Source/WebCore/platform/graphics/android/GLWebViewState.h
+++ b/Source/WebCore/platform/graphics/android/GLWebViewState.h
@@ -165,7 +165,7 @@ class LayerAndroid;
class GLWebViewState {
public:
- GLWebViewState(android::Mutex* globalButtonMutex);
+ GLWebViewState();
~GLWebViewState();
ZoomManager* zoomManager() { return &m_zoomManager; }
@@ -254,7 +254,6 @@ private:
IntRect m_lastInval;
IntRect m_frameworkInval;
IntRect m_frameworkLayersInval;
- android::Mutex* m_globalButtonMutex;
bool m_baseLayerUpdate;
SkRegion m_invalidateRegion;
diff --git a/Source/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp b/Source/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp
index 6cb9288..05a0fdc 100644
--- a/Source/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp
+++ b/Source/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp
@@ -652,7 +652,7 @@ bool GraphicsLayerAndroid::paintContext(SkPicture* context,
if (!canvas)
return false;
- PlatformGraphicsContext platformContext(canvas, 0);
+ PlatformGraphicsContext platformContext(canvas);
GraphicsContext graphicsContext(&platformContext);
paintGraphicsLayerContents(graphicsContext, rect);
diff --git a/Source/WebCore/platform/graphics/android/PlatformGraphicsContext.cpp b/Source/WebCore/platform/graphics/android/PlatformGraphicsContext.cpp
index fcdcce9..098534c 100644
--- a/Source/WebCore/platform/graphics/android/PlatformGraphicsContext.cpp
+++ b/Source/WebCore/platform/graphics/android/PlatformGraphicsContext.cpp
@@ -30,13 +30,13 @@
namespace WebCore {
-PlatformGraphicsContext::PlatformGraphicsContext(SkCanvas* canvas, WTF::Vector<Container>* buttons)
- : mCanvas(canvas), m_deleteCanvas(false), m_buttons(buttons)
+PlatformGraphicsContext::PlatformGraphicsContext(SkCanvas* canvas)
+ : mCanvas(canvas), m_deleteCanvas(false)
{
}
PlatformGraphicsContext::PlatformGraphicsContext()
- : mCanvas(new SkCanvas), m_deleteCanvas(true), m_buttons(0)
+ : mCanvas(new SkCanvas), m_deleteCanvas(true)
{
}
@@ -48,27 +48,4 @@ PlatformGraphicsContext::~PlatformGraphicsContext()
}
}
-void PlatformGraphicsContext::storeButtonInfo(Node* node, const IntRect& r)
-{
- if (m_buttons == NULL)
- return;
- // Check to see if we already have a Container for this node. If so, update
- // it with the new rectangle and make the new recording canvas reference
- // its picture.
- Container* end = m_buttons->end();
- for (Container* ptr = m_buttons->begin(); ptr != end; ptr++) {
- if (ptr->matches(node)) {
- mCanvas->drawPicture(*(ptr->picture()));
- ptr->setRect(r);
- return;
- }
- }
- // We did not have a Container representing this node, so create a new one.
- Container container(node, r);
- // Place a reference to our subpicture in the Picture.
- mCanvas->drawPicture(*(container.picture()));
- // Keep track of the information about the button.
- m_buttons->append(container);
-}
-
} // WebCore
diff --git a/Source/WebCore/platform/graphics/android/PlatformGraphicsContext.h b/Source/WebCore/platform/graphics/android/PlatformGraphicsContext.h
index 6d08d44..d22dbd8 100644
--- a/Source/WebCore/platform/graphics/android/PlatformGraphicsContext.h
+++ b/Source/WebCore/platform/graphics/android/PlatformGraphicsContext.h
@@ -35,108 +35,6 @@
class SkCanvas;
-class Container {
-public:
- Container(WebCore::Node* node, const WebCore::IntRect& r)
- : m_node(node), m_rect(r), m_state(WebCore::RenderSkinAndroid::kDisabled)
- {
- m_picture = new SkPicture;
- }
-
- ~Container()
- {
- m_picture->unref();
- }
-
- Container& operator=(const Container& src)
- {
- if (this != &src) {
- m_node = src.m_node;
- if (m_picture)
- m_picture->unref();
- m_picture = src.m_picture;
- m_picture->ref();
- m_rect = src.m_rect;
- m_state = WebCore::RenderSkinAndroid::kDisabled;
- }
- return *this;
- }
-
- Container(const Container& src)
- {
- m_node = src.m_node;
- m_picture = src.m_picture;
- m_picture->ref();
- m_rect = src.m_rect;
- m_state = WebCore::RenderSkinAndroid::kDisabled;
- }
-
- // m_picture has a ref count of 1 to begin with. It will increase each time
- // m_picture is referenced by another picture. When the other pictures are
- // deleted, the ref count gets decremented. If the ref count is one, then
- // no other pictures reference this one, so the button is no longer being
- // used, and therefore can be removed.
- bool canBeRemoved()
- {
- return m_picture->getRefCnt() == 1;
- }
-
- bool matches(const WebCore::Node* match) { return m_node == match; }
-
- const WebCore::Node* node() const { return m_node; }
-
- // Provide a pointer to our SkPicture.
- SkPicture* picture() { return m_picture; }
-
- WebCore::IntRect rect() { return m_rect; }
-
- // Update the rectangle with a new rectangle, as the positioning of this
- // button may have changed due to a new layout. If it is a new rectangle,
- // set its state to disabled, so that it will be redrawn when we cycle
- // through the list of buttons.
- void setRect(WebCore::IntRect r)
- {
- if (m_rect != r) {
- m_rect = r;
- m_state = WebCore::RenderSkinAndroid::kDisabled;
- }
- }
-
- // Update the focus state of this button, depending on whether it
- // corresponds to the focused node passed in. If its state has changed,
- // re-record to the subpicture, so the master picture will reflect the
- // change.
- void updateFocusState(WebCore::RenderSkinAndroid::State state,
- WebCore::RenderSkinButton* buttonSkin)
- {
- if (state == m_state)
- return;
- // If this button is being told to draw focused, but it is already in a
- // pressed state, leave it in the pressed state, to show that it is
- // being followed.
- if (m_state == WebCore::RenderSkinAndroid::kPressed &&
- state == WebCore::RenderSkinAndroid::kFocused)
- return;
- m_state = state;
- SkCanvas* canvas = m_picture->beginRecording(m_rect.maxX(), m_rect.maxY());
- buttonSkin->draw(canvas, m_rect, state);
- m_picture->endRecording();
- }
-private:
- // Only used for comparison, since after it is stored it will be transferred
- // to the UI thread.
- WebCore::Node* m_node;
- // The rectangle representing the bounds of the button.
- WebCore::IntRect m_rect;
- // An SkPicture that, thanks to storeButtonInfo, is pointed to by the master
- // picture, so that we can rerecord this button without rerecording the
- // world.
- SkPicture* m_picture;
- // The state of the button - Currently kFocused or kNormal (and kDisabled
- // as an initial value), but could be expanded to include other states.
- WebCore::RenderSkinAndroid::State m_state;
-};
-
namespace WebCore {
class GraphicsContext;
@@ -146,19 +44,14 @@ public:
PlatformGraphicsContext();
// Pass in a recording canvas, and an array of button information to be
// updated.
- PlatformGraphicsContext(SkCanvas* canvas, WTF::Vector<Container>* buttons);
+ PlatformGraphicsContext(SkCanvas* canvas);
~PlatformGraphicsContext();
SkCanvas* mCanvas;
bool deleteUs() const { return m_deleteCanvas; }
- // If our graphicscontext has a button list, add a new container for the
- // nod/rect, and record a new subpicture for this node/button in the current
- // mCanvas
- void storeButtonInfo(Node* node, const IntRect& r);
private:
bool m_deleteCanvas;
- WTF::Vector<Container>* m_buttons;
};
}
diff --git a/Source/WebCore/platform/graphics/android/android_graphics.cpp b/Source/WebCore/platform/graphics/android/android_graphics.cpp
index e255d29..e88c65d 100644
--- a/Source/WebCore/platform/graphics/android/android_graphics.cpp
+++ b/Source/WebCore/platform/graphics/android/android_graphics.cpp
@@ -112,22 +112,6 @@ void CursorRing::draw(SkCanvas* canvas, LayerAndroid* layer, IntRect* inval)
void CursorRing::setIsButton(const CachedNode* node)
{
m_isButton = false;
- m_viewImpl->gButtonMutex.lock();
- // If this is a button drawn by us (rather than webkit) do not draw the
- // cursor ring, since its cursor will be shown by a change in what we draw.
- // Should be in sync with recordButtons, since that will be called
- // before this.
- if (m_viewImpl->m_buttons.size() > 0) {
- WebCore::Node* cursorPointer = (WebCore::Node*) node->nodePointer();
- Container* end = m_viewImpl->m_buttons.end();
- for (Container* ptr = m_viewImpl->m_buttons.begin(); ptr != end; ptr++) {
- if (ptr->matches(cursorPointer)) {
- m_isButton = true;
- break;
- }
- }
- }
- m_viewImpl->gButtonMutex.unlock();
}
bool CursorRing::setup()